From 53b358ce7eddf78ac2bc22045fbe25e91e663b9a Mon Sep 17 00:00:00 2001 From: Frederick Lefebvre Date: Wed, 14 Mar 2018 03:33:05 +0000 Subject: 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. --- doc/summarize.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'doc/summarize.py') 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: -- cgit v1.2.1