New Upstream Snapshot - pep8-naming
Ready changes
Summary
Merged new upstream version: 0.13.3+ds (was: 0.10.0).
Resulting package
Built on 2022-12-30T22:06 (took 6m17s)
The resulting binary packages can be installed (if you have the apt repository enabled) by running one of:
apt install -t fresh-snapshots python3-pep8-naming
Lintian Result
Diff
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 761e75e..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,33 +0,0 @@
-language: python
-
-sudo: false
-
-install:
- pip install tox
-
-script: tox
-
-matrix:
- include:
- - env: TOXENV=py27
- python: 2.7
- - env: TOXENV=py35
- python: 3.5
- - env: TOXENV=py36
- python: 3.6
- - env: TOXENV=py37
- dist: xenial
- sudo: required
- python: 3.7
- - env: TOXENV=py38
- dist: xenial
- sudo: required
- python: 3.8
- - env: TOXENV=pypy
- python: pypy
- - env: TOXENV=py27-flake8
- python: 2.7
- - env: TOXENV=py37-flake8
- dist: xenial
- sudo: required
- python: 3.7
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index 7a2a8f5..9ae557b 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -1,8 +1,61 @@
Changes
=======
+0.13.3 - 2022-12-19
+-------------------
+
+* Formally require flake8 5.0.0 or later.
+* Add support for Python 3.11.
+
+0.13.2 - 2022-08-19
+-------------------
+
+* Formally require Python 3.7 or later using ``python_requires``.
+
+0.13.1 - 2022-07-15
+-------------------
+
+* Fix warnings related to deprecated options syntax.
+
+0.13.0 - 2022-06-22
+-------------------
+
+* Python 3.7 or later is now required.
+
+* ``setUpModule`` and ``tearDownModule`` are now exempted by default.
+
+0.12.1 - 2021-08-06
+-------------------
+
+* Fix potential stack exhaustion in the N818 check.
+
+0.12.0 - 2021-07-06
+-------------------
+
+* flake8 3.9.1 or later is now required.
+
+* N818 checks exception class names for an "Error" suffix (disabled by default).
+
+* ``asyncSetUp`` and ``asyncTearDown`` are now exempted by default.
+
+
+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 --git a/PKG-INFO b/PKG-INFO
new file mode 100644
index 0000000..2f49a8d
--- /dev/null
+++ b/PKG-INFO
@@ -0,0 +1,136 @@
+Metadata-Version: 2.1
+Name: pep8-naming
+Version: 0.13.3
+Summary: Check PEP-8 naming conventions, plugin for flake8
+Home-page: https://github.com/PyCQA/pep8-naming
+Author: Florent Xicluna
+Author-email: florent.xicluna@gmail.com
+License: Expat license
+Project-URL: Source, https://github.com/PyCQA/pep8-naming
+Project-URL: Issues, https://github.com/PyCQA/pep8-naming/issues
+Project-URL: Changelog, https://github.com/PyCQA/pep8-naming/blob/main/CHANGELOG.rst
+Keywords: flake8 pep8 naming
+Classifier: Development Status :: 5 - Production/Stable
+Classifier: Environment :: Console
+Classifier: Framework :: Flake8
+Classifier: Intended Audience :: Developers
+Classifier: License :: OSI Approved :: MIT License
+Classifier: Operating System :: OS Independent
+Classifier: Programming Language :: Python
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3.7
+Classifier: Programming Language :: Python :: 3.8
+Classifier: Programming Language :: Python :: 3.9
+Classifier: Programming Language :: Python :: 3.10
+Classifier: Programming Language :: Python :: 3.11
+Classifier: Programming Language :: Python :: 3 :: Only
+Classifier: Topic :: Software Development :: Libraries :: Python Modules
+Classifier: Topic :: Software Development :: Quality Assurance
+Requires-Python: >=3.7
+License-File: LICENSE
+
+PEP 8 Naming Conventions
+========================
+
+Check your code against `PEP 8 <https://www.python.org/dev/peps/pep-0008/>`_
+naming conventions.
+
+This module provides a plugin for ``flake8``, the Python code checker.
+
+(It replaces the plugin ``flint-naming`` for the ``flint`` checker.)
+
+
+Installation
+------------
+
+You can install, upgrade, uninstall ``pep8-naming`` with these commands::
+
+ $ pip install pep8-naming
+ $ pip install --upgrade pep8-naming
+ $ pip uninstall pep8-naming
+
+
+Plugin for Flake8
+-----------------
+
+When both ``flake8`` and ``pep8-naming`` are installed, the plugin is
+available in ``flake8``::
+
+ $ flake8 --version
+ 4.0.1 (mccabe: 0.6.1, naming: 0.13.0, pycodestyle: 2.8.0, pyflakes: 2.4.0) CPython 3.8.10 on Linux
+
+By default the plugin is enabled.
+
+Error Codes
+-----------
+
+These error codes are emitted:
+
++---------+-----------------------------------------------------------------+
+| code | sample message |
++=========+=================================================================+
+| _`N801` | class names should use CapWords convention (`class names`_) |
++---------+-----------------------------------------------------------------+
+| _`N802` | function name should be lowercase (`function names`_) |
++---------+-----------------------------------------------------------------+
+| _`N803` | argument name should be lowercase (`function arguments`_) |
++---------+-----------------------------------------------------------------+
+| _`N804` | first argument of a classmethod should be named 'cls' |
+| | (`function arguments`_) |
++---------+-----------------------------------------------------------------+
+| _`N805` | first argument of a method should be named 'self' |
+| | (`function arguments`_) |
++---------+-----------------------------------------------------------------+
+| _`N806` | variable in function should be lowercase |
++---------+-----------------------------------------------------------------+
+| _`N807` | function name should not start and end with '__' |
++---------+-----------------------------------------------------------------+
+| _`N811` | constant imported as non constant (`constants`_) |
++---------+-----------------------------------------------------------------+
+| _`N812` | lowercase imported as non-lowercase |
++---------+-----------------------------------------------------------------+
+| _`N813` | camelcase imported as lowercase |
++---------+-----------------------------------------------------------------+
+| _`N814` | camelcase imported as constant |
+| | (distinct from `N817`_ for selective enforcement) |
++---------+-----------------------------------------------------------------+
+| _`N815` | mixedCase variable in class scope |
+| | (`constants`_, `method names`_) |
++---------+-----------------------------------------------------------------+
+| _`N816` | mixedCase variable in global scope (`constants`_) |
++---------+-----------------------------------------------------------------+
+| _`N817` | camelcase imported as acronym |
+| | (distinct from `N814`_ for selective enforcement) |
++---------+-----------------------------------------------------------------+
+| _`N818` | error suffix in exception names (`exceptions`_) |
++---------+-----------------------------------------------------------------+
+
+.. _class names: https://www.python.org/dev/peps/pep-0008/#class-names
+.. _constants: https://www.python.org/dev/peps/pep-0008/#constants
+.. _exceptions: https://www.python.org/dev/peps/pep-0008/#exception-names
+.. _function names: https://www.python.org/dev/peps/pep-0008/#function-and-variable-names
+.. _function arguments: https://www.python.org/dev/peps/pep-0008/#function-and-method-arguments
+.. _method names: https://www.python.org/dev/peps/pep-0008/#method-names-and-instance-variables
+
+Options
+-------
+
+The following flake8 options are added:
+
+--ignore-names Ignore errors for specific names or glob patterns.
+
+ Currently, this option can only be used for N802, N803, N804, N805, N806, N815, and N816 errors.
+
+ Default: ``setUp,tearDown,setUpClass,tearDownClass,setUpModule,tearDownModule,asyncSetUp,asyncTearDown,setUpTestData,failureException,longMessage,maxDiff``.
+
+--classmethod-decorators List of method decorators pep8-naming plugin should consider class method.
+
+ Used to prevent false N804 errors.
+
+ Default: ``classmethod``.
+
+--staticmethod-decorators List of method decorators pep8-naming plugin should consider static method.
+
+ Used to prevent false N805 errors.
+
+ Default: ``staticmethod``.
diff --git a/README.rst b/README.rst
index 5634549..42e355d 100644
--- a/README.rst
+++ b/README.rst
@@ -1,6 +1,3 @@
-.. image:: https://travis-ci.org/PyCQA/pep8-naming.svg?branch=master
- :target: https://travis-ci.org/PyCQA/pep8-naming
-
PEP 8 Naming Conventions
========================
@@ -29,44 +26,60 @@ When both ``flake8`` and ``pep8-naming`` are installed, the plugin is
available in ``flake8``::
$ flake8 --version
- 2.0 (pep8: 1.4.3, pyflakes: 0.6.1, naming: 0.2)
+ 4.0.1 (mccabe: 0.6.1, naming: 0.13.0, pycodestyle: 2.8.0, pyflakes: 2.4.0) CPython 3.8.10 on Linux
By default the plugin is enabled.
+Error Codes
+-----------
+
These error codes are emitted:
-+------+-------------------------------------------------------+
-| code | sample message |
-+======+=======================================================+
-| N801 | class names should use CapWords convention |
-+------+-------------------------------------------------------+
-| N802 | function name should be lowercase |
-+------+-------------------------------------------------------+
-| N803 | argument name should be lowercase |
-+------+-------------------------------------------------------+
-| N804 | first argument of a classmethod should be named 'cls' |
-+------+-------------------------------------------------------+
-| N805 | first argument of a method should be named 'self' |
-+------+-------------------------------------------------------+
-| N806 | variable in function should be lowercase |
-+------+-------------------------------------------------------+
-| N807 | function name should not start and end with '__' |
-+------+-------------------------------------------------------+
-+------+-------------------------------------------------------+
-| N811 | constant imported as non constant |
-+------+-------------------------------------------------------+
-| N812 | lowercase imported as non lowercase |
-+------+-------------------------------------------------------+
-| N813 | camelcase imported as lowercase |
-+------+-------------------------------------------------------+
-| N814 | camelcase imported as constant |
-+------+-------------------------------------------------------+
-| N815 | mixedCase variable in class scope |
-+------+-------------------------------------------------------+
-| N816 | mixedCase variable in global scope |
-+------+-------------------------------------------------------+
-| N817 | camelcase imported as acronym |
-+------+-------------------------------------------------------+
++---------+-----------------------------------------------------------------+
+| code | sample message |
++=========+=================================================================+
+| _`N801` | class names should use CapWords convention (`class names`_) |
++---------+-----------------------------------------------------------------+
+| _`N802` | function name should be lowercase (`function names`_) |
++---------+-----------------------------------------------------------------+
+| _`N803` | argument name should be lowercase (`function arguments`_) |
++---------+-----------------------------------------------------------------+
+| _`N804` | first argument of a classmethod should be named 'cls' |
+| | (`function arguments`_) |
++---------+-----------------------------------------------------------------+
+| _`N805` | first argument of a method should be named 'self' |
+| | (`function arguments`_) |
++---------+-----------------------------------------------------------------+
+| _`N806` | variable in function should be lowercase |
++---------+-----------------------------------------------------------------+
+| _`N807` | function name should not start and end with '__' |
++---------+-----------------------------------------------------------------+
+| _`N811` | constant imported as non constant (`constants`_) |
++---------+-----------------------------------------------------------------+
+| _`N812` | lowercase imported as non-lowercase |
++---------+-----------------------------------------------------------------+
+| _`N813` | camelcase imported as lowercase |
++---------+-----------------------------------------------------------------+
+| _`N814` | camelcase imported as constant |
+| | (distinct from `N817`_ for selective enforcement) |
++---------+-----------------------------------------------------------------+
+| _`N815` | mixedCase variable in class scope |
+| | (`constants`_, `method names`_) |
++---------+-----------------------------------------------------------------+
+| _`N816` | mixedCase variable in global scope (`constants`_) |
++---------+-----------------------------------------------------------------+
+| _`N817` | camelcase imported as acronym |
+| | (distinct from `N814`_ for selective enforcement) |
++---------+-----------------------------------------------------------------+
+| _`N818` | error suffix in exception names (`exceptions`_) |
++---------+-----------------------------------------------------------------+
+
+.. _class names: https://www.python.org/dev/peps/pep-0008/#class-names
+.. _constants: https://www.python.org/dev/peps/pep-0008/#constants
+.. _exceptions: https://www.python.org/dev/peps/pep-0008/#exception-names
+.. _function names: https://www.python.org/dev/peps/pep-0008/#function-and-variable-names
+.. _function arguments: https://www.python.org/dev/peps/pep-0008/#function-and-method-arguments
+.. _method names: https://www.python.org/dev/peps/pep-0008/#method-names-and-instance-variables
Options
-------
@@ -77,7 +90,7 @@ The following flake8 options are added:
Currently, this option can only be used for N802, N803, N804, N805, N806, N815, and N816 errors.
- Default: ``setUp,tearDown,setUpClass,tearDownClass,setUpTestData,failureException,longMessage,maxDiff``.
+ Default: ``setUp,tearDown,setUpClass,tearDownClass,setUpModule,tearDownModule,asyncSetUp,asyncTearDown,setUpTestData,failureException,longMessage,maxDiff``.
--classmethod-decorators List of method decorators pep8-naming plugin should consider class method.
diff --git a/debian/changelog b/debian/changelog
index 48bb62a..540ea67 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+pep8-naming (0.13.3+ds-1) UNRELEASED; urgency=low
+
+ * New upstream release.
+
+ -- Debian Janitor <janitor@jelmer.uk> Fri, 30 Dec 2022 22:01:34 -0000
+
pep8-naming (0.10.0-2) unstable; urgency=medium
[ Ondřej Nový ]
diff --git a/run_tests.py b/run_tests.py
index 5bdbb77..5a0ba27 100644
--- a/run_tests.py
+++ b/run_tests.py
@@ -1,10 +1,10 @@
-import io
-import optparse
import os
import platform
import re
import sys
+import flake8
+from flake8.options.manager import OptionManager
import pep8ext_naming
@@ -25,7 +25,7 @@ def main():
errors = 0
for filename in os.listdir('testsuite'):
filepath = os.path.join('testsuite', filename)
- with io.open(filepath, encoding='utf8') as fd:
+ with open(filepath, encoding='utf8') as fd:
lines = list(fd)
if not is_test_allowed(lines):
continue
@@ -70,18 +70,29 @@ def load_tests(lines):
yield testcase, code, options
-class OptionsManager(optparse.OptionParser):
- """A Flake8-2.x-compatible OptionsManager."""
- def __init__(self, *args, **kwargs):
- optparse.OptionParser.__init__(self, *args, **kwargs)
- self.config_options = []
-
-
def parse_options(checker, options):
"""Parse the CLI-style flags from `options` and expose to `checker`"""
- options_manager = OptionsManager('flake8')
+ extra_kwargs = {}
+ if flake8.__version_info__[0] >= 6:
+ extra_kwargs = {
+ "formatter_names": []
+ }
+
+ options_manager = OptionManager(
+ version=flake8.__version__,
+ plugin_versions=f"naming: {pep8ext_naming.__version__}",
+ parents=[],
+ **extra_kwargs,
+ )
+ options_manager.add_option('--select', default=[])
+ options_manager.add_option('--extended-default-select', default=['N'])
+ options_manager.add_option('--extend-select', default=['N'])
+ options_manager.add_option('--ignore', default=[])
+ options_manager.add_option('--extend-ignore', default=[])
+ options_manager.add_option('--enable-extensions', default=[])
+ options_manager.add_option('--extended-default-ignore', default=[])
checker.add_options(options_manager)
- processed_options, _ = options_manager.parse_args(options)
+ processed_options = options_manager.parse_args(options)
checker.parse_options(processed_options)
diff --git a/setup.cfg b/setup.cfg
index 5e40900..f275004 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,2 +1,10 @@
-[wheel]
-universal = 1
+[metadata]
+project_urls =
+ Source=https://github.com/PyCQA/pep8-naming
+ Issues=https://github.com/PyCQA/pep8-naming/issues
+ Changelog=https://github.com/PyCQA/pep8-naming/blob/main/CHANGELOG.rst
+
+[egg_info]
+tag_build =
+tag_date = 0
+
diff --git a/setup.py b/setup.py
index 1e94ea8..3d6fddb 100644
--- a/setup.py
+++ b/setup.py
@@ -1,5 +1,3 @@
-# -*- coding: utf-8 -*-
-from __future__ import with_statement
from setuptools import setup
from setuptools.command.test import test as TestCommand
@@ -44,8 +42,9 @@ setup(
license='Expat license',
package_dir={'': 'src'},
py_modules=['pep8ext_naming'],
- install_requires=['flake8_polyfill>=1.0.2,<2'],
+ install_requires=['flake8>=5.0.0'],
zip_safe=False,
+ python_requires='>=3.7',
entry_points={
'flake8.extension': [
'N8 = pep8ext_naming:NamingChecker',
@@ -59,9 +58,13 @@ setup(
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Programming Language :: Python',
- 'Programming Language :: Python :: 2',
- 'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
+ 'Programming Language :: Python :: 3.7',
+ 'Programming Language :: Python :: 3.8',
+ 'Programming Language :: Python :: 3.9',
+ 'Programming Language :: Python :: 3.10',
+ 'Programming Language :: Python :: 3.11',
+ 'Programming Language :: Python :: 3 :: Only',
'Topic :: Software Development :: Libraries :: Python Modules',
'Topic :: Software Development :: Quality Assurance',
],
diff --git a/src/pep8_naming.egg-info/PKG-INFO b/src/pep8_naming.egg-info/PKG-INFO
new file mode 100644
index 0000000..2f49a8d
--- /dev/null
+++ b/src/pep8_naming.egg-info/PKG-INFO
@@ -0,0 +1,136 @@
+Metadata-Version: 2.1
+Name: pep8-naming
+Version: 0.13.3
+Summary: Check PEP-8 naming conventions, plugin for flake8
+Home-page: https://github.com/PyCQA/pep8-naming
+Author: Florent Xicluna
+Author-email: florent.xicluna@gmail.com
+License: Expat license
+Project-URL: Source, https://github.com/PyCQA/pep8-naming
+Project-URL: Issues, https://github.com/PyCQA/pep8-naming/issues
+Project-URL: Changelog, https://github.com/PyCQA/pep8-naming/blob/main/CHANGELOG.rst
+Keywords: flake8 pep8 naming
+Classifier: Development Status :: 5 - Production/Stable
+Classifier: Environment :: Console
+Classifier: Framework :: Flake8
+Classifier: Intended Audience :: Developers
+Classifier: License :: OSI Approved :: MIT License
+Classifier: Operating System :: OS Independent
+Classifier: Programming Language :: Python
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3.7
+Classifier: Programming Language :: Python :: 3.8
+Classifier: Programming Language :: Python :: 3.9
+Classifier: Programming Language :: Python :: 3.10
+Classifier: Programming Language :: Python :: 3.11
+Classifier: Programming Language :: Python :: 3 :: Only
+Classifier: Topic :: Software Development :: Libraries :: Python Modules
+Classifier: Topic :: Software Development :: Quality Assurance
+Requires-Python: >=3.7
+License-File: LICENSE
+
+PEP 8 Naming Conventions
+========================
+
+Check your code against `PEP 8 <https://www.python.org/dev/peps/pep-0008/>`_
+naming conventions.
+
+This module provides a plugin for ``flake8``, the Python code checker.
+
+(It replaces the plugin ``flint-naming`` for the ``flint`` checker.)
+
+
+Installation
+------------
+
+You can install, upgrade, uninstall ``pep8-naming`` with these commands::
+
+ $ pip install pep8-naming
+ $ pip install --upgrade pep8-naming
+ $ pip uninstall pep8-naming
+
+
+Plugin for Flake8
+-----------------
+
+When both ``flake8`` and ``pep8-naming`` are installed, the plugin is
+available in ``flake8``::
+
+ $ flake8 --version
+ 4.0.1 (mccabe: 0.6.1, naming: 0.13.0, pycodestyle: 2.8.0, pyflakes: 2.4.0) CPython 3.8.10 on Linux
+
+By default the plugin is enabled.
+
+Error Codes
+-----------
+
+These error codes are emitted:
+
++---------+-----------------------------------------------------------------+
+| code | sample message |
++=========+=================================================================+
+| _`N801` | class names should use CapWords convention (`class names`_) |
++---------+-----------------------------------------------------------------+
+| _`N802` | function name should be lowercase (`function names`_) |
++---------+-----------------------------------------------------------------+
+| _`N803` | argument name should be lowercase (`function arguments`_) |
++---------+-----------------------------------------------------------------+
+| _`N804` | first argument of a classmethod should be named 'cls' |
+| | (`function arguments`_) |
++---------+-----------------------------------------------------------------+
+| _`N805` | first argument of a method should be named 'self' |
+| | (`function arguments`_) |
++---------+-----------------------------------------------------------------+
+| _`N806` | variable in function should be lowercase |
++---------+-----------------------------------------------------------------+
+| _`N807` | function name should not start and end with '__' |
++---------+-----------------------------------------------------------------+
+| _`N811` | constant imported as non constant (`constants`_) |
++---------+-----------------------------------------------------------------+
+| _`N812` | lowercase imported as non-lowercase |
++---------+-----------------------------------------------------------------+
+| _`N813` | camelcase imported as lowercase |
++---------+-----------------------------------------------------------------+
+| _`N814` | camelcase imported as constant |
+| | (distinct from `N817`_ for selective enforcement) |
++---------+-----------------------------------------------------------------+
+| _`N815` | mixedCase variable in class scope |
+| | (`constants`_, `method names`_) |
++---------+-----------------------------------------------------------------+
+| _`N816` | mixedCase variable in global scope (`constants`_) |
++---------+-----------------------------------------------------------------+
+| _`N817` | camelcase imported as acronym |
+| | (distinct from `N814`_ for selective enforcement) |
++---------+-----------------------------------------------------------------+
+| _`N818` | error suffix in exception names (`exceptions`_) |
++---------+-----------------------------------------------------------------+
+
+.. _class names: https://www.python.org/dev/peps/pep-0008/#class-names
+.. _constants: https://www.python.org/dev/peps/pep-0008/#constants
+.. _exceptions: https://www.python.org/dev/peps/pep-0008/#exception-names
+.. _function names: https://www.python.org/dev/peps/pep-0008/#function-and-variable-names
+.. _function arguments: https://www.python.org/dev/peps/pep-0008/#function-and-method-arguments
+.. _method names: https://www.python.org/dev/peps/pep-0008/#method-names-and-instance-variables
+
+Options
+-------
+
+The following flake8 options are added:
+
+--ignore-names Ignore errors for specific names or glob patterns.
+
+ Currently, this option can only be used for N802, N803, N804, N805, N806, N815, and N816 errors.
+
+ Default: ``setUp,tearDown,setUpClass,tearDownClass,setUpModule,tearDownModule,asyncSetUp,asyncTearDown,setUpTestData,failureException,longMessage,maxDiff``.
+
+--classmethod-decorators List of method decorators pep8-naming plugin should consider class method.
+
+ Used to prevent false N804 errors.
+
+ Default: ``classmethod``.
+
+--staticmethod-decorators List of method decorators pep8-naming plugin should consider static method.
+
+ Used to prevent false N805 errors.
+
+ Default: ``staticmethod``.
diff --git a/src/pep8_naming.egg-info/SOURCES.txt b/src/pep8_naming.egg-info/SOURCES.txt
new file mode 100644
index 0000000..c15f82c
--- /dev/null
+++ b/src/pep8_naming.egg-info/SOURCES.txt
@@ -0,0 +1,31 @@
+CHANGELOG.rst
+LICENSE
+MANIFEST.in
+README.rst
+run_tests.py
+setup.cfg
+setup.py
+src/pep8ext_naming.py
+src/pep8_naming.egg-info/PKG-INFO
+src/pep8_naming.egg-info/SOURCES.txt
+src/pep8_naming.egg-info/dependency_links.txt
+src/pep8_naming.egg-info/entry_points.txt
+src/pep8_naming.egg-info/not-zip-safe
+src/pep8_naming.egg-info/requires.txt
+src/pep8_naming.egg-info/top_level.txt
+testsuite/N801.py
+testsuite/N802.py
+testsuite/N803.py
+testsuite/N804.py
+testsuite/N805.py
+testsuite/N805_py38.py
+testsuite/N806.py
+testsuite/N806_py38.py
+testsuite/N807.py
+testsuite/N80x.py
+testsuite/N815.py
+testsuite/N816.py
+testsuite/N816_py38.py
+testsuite/N818.py
+testsuite/N81x.py
+testsuite/N8xx.py
\ No newline at end of file
diff --git a/src/pep8_naming.egg-info/dependency_links.txt b/src/pep8_naming.egg-info/dependency_links.txt
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/src/pep8_naming.egg-info/dependency_links.txt
@@ -0,0 +1 @@
+
diff --git a/src/pep8_naming.egg-info/entry_points.txt b/src/pep8_naming.egg-info/entry_points.txt
new file mode 100644
index 0000000..8828012
--- /dev/null
+++ b/src/pep8_naming.egg-info/entry_points.txt
@@ -0,0 +1,2 @@
+[flake8.extension]
+N8 = pep8ext_naming:NamingChecker
diff --git a/src/pep8_naming.egg-info/not-zip-safe b/src/pep8_naming.egg-info/not-zip-safe
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/src/pep8_naming.egg-info/not-zip-safe
@@ -0,0 +1 @@
+
diff --git a/src/pep8_naming.egg-info/requires.txt b/src/pep8_naming.egg-info/requires.txt
new file mode 100644
index 0000000..3c40422
--- /dev/null
+++ b/src/pep8_naming.egg-info/requires.txt
@@ -0,0 +1 @@
+flake8>=5.0.0
diff --git a/src/pep8_naming.egg-info/top_level.txt b/src/pep8_naming.egg-info/top_level.txt
new file mode 100644
index 0000000..f01b766
--- /dev/null
+++ b/src/pep8_naming.egg-info/top_level.txt
@@ -0,0 +1 @@
+pep8ext_naming
diff --git a/src/pep8ext_naming.py b/src/pep8ext_naming.py
index e2474eb..05b24c8 100644
--- a/src/pep8ext_naming.py
+++ b/src/pep8ext_naming.py
@@ -1,52 +1,38 @@
-# -*- coding: utf-8 -*-
"""Checker of PEP-8 Naming Conventions."""
+import ast
import sys
+from ast import iter_child_nodes
from collections import deque
from fnmatch import fnmatch
from functools import partial
from itertools import chain
-from flake8_polyfill import options
+from flake8 import style_guide
-try:
- import ast
- from ast import iter_child_nodes
-except ImportError:
- from flake8.util import ast, iter_child_nodes
-
-__version__ = '0.10.0'
+__version__ = '0.13.3'
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
-METHOD_CONTAINER_NODES = {ast.If, ast.While, ast.For, ast.With}
-FUNC_NODES = (ast.FunctionDef,)
-
-if PY2:
- METHOD_CONTAINER_NODES |= {ast.TryExcept, ast.TryFinally}
-else:
- METHOD_CONTAINER_NODES |= {ast.Try}
-
-if PYTHON_VERSION > (3, 5):
- FUNC_NODES += (ast.AsyncFunctionDef,)
- METHOD_CONTAINER_NODES |= {ast.AsyncWith, ast.AsyncFor}
-
-if PY2:
- def _unpack_args(args):
- ret = []
- for arg in args:
- if isinstance(arg, ast.Tuple):
- ret.extend(_unpack_args(arg.elts))
- else:
- ret.append((arg, arg.id))
- return ret
-
- def get_arg_name_tuples(node):
- return _unpack_args(node.args.args)
-elif PYTHON_VERSION < (3, 8):
+METHOD_CONTAINER_NODES = {
+ ast.If,
+ ast.While,
+ ast.For,
+ ast.With,
+ ast.Try,
+ ast.AsyncWith,
+ ast.AsyncFor,
+}
+FUNC_NODES = (ast.FunctionDef, ast.AsyncFunctionDef)
+
+if PYTHON_VERSION < (3, 8):
def get_arg_name_tuples(node):
groups = (node.args.args, node.args.kwonlyargs)
return [(arg, arg.arg) for args in groups for arg in args]
@@ -58,10 +44,11 @@ else:
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):
@@ -77,7 +64,7 @@ def _err(self, node, code, **kwargs):
code_str = getattr(self, code)
if kwargs:
code_str = code_str.format(**kwargs)
- return lineno, col_offset + 1, '%s %s' % (code, code_str), self
+ return lineno, col_offset + 1, f'{code} {code_str}', self
def _ignored(name, ignore):
@@ -88,7 +75,7 @@ BaseASTCheck = _ASTCheckMeta('BaseASTCheck', (object,),
{'__doc__': "Base for AST Checks.", 'err': _err})
-class _FunctionType(object):
+class _FunctionType:
CLASSMETHOD = 'classmethod'
STATICMETHOD = 'staticmethod'
FUNCTION = 'function'
@@ -100,6 +87,10 @@ _default_ignore_names = [
'tearDown',
'setUpClass',
'tearDownClass',
+ 'setUpModule',
+ 'tearDownModule',
+ 'asyncSetUp',
+ 'asyncTearDown',
'setUpTestData',
'failureException',
'longMessage',
@@ -117,49 +108,48 @@ def _build_decorator_to_type(classmethod_decorators, staticmethod_decorators):
return decorator_to_type
-class NamingChecker(object):
+class NamingChecker:
"""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
@classmethod
def add_options(cls, parser):
- options.register(parser, '--ignore-names',
- default=_default_ignore_names,
- action='store',
- type='string',
- parse_from_config=True,
- comma_separated_list=True,
- help='List of names or glob patterns the pep8-naming '
- 'plugin should ignore. (Defaults to %default)')
-
- options.register(parser, '--classmethod-decorators',
- default=_default_classmethod_decorators,
- action='store',
- type='string',
- parse_from_config=True,
- comma_separated_list=True,
- help='List of method decorators pep8-naming plugin '
- 'should consider classmethods (Defaults to '
- '%default)')
-
- options.register(parser, '--staticmethod-decorators',
- default=_default_staticmethod_decorators,
- action='store',
- type='string',
- parse_from_config=True,
- comma_separated_list=True,
- help='List of method decorators pep8-naming plugin '
- 'should consider staticmethods (Defaults to '
- '%default)')
+ parser.add_option(
+ '--ignore-names',
+ default=_default_ignore_names,
+ parse_from_config=True,
+ comma_separated_list=True,
+ help='List of names or glob patterns the pep8-naming '
+ 'plugin should ignore. (Defaults to %(default)s)',
+ )
+ parser.add_option(
+ '--classmethod-decorators',
+ default=_default_classmethod_decorators,
+ parse_from_config=True,
+ comma_separated_list=True,
+ help='List of method decorators pep8-naming plugin '
+ 'should consider classmethods (Defaults to '
+ '%(default)s)',
+ )
+ parser.add_option(
+ '--staticmethod-decorators',
+ default=_default_staticmethod_decorators,
+ parse_from_config=True,
+ comma_separated_list=True,
+ help='List of method decorators pep8-naming plugin '
+ 'should consider staticmethods (Defaults to '
+ '%(default)s)',
+ )
+ parser.extend_default_ignore(['N818'])
@classmethod
def parse_options(cls, options):
@@ -168,16 +158,23 @@ class NamingChecker(object):
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 ()
def visit_tree(self, node):
- for error in self.visit_node(node):
- yield error
+ yield from self.visit_node(node)
self.parents.append(node)
for child in iter_child_nodes(node):
- for error in self.visit_tree(child):
- yield error
+ yield from self.visit_tree(child)
self.parents.pop()
def visit_node(self, node):
@@ -193,8 +190,7 @@ class NamingChecker(object):
visitor_method = getattr(visitor, method, None)
if visitor_method is None:
continue
- for error in visitor_method(node, parents, ignore_names):
- yield error
+ yield from visitor_method(node, parents, ignore_names)
def tag_class_functions(self, cls_node):
"""Tag functions if they are methods, classmethods, staticmethods"""
@@ -214,7 +210,7 @@ class NamingChecker(object):
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 +230,25 @@ class NamingChecker(object):
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):
@@ -267,6 +271,26 @@ class ClassNameCheck(BaseASTCheck):
Classes for internal use have a leading underscore in addition.
"""
N801 = "class name '{name}' should use CapWords convention"
+ N818 = "exception name '{name}' should be named with an Error suffix"
+
+ @classmethod
+ def get_classdef(cls, name, parents):
+ for parent in parents:
+ for node in parent.body:
+ if isinstance(node, ast.ClassDef) and node.name == name:
+ return node
+
+ @classmethod
+ def superclass_names(cls, name, parents, _names=None):
+ names = _names or set()
+ classdef = cls.get_classdef(name, parents)
+ if not classdef:
+ return names
+ for base in classdef.bases:
+ if isinstance(base, ast.Name) and base.id not in names:
+ names.add(base.id)
+ names.update(cls.superclass_names(base.id, parents, names))
+ return names
def visit_classdef(self, node, parents, ignore=None):
name = node.name
@@ -275,6 +299,9 @@ class ClassNameCheck(BaseASTCheck):
name = name.strip('_')
if not name[:1].isupper() or '_' in name:
yield self.err(node, 'N801', name=name)
+ superclasses = self.superclass_names(name, parents)
+ if "Exception" in superclasses and not name.endswith("Error"):
+ yield self.err(node, 'N818', name=name)
class FunctionNameCheck(BaseASTCheck):
@@ -321,10 +348,7 @@ class FunctionArgNamesCheck(BaseASTCheck):
def visit_functiondef(self, node, parents, ignore=None):
def arg_name(arg):
- try:
- return arg, arg.arg
- except AttributeError: # PY2
- return node, arg
+ return (arg, arg.arg) if arg else (node, arg)
for arg, name in arg_name(node.args.vararg), arg_name(node.args.kwarg):
if name is None or _ignored(name, ignore):
@@ -427,45 +451,34 @@ class VariablesCheck(BaseASTCheck):
if self.is_namedtupe(node.value):
return
for target in node.targets:
- for error in self._find_errors(target, parents, ignore):
- yield error
+ yield from self._find_errors(target, parents, ignore)
def visit_namedexpr(self, node, parents, ignore):
if self.is_namedtupe(node.value):
return
- for error in self._find_errors(node.target, parents, ignore):
- yield error
+ yield from self._find_errors(node.target, parents, ignore)
visit_annassign = visit_namedexpr
def visit_with(self, node, parents, ignore):
- if PY2:
- for error in self._find_errors(
- node.optional_vars, parents, ignore):
- yield error
- return
for item in node.items:
- for error in self._find_errors(
- item.optional_vars, parents, ignore):
- yield error
+ yield from self._find_errors(
+ item.optional_vars, parents, ignore)
visit_asyncwith = visit_with
def visit_for(self, node, parents, ignore):
- for error in self._find_errors(node.target, parents, ignore):
- yield error
+ yield from self._find_errors(node.target, parents, ignore)
visit_asyncfor = visit_for
def visit_excepthandler(self, node, parents, ignore):
if node.name:
- for error in self._find_errors(node, parents, ignore):
- yield error
+ yield from self._find_errors(node, parents, ignore)
def visit_generatorexp(self, node, parents, ignore):
for gen in node.generators:
- for error in self._find_errors(gen.target, parents, ignore):
- yield error
+ yield from self._find_errors(gen.target, parents, ignore)
visit_listcomp = visit_dictcomp = visit_setcomp = visit_generatorexp
@@ -499,25 +512,11 @@ def _extract_names(assignment_target):
if element_type is ast.Name:
yield element.id
elif element_type in (ast.Tuple, ast.List):
- for n in _extract_names(element):
- yield n
- elif not PY2 and element_type is ast.Starred: # PEP 3132
- for n in _extract_names(element.value):
- yield n
+ yield from _extract_names(element)
+ elif element_type is ast.Starred: # PEP 3132
+ yield from _extract_names(element.value)
elif target_type is ast.ExceptHandler:
- if PY2:
- # Python 2 supports unpacking tuple exception values.
- if isinstance(assignment_target.name, ast.Tuple):
- for name in assignment_target.name.elts:
- yield name.id
- elif isinstance(assignment_target.name, ast.Attribute):
- # Python 2 also supports assigning an exception to an attribute
- # eg. except Exception as obj.attr
- yield assignment_target.name.attr
- else:
- yield assignment_target.name.id
- else:
- yield assignment_target.name
+ yield assignment_target.name
def is_mixed_case(name):
diff --git a/testsuite/N801.py b/testsuite/N801.py
index 0653f6b..74046e5 100644
--- a/testsuite/N801.py
+++ b/testsuite/N801.py
@@ -1,19 +1,19 @@
#: N801
-class notok(object):
+class notok:
pass
#: Okay(--ignore-names=notok)
-class notok(object):
+class notok:
pass
#: Okay(--ignore-names=*ok)
-class notok(object):
+class notok:
pass
#: N801
-class Good(object):
- class notok(object):
+class Good:
+ class notok:
pass
pass
#: Okay
-class VeryGood(object):
+class VeryGood:
pass
#: N801:1:7
class _:
@@ -52,3 +52,21 @@ class MEH__:
#: Okay
class __MEH__:
pass
+#: Okay
+class Γ:
+ pass
+#: Okay
+class ΓγΓγ:
+ pass
+#: Okay
+class ΓγΓ6:
+ pass
+#: Okay
+class _Γ:
+ pass
+#: N801:1:7
+class γ:
+ pass
+#: N801
+class _γ:
+ pass
diff --git a/testsuite/N801_py3.py b/testsuite/N801_py3.py
deleted file mode 100644
index cba702e..0000000
--- a/testsuite/N801_py3.py
+++ /dev/null
@@ -1,19 +0,0 @@
-# python_version >= '3'
-#: Okay
-class Γ:
- pass
-#: Okay
-class ΓγΓγ:
- pass
-#: Okay
-class ΓγΓ6:
- pass
-#: Okay
-class _Γ:
- pass
-#: N801:1:7
-class γ:
- pass
-#: N801
-class _γ:
- pass
diff --git a/testsuite/N802.py b/testsuite/N802.py
index d6093ae..c36ef65 100644
--- a/testsuite/N802.py
+++ b/testsuite/N802.py
@@ -29,27 +29,27 @@ def NotOK():
def _():
pass
#: Okay
-class Foo(object):
+class Foo:
def __method(self):
pass
#: Okay
-class Foo(object):
+class Foo:
def __method__(self):
pass
#: Okay
-class ClassName(object):
+class ClassName:
def __method__(self):
pass
#: N802
-class ClassName(object):
+class ClassName:
def notOk(self):
pass
#: Okay(--ignore-names=notOk)
-class ClassName(object):
+class ClassName:
def notOk(self):
pass
#: Okay(--ignore-names=*Ok)
-class ClassName(object):
+class ClassName:
def notOk(self):
pass
#: Okay
@@ -60,6 +60,14 @@ def setUp():
def tearDown():
pass
+#: Okay
+def setUpModule():
+ pass
+
+#: Okay
+def tearDownModule():
+ pass
+
#: Okay
class TestCase:
def setUp(self):
@@ -70,5 +78,25 @@ class TestCase:
pass
def tearDownClass(self):
pass
+ def asyncSetUp(self):
+ pass
+ def asyncTearDown(self):
+ pass
def setUpTestData(self):
pass
+
+#: Okay
+def γ(x):
+ pass
+#: Okay
+def γ6(x):
+ pass
+
+#: Okay
+async def func(param1, param2):
+ do_stuff()
+ await some_coroutine()
+#: N802
+async def Func(param1, param2):
+ do_stuff()
+ await some_coroutine()
diff --git a/testsuite/N802_py3.py b/testsuite/N802_py3.py
deleted file mode 100644
index 7b5d0b0..0000000
--- a/testsuite/N802_py3.py
+++ /dev/null
@@ -1,7 +0,0 @@
-# python_version >= '3'
-#: Okay
-def γ(x):
- pass
-#: Okay
-def γ6(x):
- pass
diff --git a/testsuite/N802_py35.py b/testsuite/N802_py35.py
deleted file mode 100644
index 8a0a782..0000000
--- a/testsuite/N802_py35.py
+++ /dev/null
@@ -1,9 +0,0 @@
-# python_version >= '3.5'
-#: Okay
-async def func(param1, param2):
- do_stuff()
- await some_coroutine()
-#: N802
-async def Func(param1, param2):
- do_stuff()
- await some_coroutine()
diff --git a/testsuite/N803.py b/testsuite/N803.py
index 7f96d4b..1a7a771 100644
--- a/testsuite/N803.py
+++ b/testsuite/N803.py
@@ -59,7 +59,7 @@ def b18(a, *_):
def b19(a, **_):
pass
#: N803:2:24
-class Test(object):
+class Test:
def __init__(self, BAD):
pass
@@ -75,3 +75,41 @@ def f(*I):
#: Okay(--ignore-names=I)
def f(*I):
I[''].think_therefore_i_am
+
+#: Okay
+def compare(a, b, *, key=None):
+ pass
+#: N803
+def compare(a, b, *, BAD=None):
+ pass
+#: N803
+def compare(a, b, *VERY, bad=None):
+ pass
+#: N803
+def compare(a, b, *ok, fine=None, **BAD):
+ pass
+#: Okay
+def foo(α, ß, γ):
+ pass
+#: Okay
+def foo(α, ß=''):
+ pass
+#: Okay
+def foo(**κ):
+ pass
+#: Okay
+def foo(*α):
+ pass
+#: Okay
+def foo(**κ2):
+ pass
+#: Okay
+def foo(*α2):
+ pass
+
+#: Okay
+async def compare(a, b, *, key=None):
+ pass
+#: N803
+async def compare(a, b, *, BAD=None):
+ pass
diff --git a/testsuite/N803_py2.py b/testsuite/N803_py2.py
deleted file mode 100644
index fe9972e..0000000
--- a/testsuite/N803_py2.py
+++ /dev/null
@@ -1,7 +0,0 @@
-# python_version < '3'
-#: Okay
-def test(a, b, (good, verygood)):
- pass
-#: N803
-def bad(a, b, (OHH, NOO)):
- pass
diff --git a/testsuite/N803_py3.py b/testsuite/N803_py3.py
deleted file mode 100644
index cc8f325..0000000
--- a/testsuite/N803_py3.py
+++ /dev/null
@@ -1,31 +0,0 @@
-# python_version >= '3'
-#: Okay
-def compare(a, b, *, key=None):
- pass
-#: N803
-def compare(a, b, *, BAD=None):
- pass
-#: N803
-def compare(a, b, *VERY, bad=None):
- pass
-#: N803
-def compare(a, b, *ok, fine=None, **BAD):
- pass
-#: Okay
-def foo(α, ß, γ):
- pass
-#: Okay
-def foo(α, ß=''):
- pass
-#: Okay
-def foo(**κ):
- pass
-#: Okay
-def foo(*α):
- pass
-#: Okay
-def foo(**κ2):
- pass
-#: Okay
-def foo(*α2):
- pass
diff --git a/testsuite/N803_py35.py b/testsuite/N803_py35.py
deleted file mode 100644
index 8cf0651..0000000
--- a/testsuite/N803_py35.py
+++ /dev/null
@@ -1,7 +0,0 @@
-# python_version >= '3.5'
-#: Okay
-async def compare(a, b, *, key=None):
- pass
-#: N803
-async def compare(a, b, *, BAD=None):
- pass
diff --git a/testsuite/N804.py b/testsuite/N804.py
index 1d826ee..090c0e8 100644
--- a/testsuite/N804.py
+++ b/testsuite/N804.py
@@ -1,7 +1,7 @@
from abc import ABCMeta
#: N804:7:13
-class Foo(object):
+class Foo:
@classmethod
def mmm(cls, ads):
pass
@@ -17,17 +17,17 @@ class Foo(object):
def __init_subclass(self, ads):
pass
#: Okay(--ignore-names=klass)
-class SpecialConventionCase(object):
+class SpecialConventionCase:
@classmethod
def prepare_meta(klass, root):
pass
#: Okay(--ignore-names=_*)
-class SpecialConventionCase(object):
+class SpecialConventionCase:
@classmethod
def prepare_meta(_class, root):
pass
#: N804:3:14(--classmethod-decorators=clazzy,cool)
-class NewClassIsRequired(object):
+class NewClassIsRequired:
@cool
def test(self, sy):
pass
@@ -43,7 +43,44 @@ class MetaMethod(ABCMeta):
def test(cls):
pass
#: Okay
-class NotMeta(object):
+class NotMeta:
+ otherclass = Foo
+class AttributeParent(NotMeta.otherclass):
+ pass
+class CallParent(type('_tmp', (), {})):
+ pass
+
+#: N804:7:19
+class Foo:
+ @classmethod
+ async def mmm(cls, ads):
+ pass
+
+ @classmethod
+ async def bad(self, ads):
+ pass
+
+ @calling()
+ async def test(self, ads):
+ pass
+
+ async def __init_subclass(self, ads):
+ pass
+#: N804:3:20(--classmethod-decorators=clazzy,cool)
+class NewClassIsRequired:
+ @cool
+ async def test(self, sy):
+ pass
+#: N804
+class Meta(type):
+ async def __new__(self, name, bases, attrs):
+ pass
+#: Okay
+class MetaMethod(type):
+ async def test(cls):
+ pass
+#: Okay
+class NotMeta:
otherclass = Foo
class AttributeParent(NotMeta.otherclass):
pass
diff --git a/testsuite/N804_py35.py b/testsuite/N804_py35.py
deleted file mode 100644
index 8cd6e12..0000000
--- a/testsuite/N804_py35.py
+++ /dev/null
@@ -1,37 +0,0 @@
-# python_version >= '3.5'
-#: N804:7:19
-class Foo(object):
- @classmethod
- async def mmm(cls, ads):
- pass
-
- @classmethod
- async def bad(self, ads):
- pass
-
- @calling()
- async def test(self, ads):
- pass
-
- async def __init_subclass(self, ads):
- pass
-#: N804:3:20(--classmethod-decorators=clazzy,cool)
-class NewClassIsRequired(object):
- @cool
- async def test(self, sy):
- pass
-#: N804
-class Meta(type):
- async def __new__(self, name, bases, attrs):
- pass
-#: Okay
-class MetaMethod(type):
- async def test(cls):
- pass
-#: Okay
-class NotMeta(object):
- otherclass = Foo
-class AttributeParent(NotMeta.otherclass):
- pass
-class CallParent(type('_tmp', (), {})):
- pass
diff --git a/testsuite/N805.py b/testsuite/N805.py
index ae26797..1fabb4b 100644
--- a/testsuite/N805.py
+++ b/testsuite/N805.py
@@ -12,26 +12,26 @@ class C:
def m(cls, k='w'): # noqa: N805
pass
#: N805
-class Foo(object):
+class Foo:
def good(self, ads):
pass
def bad(ads, self):
pass
#: Okay(--ignore-names=a*)
-class Foo(object):
+class Foo:
def bad(ads, self):
pass
#: Okay(--ignore-names=source)
-class GraphQLNode(object):
+class GraphQLNode:
def resolve_foo(source, info):
pass
#: Okay
-class Foo(object):
+class Foo:
def __new__(cls):
return object.__new__(Foo)
#: Okay
-class Foo(object):
+class Foo:
@classmethod
def __prepare__(cls):
pass
@@ -48,10 +48,18 @@ class Foo(object):
pass
test2 = staticmethod(test2)
#: Okay
-class Foo(object):
+class Foo:
+ def __new__(cls):
+ pass
+#: Okay
+class Foo:
def __init_subclass__(cls):
pass
#: Okay
+class Foo:
+ def __class_getitem__(cls, key):
+ pass
+#: Okay
class Meta(type):
def __new__(cls, name, bases, attrs):
pass
@@ -70,7 +78,7 @@ class Meta(abc.ABCMeta):
def test(cls):
pass
#: Okay(--classmethod-decorators=clazzy,cool)
-class NewClassmethodDecorators(object):
+class NewClassmethodDecorators:
@clazzy
def test1(cls, sy):
pass
@@ -87,17 +95,45 @@ class NewClassmethodDecorators(object):
pass
test4 = cool(test4)
#: N805(--classmethod-decorators=clazzy,cool)
-class ButWeLostTheOriginalClassMethodDecorator(object):
+class ButWeLostTheOriginalClassMethodDecorator:
@classmethod
def test(cls, sy):
pass
#: N805(--classmethod-decorators=clazzy,cool)
-class ButWeLostTheOriginalClassMethodLateDecorator(object):
+class ButWeLostTheOriginalClassMethodLateDecorator:
def test(cls, sy):
pass
test = classmethod(test)
+#: Okay(--classmethod-decorators=myclassmethod)
+class C:
+ @myclassmethod('foo')
+ def bar(cls):
+ return 42
+#: Okay
+class PropertySetter:
+ @property
+ def var(self):
+ return True
+ @var.setter
+ def var(self, value):
+ self.var = value
+#: Okay
+class CalledInstanceDecorator:
+ @module.inner.decorator()
+ def test(self):
+ pass
+#: Okay(--classmethod-decorators=decorator)
+class CalledClassDecorator:
+ @module.inner.decorator()
+ def test(cls):
+ pass
+#: Okay(--staticmethod-decorators=decorator)
+class CalledStaticDecorator:
+ @module.inner.decorator()
+ def test():
+ pass
#: Okay(--staticmethod-decorators=ecstatik,stcmthd)
-class NewStaticMethodDecorators(object):
+class NewStaticMethodDecorators:
@ecstatik
def test1(so, exciting):
pass
@@ -114,12 +150,28 @@ class NewStaticMethodDecorators(object):
pass
test4 = stcmthd(test4)
#: N805(--staticmethod-decorators=exstatik,stcmthd)
-class ButWeLostTheOriginalStaticMethodDecorator(object):
+class ButWeLostTheOriginalStaticMethodDecorator:
@staticmethod
def test(so, exciting):
pass
#: N805(--staticmethod-decorators=exstatik,stcmthd)
-class ButWeLostTheOriginalStaticMethodLateDecorator(object):
+class ButWeLostTheOriginalStaticMethodLateDecorator:
def test(so, exciting):
pass
test = staticmethod(test)
+
+#: Okay
+class C:
+ async def __init__(*args, **kwargs):
+ pass
+#: N805:4:17
+class C:
+ @decorator(
+ 'a')
+ async def m(cls, k='w'): # noqa: N805
+ pass
+#: N805(--staticmethod-decorators=exstatik,stcmthd)
+class ButWeLostTheOriginalStaticMethodLateDecorator:
+ async def test(so, exciting):
+ pass
+ test = staticmethod(test)
diff --git a/testsuite/N805_py35.py b/testsuite/N805_py35.py
deleted file mode 100644
index 3f86f2f..0000000
--- a/testsuite/N805_py35.py
+++ /dev/null
@@ -1,16 +0,0 @@
-# python_version >= '3.5'
-#: Okay
-class C:
- async def __init__(*args, **kwargs):
- pass
-#: N805:4:17
-class C:
- @decorator(
- 'a')
- async def m(cls, k='w'): # noqa: N805
- pass
-#: N805(--staticmethod-decorators=exstatik,stcmthd)
-class ButWeLostTheOriginalStaticMethodLateDecorator(object):
- async def test(so, exciting):
- pass
- test = staticmethod(test)
diff --git a/testsuite/N806.py b/testsuite/N806.py
index 88bae3a..51969cb 100644
--- a/testsuite/N806.py
+++ b/testsuite/N806.py
@@ -8,7 +8,7 @@ def test():
#: Okay
GOOD = 1
#: Okay
-class Test(object):
+class Test:
GOOD = 1
#: N806
def test():
@@ -19,7 +19,7 @@ def test():
#: N806
def test():
def test2():
- class Foo(object):
+ class Foo:
def test3(self):
Bad = 3
#: Okay(--ignore-names=Bad)
@@ -175,3 +175,47 @@ def n():
#: N806:2:26
def e():
return tuple(BaD for BaD in range(2))
+
+#: Okay
+VAR1, *VAR2, VAR3 = 1, 2, 3
+#: Okay
+Α, *Β, Γ = 1, 2, 3
+#: Okay
+[VAR1, *VAR2, VAR3] = (1, 2, 3)
+#: N806
+def extended_unpacking_not_ok():
+ Var1, *Var2, Var3 = 1, 2, 3
+#: N806
+def extended_unpacking_not_ok():
+ [Var1, *Var2, Var3] = (1, 2, 3)
+#: Okay
+def assing_to_unpack_ok():
+ a, *[b] = 1, 2
+#: N806
+def assing_to_unpack_not_ok():
+ a, *[bB] = 1, 2
+#: Okay
+Γ = 1
+#: N806
+def f():
+ Δ = 1
+#: N806
+def f():
+ _Δ = 1
+#: Okay
+def f():
+ γ = 1
+#: Okay
+def f():
+ _γ = 1
+#: Okay
+def f():
+ h, _, γ = s.partition('sep')
+
+#: Okay
+async def test():
+ good = 1
+#: N806
+async def f():
+ async with expr as ASYNC_VAR:
+ pass
diff --git a/testsuite/N806_py2.py b/testsuite/N806_py2.py
deleted file mode 100644
index ac43204..0000000
--- a/testsuite/N806_py2.py
+++ /dev/null
@@ -1,31 +0,0 @@
-# python_version < '3'
-#: Okay
-def f():
- try:
- f()
- except (A, B) as (a, b):
- pass
-#: Okay
-def f():
- try:
- f()
- except X, foo:
- pass
-#: N806
-def f():
- try:
- f()
- except (A, B) as (good, BAD):
- pass
-#: Okay
-def f():
- try:
- f()
- except X, foo.bar:
- pass
-#: N806
-def f():
- try:
- f()
- except mod.Timeout, mod.ConnectionError:
- pass
diff --git a/testsuite/N806_py3.py b/testsuite/N806_py3.py
deleted file mode 100644
index 85c630e..0000000
--- a/testsuite/N806_py3.py
+++ /dev/null
@@ -1,36 +0,0 @@
-# python_version >= '3'
-#: Okay
-VAR1, *VAR2, VAR3 = 1, 2, 3
-#: Okay
-Α, *Β, Γ = 1, 2, 3
-#: Okay
-[VAR1, *VAR2, VAR3] = (1, 2, 3)
-#: N806
-def extended_unpacking_not_ok():
- Var1, *Var2, Var3 = 1, 2, 3
-#: N806
-def extended_unpacking_not_ok():
- [Var1, *Var2, Var3] = (1, 2, 3)
-#: Okay
-def assing_to_unpack_ok():
- a, *[b] = 1, 2
-#: N806
-def assing_to_unpack_not_ok():
- a, *[bB] = 1, 2
-#: Okay
-Γ = 1
-#: N806
-def f():
- Δ = 1
-#: N806
-def f():
- _Δ = 1
-#: Okay
-def f():
- γ = 1
-#: Okay
-def f():
- _γ = 1
-#: Okay
-def f():
- h, _, γ = s.partition('sep')
diff --git a/testsuite/N806_py35.py b/testsuite/N806_py35.py
deleted file mode 100644
index 2228853..0000000
--- a/testsuite/N806_py35.py
+++ /dev/null
@@ -1,8 +0,0 @@
-# python_version >= '3.5'
-#: Okay
-async def test():
- good = 1
-#: N806
-async def f():
- async with expr as ASYNC_VAR:
- pass
diff --git a/testsuite/N807.py b/testsuite/N807.py
index 8d75906..8d79196 100644
--- a/testsuite/N807.py
+++ b/testsuite/N807.py
@@ -37,12 +37,12 @@ def bad__():
def __bad__():
pass
#: Okay
-class ClassName(object):
+class ClassName:
def method(self):
def __bad():
pass
#: N807
-class ClassName(object):
+class ClassName:
def method(self):
def __bad__():
pass
@@ -58,3 +58,38 @@ def __dir__():
#: Okay
def __getattr__(name):
pass
+
+#: Okay
+class C:
+ def γ(self):
+ pass
+#: Okay
+def __β(self):
+ pass
+#: Okay
+def β__(self):
+ pass
+#: N807
+def __β__(self):
+ pass
+#: N807
+def __β6__(self):
+ pass
+#: Okay
+class C:
+ def γ1(self):
+ pass
+
+#: Okay
+class C:
+ async def γ(self):
+ pass
+#: Okay
+async def __β(self):
+ pass
+#: Okay
+async def β__(self):
+ pass
+#: N807
+async def __β__(self):
+ pass
diff --git a/testsuite/N807_py3.py b/testsuite/N807_py3.py
deleted file mode 100644
index 6a16b9e..0000000
--- a/testsuite/N807_py3.py
+++ /dev/null
@@ -1,21 +0,0 @@
-# python_version >= '3'
-#: Okay
-class C:
- def γ(self):
- pass
-#: Okay
-def __β(self):
- pass
-#: Okay
-def β__(self):
- pass
-#: N807
-def __β__(self):
- pass
-#: N807
-def __β6__(self):
- pass
-#: Okay
-class C:
- def γ1(self):
- pass
diff --git a/testsuite/N807_py35.py b/testsuite/N807_py35.py
deleted file mode 100644
index 570a107..0000000
--- a/testsuite/N807_py35.py
+++ /dev/null
@@ -1,14 +0,0 @@
-# python_version >= '3.5'
-#: Okay
-class C:
- async def γ(self):
- pass
-#: Okay
-async def __β(self):
- pass
-#: Okay
-async def β__(self):
- pass
-#: N807
-async def __β__(self):
- pass
diff --git a/testsuite/N816.py b/testsuite/N816.py
index ea62bdd..36f6523 100644
--- a/testsuite/N816.py
+++ b/testsuite/N816.py
@@ -22,3 +22,32 @@ C_6 = 0.
mixedCase = 0
#: Okay(--ignore-names=*Case)
mixedCase = 0
+#: Okay
+Γ = 1
+#: N816
+γΓ = 1
+#: Okay
+Γ1 = 1
+#: Okay
+Γ_ = 1
+#: Okay
+Γ_1 = 1
+#: Okay
+Γ1_ = 1
+#: N816
+γΓ1 = 1
+#: N816
+_γ1Γ = 1
+
+#: Okay
+async with expr as Γ:
+ pass
+#: N816
+async with expr as γΓ:
+ pass
+#: Okay
+async for Γ1 in iterator:
+ pass
+#: N816
+async for γΓ1 in iterator:
+ pass
diff --git a/testsuite/N816_py3.py b/testsuite/N816_py3.py
deleted file mode 100644
index b4f503b..0000000
--- a/testsuite/N816_py3.py
+++ /dev/null
@@ -1,17 +0,0 @@
-# python_version >= '3'
-#: Okay
-Γ = 1
-#: N816
-γΓ = 1
-#: Okay
-Γ1 = 1
-#: Okay
-Γ_ = 1
-#: Okay
-Γ_1 = 1
-#: Okay
-Γ1_ = 1
-#: N816
-γΓ1 = 1
-#: N816
-_γ1Γ = 1
diff --git a/testsuite/N816_py37.py b/testsuite/N816_py37.py
deleted file mode 100644
index 9584eda..0000000
--- a/testsuite/N816_py37.py
+++ /dev/null
@@ -1,13 +0,0 @@
-# python_version >= '3.7'
-#: Okay
-async with expr as Γ:
- pass
-#: N816
-async with expr as γΓ:
- pass
-#: Okay
-async for Γ1 in iterator:
- pass
-#: N816
-async for γΓ1 in iterator:
- pass
diff --git a/testsuite/N818.py b/testsuite/N818.py
new file mode 100644
index 0000000..755bf2d
--- /dev/null
+++ b/testsuite/N818.py
@@ -0,0 +1,34 @@
+#: Okay
+class ActionError(Exception):
+ pass
+#: N818
+class ActionClass(Exception):
+ pass
+#: Okay
+class ActionError(Exception):
+ pass
+class DeepActionError(ActionError):
+ pass
+#: N818
+class ActionError(Exception):
+ pass
+class DeepActionClass(ActionError):
+ pass
+#: Okay
+class MixinError(Exception):
+ pass
+class Mixin:
+ pass
+class MixinActionError(Mixin, MixinError):
+ pass
+#: N818
+class MixinError(Exception):
+ pass
+class Mixin:
+ pass
+class MixinActionClass(Mixin, MixinError):
+ pass
+#: Okay
+from decimal import Decimal
+class Decimal(Decimal):
+ pass
diff --git a/testsuite/N81x.py b/testsuite/N81x.py
index 2870ba1..108d857 100644
--- a/testsuite/N81x.py
+++ b/testsuite/N81x.py
@@ -18,3 +18,13 @@ from mod import CamelCase as noncamle
from mod import CamelCase as CONSTANT
#: N817:1:1
from mod import CamelCase as CC
+#: Okay
+import good as γ
+#: Okay
+from mod import good as γ
+#: Okay
+import GOOD as Γ
+#: Okay
+from mod import GOOD as Γ
+#: Okay
+from mod import GOOD as Γ1
diff --git a/testsuite/N81x_py3.py b/testsuite/N81x_py3.py
deleted file mode 100644
index a1fa52a..0000000
--- a/testsuite/N81x_py3.py
+++ /dev/null
@@ -1,11 +0,0 @@
-# python_version >= '3'
-#: Okay
-import good as γ
-#: Okay
-from mod import good as γ
-#: Okay
-import GOOD as Γ
-#: Okay
-from mod import GOOD as Γ
-#: Okay
-from mod import GOOD as Γ1
diff --git a/testsuite/N8xx_py36.py b/testsuite/N8xx.py
similarity index 75%
rename from testsuite/N8xx_py36.py
rename to testsuite/N8xx.py
index cc9008b..090042b 100644
--- a/testsuite/N8xx_py36.py
+++ b/testsuite/N8xx.py
@@ -1,10 +1,9 @@
-# python_version >= '3.6'
#: Okay
var1: int = 1
var2: int
def some():
variable: int = 1
-class Test(object):
+class Test:
variable: int = 1
#: N816:1:1
mixedCase: int = 1
@@ -12,5 +11,5 @@ mixedCase: int = 1
def some():
mixedCase: int = 1
#: N815:2:5
-class Test(object):
+class Test:
mixedCase: int = 1
diff --git a/tox.ini b/tox.ini
deleted file mode 100644
index 6817f35..0000000
--- a/tox.ini
+++ /dev/null
@@ -1,28 +0,0 @@
-[tox]
-envlist = py27,py35,py36,py37,py38,pypy,pypy3
-
-[testenv]
-commands = python run_tests.py
-
-[testenv:py27-flake8]
-deps =
- flake8
-commands =
- flake8 {posargs} pep8ext_naming.py
- python setup.py check --restructuredtext
-
-[testenv:py37-flake8]
-basepython = python3.7
-deps =
- flake8
-commands =
- flake8 {posargs} pep8ext_naming.py
- python setup.py check --restructuredtext
-
-[testenv:release]
-deps =
- twine >= 1.4.0
- wheel
-commands =
- python setup.py sdist bdist_wheel
- twine upload {posargs} dist/*
Debdiff
[The following lists of changes regard files as different if they have different names, permissions or owners.]
Files in second set of .debs but not in first
-rw-r--r-- root/root /usr/lib/python3/dist-packages/pep8_naming-0.13.3.egg-info/PKG-INFO -rw-r--r-- root/root /usr/lib/python3/dist-packages/pep8_naming-0.13.3.egg-info/dependency_links.txt -rw-r--r-- root/root /usr/lib/python3/dist-packages/pep8_naming-0.13.3.egg-info/entry_points.txt -rw-r--r-- root/root /usr/lib/python3/dist-packages/pep8_naming-0.13.3.egg-info/not-zip-safe -rw-r--r-- root/root /usr/lib/python3/dist-packages/pep8_naming-0.13.3.egg-info/requires.txt -rw-r--r-- root/root /usr/lib/python3/dist-packages/pep8_naming-0.13.3.egg-info/top_level.txt -rw-r--r-- root/root /usr/share/doc/python3-pep8-naming/README.rst.gz
Files in first set of .debs but not in second
-rw-r--r-- root/root /usr/lib/python3/dist-packages/pep8_naming-0.10.0.egg-info/PKG-INFO -rw-r--r-- root/root /usr/lib/python3/dist-packages/pep8_naming-0.10.0.egg-info/dependency_links.txt -rw-r--r-- root/root /usr/lib/python3/dist-packages/pep8_naming-0.10.0.egg-info/entry_points.txt -rw-r--r-- root/root /usr/lib/python3/dist-packages/pep8_naming-0.10.0.egg-info/not-zip-safe -rw-r--r-- root/root /usr/lib/python3/dist-packages/pep8_naming-0.10.0.egg-info/requires.txt -rw-r--r-- root/root /usr/lib/python3/dist-packages/pep8_naming-0.10.0.egg-info/top_level.txt -rw-r--r-- root/root /usr/share/doc/python3-pep8-naming/README.rst
Control files: lines which differ (wdiff format)
Depends: python3-flake8-polyfill, python3-flake8, python3:any
Recommends: python3-flake8