summaryrefslogtreecommitdiff
path: root/doc/summarize.py
diff options
context:
space:
mode:
authorFrederick Lefebvre <fredlef@amazon.com>2018-03-14 03:33:05 +0000
committerfredlef <fredlef@amazon.com>2018-03-14 13:14:55 -0700
commit53b358ce7eddf78ac2bc22045fbe25e91e663b9a (patch)
tree37054f48b52d3725f7b1f6a840fd0f0d40ba2399 /doc/summarize.py
parenta91f61a429e35a47f6faa025ceb862664dc12609 (diff)
downloadnumpy-53b358ce7eddf78ac2bc22045fbe25e91e663b9a.tar.gz
TST: Import abstract classes from collections.abc
Abstract collection classes accessed from the collections module have been deprecated since Python 3.3. They should be accessed through collections.abc. When run with Python 3.7, the deprecation warning cause multiple tests to fail.
Diffstat (limited to 'doc/summarize.py')
-rwxr-xr-xdoc/summarize.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/doc/summarize.py b/doc/summarize.py
index dbadb30b3..972e298f4 100755
--- a/doc/summarize.py
+++ b/doc/summarize.py
@@ -8,7 +8,12 @@ Show a summary about which NumPy functions are documented and which are not.
from __future__ import division, absolute_import, print_function
import os, glob, re, sys, inspect, optparse
-import collections
+try:
+ # Accessing collections abstact classes from collections
+ # has been deprecated since Python 3.3
+ import collections.abc as collections_abc
+except ImportError:
+ import collections as collections_abc
sys.path.append(os.path.join(os.path.dirname(__file__), 'sphinxext'))
from sphinxext.phantom_import import import_phantom_module
@@ -136,7 +141,7 @@ def get_undocumented(documented, module, module_name=None, skip=[]):
if full_name in skip: continue
if full_name.startswith('numpy.') and full_name[6:] in skip: continue
- if not (inspect.ismodule(obj) or isinstance(obj, collections.Callable) or inspect.isclass(obj)):
+ if not (inspect.ismodule(obj) or isinstance(obj, collections_abc.Callable) or inspect.isclass(obj)):
continue
if full_name not in documented: