Hello community, here is the log from the commit of package python-pep8-naming for openSUSE:Factory checked in at 2020-07-14 07:58:19 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-pep8-naming (Old) and /work/SRC/openSUSE:Factory/.python-pep8-naming.new.3060 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-pep8-naming" Tue Jul 14 07:58:19 2020 rev:8 rq:820508 version:0.11.1 Changes: -------- --- /work/SRC/openSUSE:Factory/python-pep8-naming/python-pep8-naming.changes 2020-03-24 22:38:37.213272469 +0100 +++ /work/SRC/openSUSE:Factory/.python-pep8-naming.new.3060/python-pep8-naming.changes 2020-07-14 07:59:28.945827097 +0200 @@ -1,0 +2,11 @@ +Sat Jul 11 18:38:46 UTC 2020 - Arun Persaud <a...@gmx.de> + +- update to version 0.11.1: + * Fix an AST-related AttributeError when processing decorator lists. + +- changes from version 0.11.0: + * __class_getitem__ is now recognized as a class method. + * Support ast.Call nodes in decorator lists (@decorator(arg)). + * As a performance improvement, onl + +------------------------------------------------------------------- Old: ---- pep8-naming-0.10.0.tar.gz New: ---- pep8-naming-0.11.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-pep8-naming.spec ++++++ --- /var/tmp/diff_new_pack.YYe8Tm/_old 2020-07-14 07:59:29.513828936 +0200 +++ /var/tmp/diff_new_pack.YYe8Tm/_new 2020-07-14 07:59:29.517828949 +0200 @@ -18,7 +18,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-pep8-naming -Version: 0.10.0 +Version: 0.11.1 Release: 0 Summary: Flake8 plugin for checking PEP-8 naming conventions License: MIT ++++++ pep8-naming-0.10.0.tar.gz -> pep8-naming-0.11.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pep8-naming-0.10.0/CHANGELOG.rst new/pep8-naming-0.11.1/CHANGELOG.rst --- old/pep8-naming-0.10.0/CHANGELOG.rst 2020-03-20 22:13:50.000000000 +0100 +++ new/pep8-naming-0.11.1/CHANGELOG.rst 2020-06-17 01:48:07.000000000 +0200 @@ -1,8 +1,23 @@ Changes ======= +0.11.1 - 2020-06-16 +------------------- + +* Fix an AST-related AttributeError when processing decorator lists. + + +0.11.0 - 2020-06-16 +------------------- + +* ``__class_getitem__`` is now recognized as a class method. + +* Support ``ast.Call`` nodes in decorator lists (``@decorator(arg)``). + +* As a performance improvement, only checks for selected error codes are run. + 0.10.0 - 2020-03-20 ------------------- +------------------- * ``--ignore-names`` now supports globbing and applies to the N804 and N805 checks. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pep8-naming-0.10.0/PKG-INFO new/pep8-naming-0.11.1/PKG-INFO --- old/pep8-naming-0.10.0/PKG-INFO 2020-03-20 22:24:16.000000000 +0100 +++ new/pep8-naming-0.11.1/PKG-INFO 2020-06-17 01:48:38.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: pep8-naming -Version: 0.10.0 +Version: 0.11.1 Summary: Check PEP-8 naming conventions, plugin for flake8 Home-page: https://github.com/PyCQA/pep8-naming Author: Florent Xicluna @@ -41,6 +41,9 @@ By default the plugin is enabled. + Error Codes + ----------- + These error codes are emitted: +------+-------------------------------------------------------+ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pep8-naming-0.10.0/README.rst new/pep8-naming-0.11.1/README.rst --- old/pep8-naming-0.10.0/README.rst 2020-02-07 00:56:42.000000000 +0100 +++ new/pep8-naming-0.11.1/README.rst 2020-04-14 21:07:29.000000000 +0200 @@ -33,6 +33,9 @@ By default the plugin is enabled. +Error Codes +----------- + These error codes are emitted: +------+-------------------------------------------------------+ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pep8-naming-0.10.0/run_tests.py new/pep8-naming-0.11.1/run_tests.py --- old/pep8-naming-0.10.0/run_tests.py 2019-07-17 18:28:29.000000000 +0200 +++ new/pep8-naming-0.11.1/run_tests.py 2020-06-05 18:27:22.000000000 +0200 @@ -80,6 +80,11 @@ def parse_options(checker, options): """Parse the CLI-style flags from `options` and expose to `checker`""" options_manager = OptionsManager('flake8') + options_manager.add_option('--select', default=[]) + options_manager.add_option('--extended-default-select', default=['N']) + options_manager.add_option('--ignore', default=[]) + options_manager.add_option('--extend-ignore', default=[]) + options_manager.add_option('--enable-extensions', default=[]) checker.add_options(options_manager) processed_options, _ = options_manager.parse_args(options) checker.parse_options(processed_options) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pep8-naming-0.10.0/src/pep8_naming.egg-info/PKG-INFO new/pep8-naming-0.11.1/src/pep8_naming.egg-info/PKG-INFO --- old/pep8-naming-0.10.0/src/pep8_naming.egg-info/PKG-INFO 2020-03-20 22:24:16.000000000 +0100 +++ new/pep8-naming-0.11.1/src/pep8_naming.egg-info/PKG-INFO 2020-06-17 01:48:38.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: pep8-naming -Version: 0.10.0 +Version: 0.11.1 Summary: Check PEP-8 naming conventions, plugin for flake8 Home-page: https://github.com/PyCQA/pep8-naming Author: Florent Xicluna @@ -41,6 +41,9 @@ By default the plugin is enabled. + Error Codes + ----------- + These error codes are emitted: +------+-------------------------------------------------------+ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pep8-naming-0.10.0/src/pep8ext_naming.py new/pep8-naming-0.11.1/src/pep8ext_naming.py --- old/pep8-naming-0.10.0/src/pep8ext_naming.py 2020-03-20 22:13:50.000000000 +0100 +++ new/pep8-naming-0.11.1/src/pep8ext_naming.py 2020-06-17 01:48:07.000000000 +0200 @@ -6,6 +6,7 @@ from functools import partial from itertools import chain +from flake8 import style_guide from flake8_polyfill import options try: @@ -14,11 +15,16 @@ except ImportError: from flake8.util import ast, iter_child_nodes -__version__ = '0.10.0' +__version__ = '0.11.1' PYTHON_VERSION = sys.version_info[:3] PY2 = PYTHON_VERSION[0] == 2 +CLASS_METHODS = frozenset(( + '__new__', + '__init_subclass__', + '__class_getitem__', +)) METACLASS_BASES = frozenset(('type', 'ABCMeta')) # Node types which may contain class methods @@ -58,10 +64,11 @@ class _ASTCheckMeta(type): def __init__(cls, class_name, bases, namespace): + cls.codes = tuple(code for code in namespace if code.startswith('N')) try: - cls._checks.append(cls()) + cls.all.append(cls()) except AttributeError: - cls._checks = [] + cls.all = [] def _err(self, node, code, **kwargs): @@ -121,12 +128,12 @@ """Checker of PEP-8 Naming Conventions.""" name = 'naming' version = __version__ + visitors = BaseASTCheck.all decorator_to_type = _build_decorator_to_type( _default_classmethod_decorators, _default_staticmethod_decorators) ignore_names = frozenset(_default_ignore_names) def __init__(self, tree, filename): - self.visitors = BaseASTCheck._checks self.parents = deque() self._node = tree @@ -168,6 +175,15 @@ options.classmethod_decorators, options.staticmethod_decorators) + # Build a list of node visitors based the error codes that have been + # selected in the style guide. Only the checks that have been selected + # will be evaluated as a performance optimization. + engine = style_guide.DecisionEngine(options) + cls.visitors = frozenset( + visitor for visitor in BaseASTCheck.all for code in visitor.codes + if engine.decision_for(code) is style_guide.Decision.Selected + ) + def run(self): return self.visit_tree(self._node) if self._node else () @@ -214,7 +230,7 @@ late_decoration[meth.id] = self.decorator_to_type[func_name] # If this class inherits from a known metaclass base class, it is - # itself a metaclass, and we'll consider all of it's methods to be + # itself a metaclass, and we'll consider all of its methods to be # classmethods. bases = chain( (b.id for b in cls_node.bases if isinstance(b, ast.Name)), @@ -234,17 +250,25 @@ if not isinstance(node, FUNC_NODES): continue node.function_type = _FunctionType.METHOD - if node.name in ('__new__', '__init_subclass__') or ismetaclass: + if node.name in CLASS_METHODS or ismetaclass: node.function_type = _FunctionType.CLASSMETHOD if node.name in late_decoration: node.function_type = late_decoration[node.name] elif node.decorator_list: - names = [self.decorator_to_type[d.id] - for d in node.decorator_list - if isinstance(d, ast.Name) and - d.id in self.decorator_to_type] - if names: - node.function_type = names[0] + for d in node.decorator_list: + name = self.find_decorator_name(d) + if name in self.decorator_to_type: + node.function_type = self.decorator_to_type[name] + break + + @classmethod + def find_decorator_name(cls, d): + if isinstance(d, ast.Name): + return d.id + elif isinstance(d, ast.Attribute): + return d.attr + elif isinstance(d, ast.Call): + return cls.find_decorator_name(d.func) @staticmethod def find_global_defs(func_def_node): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pep8-naming-0.10.0/testsuite/N805.py new/pep8-naming-0.11.1/testsuite/N805.py --- old/pep8-naming-0.10.0/testsuite/N805.py 2020-02-26 18:29:19.000000000 +0100 +++ new/pep8-naming-0.11.1/testsuite/N805.py 2020-06-17 01:48:07.000000000 +0200 @@ -49,9 +49,17 @@ test2 = staticmethod(test2) #: Okay class Foo(object): + def __new__(cls): + pass +#: Okay +class Foo(object): def __init_subclass__(cls): pass #: Okay +class Foo(object): + def __class_getitem__(cls, key): + pass +#: Okay class Meta(type): def __new__(cls, name, bases, attrs): pass @@ -96,6 +104,34 @@ def test(cls, sy): pass test = classmethod(test) +#: Okay(--classmethod-decorators=myclassmethod) +class C(object): + @myclassmethod('foo') + def bar(cls): + return 42 +#: Okay +class PropertySetter(object): + @property + def var(self): + return True + @var.setter + def var(self, value): + self.var = value +#: Okay +class CalledInstanceDecorator(object): + @module.inner.decorator() + def test(self): + pass +#: Okay(--classmethod-decorators=decorator) +class CalledClassDecorator(object): + @module.inner.decorator() + def test(cls): + pass +#: Okay(--staticmethod-decorators=decorator) +class CalledStaticDecorator(object): + @module.inner.decorator() + def test(): + pass #: Okay(--staticmethod-decorators=ecstatik,stcmthd) class NewStaticMethodDecorators(object): @ecstatik