Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-flake8-import-order for openSUSE:Factory checked in at 2022-12-06 14:24:22 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-flake8-import-order (Old) and /work/SRC/openSUSE:Factory/.python-flake8-import-order.new.1835 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-flake8-import-order" Tue Dec 6 14:24:22 2022 rev:7 rq:1040555 version:0.18.2 Changes: -------- --- /work/SRC/openSUSE:Factory/python-flake8-import-order/python-flake8-import-order.changes 2020-04-21 13:11:04.568861212 +0200 +++ /work/SRC/openSUSE:Factory/.python-flake8-import-order.new.1835/python-flake8-import-order.changes 2022-12-06 14:24:40.662293016 +0100 @@ -1,0 +2,7 @@ +Tue Dec 6 03:28:14 UTC 2022 - Yogalakshmi Arunachalam <yarunacha...@suse.com> + +- Update to version 0.18.2 + * Add zoneinfo to list of standard library modules + * Fix registering of options with Flake8 >= 6.0 + +------------------------------------------------------------------- Old: ---- flake8-import-order-0.18.1.tar.gz New: ---- flake8-import-order-0.18.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-flake8-import-order.spec ++++++ --- /var/tmp/diff_new_pack.z5giJn/_old 2022-12-06 14:24:41.218297756 +0100 +++ /var/tmp/diff_new_pack.z5giJn/_new 2022-12-06 14:24:41.222297791 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-flake8-import-order # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -19,7 +19,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} %bcond_without python2 Name: python-flake8-import-order -Version: 0.18.1 +Version: 0.18.2 Release: 0 Summary: Flake8 plugin that checks the ordering of import statements License: LGPL-3.0-only ++++++ flake8-import-order-0.18.1.tar.gz -> flake8-import-order-0.18.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-import-order-0.18.1/CHANGELOG.rst new/flake8-import-order-0.18.2/CHANGELOG.rst --- old/flake8-import-order-0.18.1/CHANGELOG.rst 2019-03-04 09:37:58.000000000 +0100 +++ new/flake8-import-order-0.18.2/CHANGELOG.rst 2022-11-26 21:10:35.000000000 +0100 @@ -1,3 +1,9 @@ +0.18.2 2022-11-26 +----------------- + +* Add ``zoneinfo`` to list of standard library modules +* Fix registering of options with Flake8 >= 6.0 + 0.18.1 2019-03-04 ----------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-import-order-0.18.1/PKG-INFO new/flake8-import-order-0.18.2/PKG-INFO --- old/flake8-import-order-0.18.1/PKG-INFO 2019-03-04 09:38:23.000000000 +0100 +++ new/flake8-import-order-0.18.2/PKG-INFO 2022-11-26 21:13:29.756422000 +0100 @@ -1,6 +1,6 @@ -Metadata-Version: 1.2 +Metadata-Version: 2.1 Name: flake8-import-order -Version: 0.18.1 +Version: 0.18.2 Summary: Flake8 and pylama plugin that checks the ordering of import statements. Home-page: https://github.com/PyCQA/flake8-import-order Author: Alex Stapleton @@ -8,186 +8,6 @@ Maintainer: Phil Jones Maintainer-email: philip.graham.jones+flake8-imp...@gmail.com License: LGPLv3 -Description: flake8-import-order - =================== - - |Build Status| - - A `flake8 <http://flake8.readthedocs.org/en/latest/>`__ and `Pylama - <https://github.com/klen/pylama>`__ plugin that checks the ordering of - your imports. It does not check anything else about the - imports. Merely that they are grouped and ordered correctly. - - In general stdlib comes first, then 3rd party, then local packages, - and that each group is individually alphabetized, however this depends - on the style used. Flake8-Import-Order supports a number of `styles - <#styles>`_ and is extensible allowing for `custom styles - <#extending-styles>`_. - - This plugin was originally developed to match the style preferences of - the `cryptography <https://github.com/pyca/cryptography>`__ project, - with this style remaining the default. - - Warnings - -------- - - This package adds 4 new flake8 warnings - - - ``I100``: Your import statements are in the wrong order. - - ``I101``: The names in your from import are in the wrong order. - - ``I201``: Missing newline between import groups. - - ``I202``: Additional newline in a group of imports. - - Styles - ------ - - The following styles are directly supported, - - * ``cryptography`` - see an `example <https://github.com/PyCQA/flake8-import-order/blob/master/tests/test_cases/complete_cryptography.py>`__ - * ``google`` - style described in `Google Style Guidelines <https://google.github.io/styleguide/pyguide.html?showone=Imports_formatting#Imports_formatting>`__, see an `example <https://github.com/PyCQA/flake8-import-order/blob/master/tests/test_cases/complete_google.py>`__ - * ``smarkets`` - style as ``google`` only with `import` statements before `from X import ...` statements, see an `example <https://github.com/PyCQA/flake8-import-order/blob/master/tests/test_cases/complete_smarkets.py>`__ - * ``appnexus`` - style as ``google`` only with `import` statements for packages local to your company or organisation coming after `import` statements for third-party packages, see an `example <https://github.com/PyCQA/flake8-import-order/blob/master/tests/test_cases/complete_appnexus.py>`__ - * ``edited`` - see an `example <https://github.com/PyCQA/flake8-import-order/blob/master/tests/test_cases/complete_edited.py>`__ - * ``pycharm`` - style as ``smarkets`` only with case sensitive sorting imported names - * ``pep8`` - style that only enforces groups without enforcing the order within the groups - - You can also `add your own style <#extending-styles>`_ by extending ``Style`` - class. - - Configuration - ------------- - - You will want to set the ``application-import-names`` option to a - comma separated list of names that should be considered local to your - application. These will be used to help categorise your import - statements into the correct groups. Note that relative imports are - always considered local. - - You will want to set the ``application-package-names`` option to a - comma separated list of names that should be considered local to your - company or organisation, but which are obtained using some sort of - package manager like Pip, Apt, or Yum. Typically, code representing - the values listed in this option is located in a different repository - than the code being developed. This option is only accepted in the - supported ``appnexus`` or ``edited`` styles or in any style that - accepts application package names. - - The ``application-import-names`` and ``application-package-names`` can - contain namespaced packages or even exact nested module names. (This - is possible with 0.16 onwards). - - ``import-order-style`` controls what style the plugin follows - (``cryptography`` is the default). - - Limitations - ----------- - - Currently these checks are limited to module scope imports only. - Conditional imports in module scope will also be ignored. - - Classification of an imported module is achieved by checking the - module against a stdlib list and then if there is no match against the - ``application-import-names`` list and ``application-package-names`` if - the style accepts application-package names. Only if none of these - lists contain the imported module will it be classified as third - party. - - These checks only consider an import against its previous import, - rather than considering all the imports together. This means that - ``I100`` errors are only raised for the latter of adjacent imports out - of order. For example, - - .. code-block:: python - - import X.B - import X # I100 - import X.A - - only ``import X`` raises an ``I100`` error, yet ``import X.A`` is also - out of order compared with the ``import X.B``. - - Imported modules are classified as stdlib if the module is in a - vendored list of stdlib modules. This list is based on the latest - release of Python and hence the results can be misleading. This list - is also the same for all Python versions because otherwise it would - be impossible to write programs that work under both Python 2 and 3 - *and* pass the import order check. - - The ``I202`` check will consider any blank line between imports to - count, even if the line is not contextually related to the - imports. For example, - - .. code-block:: python - - import logging - try: - from logging import NullHandler - except ImportError: - class NullHandler(logging.Handler): - """Shim for version of Python < 2.7.""" - - def emit(self, record): - pass - import sys # I202 due to the blank line before the 'def emit' - - will trigger a ``I202`` error despite the blank line not being - contextually related. - - Extending styles - ---------------- - - You can add your own style by extending ``flake8_import_order.styles.Style`` - class. Here's an example: - - .. code-block:: python - - from flake8_import_order.styles import Cryptography - - - class ReversedCryptography(Cryptography): - # Note that Cryptography is a subclass of Style. - - @staticmethod - def sorted_names(names): - return reversed(Cryptography.sorted_names(names)) - - By default there are five import groupings or sections; future, - stdlib, third party, application, and relative imports. A style can - choose to accept another grouping, application-package, by setting the - ``Style`` class variable ``accepts_application_package_names`` to - True, e.g. - - .. code-block:: python - - class PackageNameCryptography(Cryptography): - accepts_application_package_names = True - - To make flake8-import-order able to discover your extended style, you need to - register it as ``flake8_import_order.styles`` using setuptools' `entry points - <https://setuptools.readthedocs.io/en/latest/pkg_resources.html#entry-points>`__ - mechanism: - - .. code-block:: python - - # setup.py of your style package - setup( - name='flake8-import-order-reversed-cryptography', - ..., - entry_points={ - 'flake8_import_order.styles': [ - 'reversed = reversedcryptography:ReversedCryptography', - # 'reversed' is a style name. You can pass it to - # --import-order-style option - # 'reversedcryptography:ReversedCryptography' is an import path - # of your extended style class. - ] - } - ) - - .. |Build Status| image:: https://travis-ci.org/PyCQA/flake8-import-order.svg?branch=master - :target: https://travis-ci.org/PyCQA/flake8-import-order - -Platform: UNKNOWN Classifier: Framework :: Flake8 Classifier: Intended Audience :: Developers Classifier: Development Status :: 4 - Beta @@ -199,3 +19,183 @@ Classifier: Topic :: Software Development :: Libraries :: Python Modules Classifier: Topic :: Software Development :: Quality Assurance Classifier: Operating System :: OS Independent +License-File: COPYING + +flake8-import-order +=================== + +|Build Status| + +A `flake8 <http://flake8.readthedocs.org/en/latest/>`__ and `Pylama +<https://github.com/klen/pylama>`__ plugin that checks the ordering of +your imports. It does not check anything else about the +imports. Merely that they are grouped and ordered correctly. + +In general stdlib comes first, then 3rd party, then local packages, +and that each group is individually alphabetized, however this depends +on the style used. Flake8-Import-Order supports a number of `styles +<#styles>`_ and is extensible allowing for `custom styles +<#extending-styles>`_. + +This plugin was originally developed to match the style preferences of +the `cryptography <https://github.com/pyca/cryptography>`__ project, +with this style remaining the default. + +Warnings +-------- + +This package adds 4 new flake8 warnings + +- ``I100``: Your import statements are in the wrong order. +- ``I101``: The names in your from import are in the wrong order. +- ``I201``: Missing newline between import groups. +- ``I202``: Additional newline in a group of imports. + +Styles +------ + +The following styles are directly supported, + +* ``cryptography`` - see an `example <https://github.com/PyCQA/flake8-import-order/blob/master/tests/test_cases/complete_cryptography.py>`__ +* ``google`` - style described in `Google Style Guidelines <https://google.github.io/styleguide/pyguide.html?showone=Imports_formatting#Imports_formatting>`__, see an `example <https://github.com/PyCQA/flake8-import-order/blob/master/tests/test_cases/complete_google.py>`__ +* ``smarkets`` - style as ``google`` only with `import` statements before `from X import ...` statements, see an `example <https://github.com/PyCQA/flake8-import-order/blob/master/tests/test_cases/complete_smarkets.py>`__ +* ``appnexus`` - style as ``google`` only with `import` statements for packages local to your company or organisation coming after `import` statements for third-party packages, see an `example <https://github.com/PyCQA/flake8-import-order/blob/master/tests/test_cases/complete_appnexus.py>`__ +* ``edited`` - see an `example <https://github.com/PyCQA/flake8-import-order/blob/master/tests/test_cases/complete_edited.py>`__ +* ``pycharm`` - style as ``smarkets`` only with case sensitive sorting imported names +* ``pep8`` - style that only enforces groups without enforcing the order within the groups + +You can also `add your own style <#extending-styles>`_ by extending ``Style`` +class. + +Configuration +------------- + +You will want to set the ``application-import-names`` option to a +comma separated list of names that should be considered local to your +application. These will be used to help categorise your import +statements into the correct groups. Note that relative imports are +always considered local. + +You will want to set the ``application-package-names`` option to a +comma separated list of names that should be considered local to your +company or organisation, but which are obtained using some sort of +package manager like Pip, Apt, or Yum. Typically, code representing +the values listed in this option is located in a different repository +than the code being developed. This option is only accepted in the +supported ``appnexus`` or ``edited`` styles or in any style that +accepts application package names. + +The ``application-import-names`` and ``application-package-names`` can +contain namespaced packages or even exact nested module names. (This +is possible with 0.16 onwards). + +``import-order-style`` controls what style the plugin follows +(``cryptography`` is the default). + +Limitations +----------- + +Currently these checks are limited to module scope imports only. +Conditional imports in module scope will also be ignored. + +Classification of an imported module is achieved by checking the +module against a stdlib list and then if there is no match against the +``application-import-names`` list and ``application-package-names`` if +the style accepts application-package names. Only if none of these +lists contain the imported module will it be classified as third +party. + +These checks only consider an import against its previous import, +rather than considering all the imports together. This means that +``I100`` errors are only raised for the latter of adjacent imports out +of order. For example, + +.. code-block:: python + + import X.B + import X # I100 + import X.A + +only ``import X`` raises an ``I100`` error, yet ``import X.A`` is also +out of order compared with the ``import X.B``. + +Imported modules are classified as stdlib if the module is in a +vendored list of stdlib modules. This list is based on the latest +release of Python and hence the results can be misleading. This list +is also the same for all Python versions because otherwise it would +be impossible to write programs that work under both Python 2 and 3 +*and* pass the import order check. + +The ``I202`` check will consider any blank line between imports to +count, even if the line is not contextually related to the +imports. For example, + +.. code-block:: python + + import logging + try: + from logging import NullHandler + except ImportError: + class NullHandler(logging.Handler): + """Shim for version of Python < 2.7.""" + + def emit(self, record): + pass + import sys # I202 due to the blank line before the 'def emit' + +will trigger a ``I202`` error despite the blank line not being +contextually related. + +Extending styles +---------------- + +You can add your own style by extending ``flake8_import_order.styles.Style`` +class. Here's an example: + +.. code-block:: python + + from flake8_import_order.styles import Cryptography + + + class ReversedCryptography(Cryptography): + # Note that Cryptography is a subclass of Style. + + @staticmethod + def sorted_names(names): + return reversed(Cryptography.sorted_names(names)) + +By default there are five import groupings or sections; future, +stdlib, third party, application, and relative imports. A style can +choose to accept another grouping, application-package, by setting the +``Style`` class variable ``accepts_application_package_names`` to +True, e.g. + +.. code-block:: python + + class PackageNameCryptography(Cryptography): + accepts_application_package_names = True + +To make flake8-import-order able to discover your extended style, you need to +register it as ``flake8_import_order.styles`` using setuptools' `entry points +<https://setuptools.readthedocs.io/en/latest/pkg_resources.html#entry-points>`__ +mechanism: + +.. code-block:: python + + # setup.py of your style package + setup( + name='flake8-import-order-reversed-cryptography', + ..., + entry_points={ + 'flake8_import_order.styles': [ + 'reversed = reversedcryptography:ReversedCryptography', + # 'reversed' is a style name. You can pass it to + # --import-order-style option + # 'reversedcryptography:ReversedCryptography' is an import path + # of your extended style class. + ] + } + ) + +.. |Build Status| image:: https://travis-ci.org/PyCQA/flake8-import-order.svg?branch=master + :target: https://travis-ci.org/PyCQA/flake8-import-order diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-import-order-0.18.1/flake8_import_order/__about__.py new/flake8-import-order-0.18.2/flake8_import_order/__about__.py --- old/flake8-import-order-0.18.1/flake8_import_order/__about__.py 2019-03-04 09:37:58.000000000 +0100 +++ new/flake8-import-order-0.18.2/flake8_import_order/__about__.py 2022-11-26 21:09:43.000000000 +0100 @@ -12,7 +12,7 @@ ) __uri__ = "https://github.com/PyCQA/flake8-import-order" -__version__ = "0.18.1" +__version__ = "0.18.2" __author__ = "Alex Stapleton" __email__ = "al...@prol.etari.at" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-import-order-0.18.1/flake8_import_order/flake8_linter.py new/flake8-import-order-0.18.2/flake8_import_order/flake8_linter.py --- old/flake8-import-order-0.18.1/flake8_import_order/flake8_linter.py 2017-10-30 20:55:04.000000000 +0100 +++ new/flake8-import-order-0.18.2/flake8_import_order/flake8_linter.py 2022-11-26 21:08:40.000000000 +0100 @@ -25,7 +25,7 @@ "--application-import-names", default="", action="store", - type="string", + type=str, help="Import names to consider as application-specific", parse_from_config=True, comma_separated_list=True, @@ -35,7 +35,7 @@ "--application-package-names", default="", action="store", - type="string", + type=str, help=("Package names to consider as company-specific " "(used only by 'appnexus' style)"), parse_from_config=True, @@ -46,7 +46,7 @@ "--import-order-style", default=DEFAULT_IMPORT_ORDER_STYLE, action="store", - type="string", + type=str, help=("Style to follow. Available: " + ", ".join(cls.list_available_styles())), parse_from_config=True, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-import-order-0.18.1/flake8_import_order/stdlib_list.py new/flake8-import-order-0.18.2/flake8_import_order/stdlib_list.py --- old/flake8-import-order-0.18.1/flake8_import_order/stdlib_list.py 2018-07-08 19:17:54.000000000 +0200 +++ new/flake8-import-order-0.18.2/flake8_import_order/stdlib_list.py 2022-11-26 21:08:40.000000000 +0100 @@ -41,6 +41,7 @@ "_dummy_thread", "_thread", "_threading_local", + "_winapi", "abc", "aepack", "aetools", @@ -315,4 +316,5 @@ "zipfile", "zipimport", "zlib", + "zoneinfo", } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-import-order-0.18.1/flake8_import_order.egg-info/PKG-INFO new/flake8-import-order-0.18.2/flake8_import_order.egg-info/PKG-INFO --- old/flake8-import-order-0.18.1/flake8_import_order.egg-info/PKG-INFO 2019-03-04 09:38:23.000000000 +0100 +++ new/flake8-import-order-0.18.2/flake8_import_order.egg-info/PKG-INFO 2022-11-26 21:13:29.000000000 +0100 @@ -1,6 +1,6 @@ -Metadata-Version: 1.2 +Metadata-Version: 2.1 Name: flake8-import-order -Version: 0.18.1 +Version: 0.18.2 Summary: Flake8 and pylama plugin that checks the ordering of import statements. Home-page: https://github.com/PyCQA/flake8-import-order Author: Alex Stapleton @@ -8,186 +8,6 @@ Maintainer: Phil Jones Maintainer-email: philip.graham.jones+flake8-imp...@gmail.com License: LGPLv3 -Description: flake8-import-order - =================== - - |Build Status| - - A `flake8 <http://flake8.readthedocs.org/en/latest/>`__ and `Pylama - <https://github.com/klen/pylama>`__ plugin that checks the ordering of - your imports. It does not check anything else about the - imports. Merely that they are grouped and ordered correctly. - - In general stdlib comes first, then 3rd party, then local packages, - and that each group is individually alphabetized, however this depends - on the style used. Flake8-Import-Order supports a number of `styles - <#styles>`_ and is extensible allowing for `custom styles - <#extending-styles>`_. - - This plugin was originally developed to match the style preferences of - the `cryptography <https://github.com/pyca/cryptography>`__ project, - with this style remaining the default. - - Warnings - -------- - - This package adds 4 new flake8 warnings - - - ``I100``: Your import statements are in the wrong order. - - ``I101``: The names in your from import are in the wrong order. - - ``I201``: Missing newline between import groups. - - ``I202``: Additional newline in a group of imports. - - Styles - ------ - - The following styles are directly supported, - - * ``cryptography`` - see an `example <https://github.com/PyCQA/flake8-import-order/blob/master/tests/test_cases/complete_cryptography.py>`__ - * ``google`` - style described in `Google Style Guidelines <https://google.github.io/styleguide/pyguide.html?showone=Imports_formatting#Imports_formatting>`__, see an `example <https://github.com/PyCQA/flake8-import-order/blob/master/tests/test_cases/complete_google.py>`__ - * ``smarkets`` - style as ``google`` only with `import` statements before `from X import ...` statements, see an `example <https://github.com/PyCQA/flake8-import-order/blob/master/tests/test_cases/complete_smarkets.py>`__ - * ``appnexus`` - style as ``google`` only with `import` statements for packages local to your company or organisation coming after `import` statements for third-party packages, see an `example <https://github.com/PyCQA/flake8-import-order/blob/master/tests/test_cases/complete_appnexus.py>`__ - * ``edited`` - see an `example <https://github.com/PyCQA/flake8-import-order/blob/master/tests/test_cases/complete_edited.py>`__ - * ``pycharm`` - style as ``smarkets`` only with case sensitive sorting imported names - * ``pep8`` - style that only enforces groups without enforcing the order within the groups - - You can also `add your own style <#extending-styles>`_ by extending ``Style`` - class. - - Configuration - ------------- - - You will want to set the ``application-import-names`` option to a - comma separated list of names that should be considered local to your - application. These will be used to help categorise your import - statements into the correct groups. Note that relative imports are - always considered local. - - You will want to set the ``application-package-names`` option to a - comma separated list of names that should be considered local to your - company or organisation, but which are obtained using some sort of - package manager like Pip, Apt, or Yum. Typically, code representing - the values listed in this option is located in a different repository - than the code being developed. This option is only accepted in the - supported ``appnexus`` or ``edited`` styles or in any style that - accepts application package names. - - The ``application-import-names`` and ``application-package-names`` can - contain namespaced packages or even exact nested module names. (This - is possible with 0.16 onwards). - - ``import-order-style`` controls what style the plugin follows - (``cryptography`` is the default). - - Limitations - ----------- - - Currently these checks are limited to module scope imports only. - Conditional imports in module scope will also be ignored. - - Classification of an imported module is achieved by checking the - module against a stdlib list and then if there is no match against the - ``application-import-names`` list and ``application-package-names`` if - the style accepts application-package names. Only if none of these - lists contain the imported module will it be classified as third - party. - - These checks only consider an import against its previous import, - rather than considering all the imports together. This means that - ``I100`` errors are only raised for the latter of adjacent imports out - of order. For example, - - .. code-block:: python - - import X.B - import X # I100 - import X.A - - only ``import X`` raises an ``I100`` error, yet ``import X.A`` is also - out of order compared with the ``import X.B``. - - Imported modules are classified as stdlib if the module is in a - vendored list of stdlib modules. This list is based on the latest - release of Python and hence the results can be misleading. This list - is also the same for all Python versions because otherwise it would - be impossible to write programs that work under both Python 2 and 3 - *and* pass the import order check. - - The ``I202`` check will consider any blank line between imports to - count, even if the line is not contextually related to the - imports. For example, - - .. code-block:: python - - import logging - try: - from logging import NullHandler - except ImportError: - class NullHandler(logging.Handler): - """Shim for version of Python < 2.7.""" - - def emit(self, record): - pass - import sys # I202 due to the blank line before the 'def emit' - - will trigger a ``I202`` error despite the blank line not being - contextually related. - - Extending styles - ---------------- - - You can add your own style by extending ``flake8_import_order.styles.Style`` - class. Here's an example: - - .. code-block:: python - - from flake8_import_order.styles import Cryptography - - - class ReversedCryptography(Cryptography): - # Note that Cryptography is a subclass of Style. - - @staticmethod - def sorted_names(names): - return reversed(Cryptography.sorted_names(names)) - - By default there are five import groupings or sections; future, - stdlib, third party, application, and relative imports. A style can - choose to accept another grouping, application-package, by setting the - ``Style`` class variable ``accepts_application_package_names`` to - True, e.g. - - .. code-block:: python - - class PackageNameCryptography(Cryptography): - accepts_application_package_names = True - - To make flake8-import-order able to discover your extended style, you need to - register it as ``flake8_import_order.styles`` using setuptools' `entry points - <https://setuptools.readthedocs.io/en/latest/pkg_resources.html#entry-points>`__ - mechanism: - - .. code-block:: python - - # setup.py of your style package - setup( - name='flake8-import-order-reversed-cryptography', - ..., - entry_points={ - 'flake8_import_order.styles': [ - 'reversed = reversedcryptography:ReversedCryptography', - # 'reversed' is a style name. You can pass it to - # --import-order-style option - # 'reversedcryptography:ReversedCryptography' is an import path - # of your extended style class. - ] - } - ) - - .. |Build Status| image:: https://travis-ci.org/PyCQA/flake8-import-order.svg?branch=master - :target: https://travis-ci.org/PyCQA/flake8-import-order - -Platform: UNKNOWN Classifier: Framework :: Flake8 Classifier: Intended Audience :: Developers Classifier: Development Status :: 4 - Beta @@ -199,3 +19,183 @@ Classifier: Topic :: Software Development :: Libraries :: Python Modules Classifier: Topic :: Software Development :: Quality Assurance Classifier: Operating System :: OS Independent +License-File: COPYING + +flake8-import-order +=================== + +|Build Status| + +A `flake8 <http://flake8.readthedocs.org/en/latest/>`__ and `Pylama +<https://github.com/klen/pylama>`__ plugin that checks the ordering of +your imports. It does not check anything else about the +imports. Merely that they are grouped and ordered correctly. + +In general stdlib comes first, then 3rd party, then local packages, +and that each group is individually alphabetized, however this depends +on the style used. Flake8-Import-Order supports a number of `styles +<#styles>`_ and is extensible allowing for `custom styles +<#extending-styles>`_. + +This plugin was originally developed to match the style preferences of +the `cryptography <https://github.com/pyca/cryptography>`__ project, +with this style remaining the default. + +Warnings +-------- + +This package adds 4 new flake8 warnings + +- ``I100``: Your import statements are in the wrong order. +- ``I101``: The names in your from import are in the wrong order. +- ``I201``: Missing newline between import groups. +- ``I202``: Additional newline in a group of imports. + +Styles +------ + +The following styles are directly supported, + +* ``cryptography`` - see an `example <https://github.com/PyCQA/flake8-import-order/blob/master/tests/test_cases/complete_cryptography.py>`__ +* ``google`` - style described in `Google Style Guidelines <https://google.github.io/styleguide/pyguide.html?showone=Imports_formatting#Imports_formatting>`__, see an `example <https://github.com/PyCQA/flake8-import-order/blob/master/tests/test_cases/complete_google.py>`__ +* ``smarkets`` - style as ``google`` only with `import` statements before `from X import ...` statements, see an `example <https://github.com/PyCQA/flake8-import-order/blob/master/tests/test_cases/complete_smarkets.py>`__ +* ``appnexus`` - style as ``google`` only with `import` statements for packages local to your company or organisation coming after `import` statements for third-party packages, see an `example <https://github.com/PyCQA/flake8-import-order/blob/master/tests/test_cases/complete_appnexus.py>`__ +* ``edited`` - see an `example <https://github.com/PyCQA/flake8-import-order/blob/master/tests/test_cases/complete_edited.py>`__ +* ``pycharm`` - style as ``smarkets`` only with case sensitive sorting imported names +* ``pep8`` - style that only enforces groups without enforcing the order within the groups + +You can also `add your own style <#extending-styles>`_ by extending ``Style`` +class. + +Configuration +------------- + +You will want to set the ``application-import-names`` option to a +comma separated list of names that should be considered local to your +application. These will be used to help categorise your import +statements into the correct groups. Note that relative imports are +always considered local. + +You will want to set the ``application-package-names`` option to a +comma separated list of names that should be considered local to your +company or organisation, but which are obtained using some sort of +package manager like Pip, Apt, or Yum. Typically, code representing +the values listed in this option is located in a different repository +than the code being developed. This option is only accepted in the +supported ``appnexus`` or ``edited`` styles or in any style that +accepts application package names. + +The ``application-import-names`` and ``application-package-names`` can +contain namespaced packages or even exact nested module names. (This +is possible with 0.16 onwards). + +``import-order-style`` controls what style the plugin follows +(``cryptography`` is the default). + +Limitations +----------- + +Currently these checks are limited to module scope imports only. +Conditional imports in module scope will also be ignored. + +Classification of an imported module is achieved by checking the +module against a stdlib list and then if there is no match against the +``application-import-names`` list and ``application-package-names`` if +the style accepts application-package names. Only if none of these +lists contain the imported module will it be classified as third +party. + +These checks only consider an import against its previous import, +rather than considering all the imports together. This means that +``I100`` errors are only raised for the latter of adjacent imports out +of order. For example, + +.. code-block:: python + + import X.B + import X # I100 + import X.A + +only ``import X`` raises an ``I100`` error, yet ``import X.A`` is also +out of order compared with the ``import X.B``. + +Imported modules are classified as stdlib if the module is in a +vendored list of stdlib modules. This list is based on the latest +release of Python and hence the results can be misleading. This list +is also the same for all Python versions because otherwise it would +be impossible to write programs that work under both Python 2 and 3 +*and* pass the import order check. + +The ``I202`` check will consider any blank line between imports to +count, even if the line is not contextually related to the +imports. For example, + +.. code-block:: python + + import logging + try: + from logging import NullHandler + except ImportError: + class NullHandler(logging.Handler): + """Shim for version of Python < 2.7.""" + + def emit(self, record): + pass + import sys # I202 due to the blank line before the 'def emit' + +will trigger a ``I202`` error despite the blank line not being +contextually related. + +Extending styles +---------------- + +You can add your own style by extending ``flake8_import_order.styles.Style`` +class. Here's an example: + +.. code-block:: python + + from flake8_import_order.styles import Cryptography + + + class ReversedCryptography(Cryptography): + # Note that Cryptography is a subclass of Style. + + @staticmethod + def sorted_names(names): + return reversed(Cryptography.sorted_names(names)) + +By default there are five import groupings or sections; future, +stdlib, third party, application, and relative imports. A style can +choose to accept another grouping, application-package, by setting the +``Style`` class variable ``accepts_application_package_names`` to +True, e.g. + +.. code-block:: python + + class PackageNameCryptography(Cryptography): + accepts_application_package_names = True + +To make flake8-import-order able to discover your extended style, you need to +register it as ``flake8_import_order.styles`` using setuptools' `entry points +<https://setuptools.readthedocs.io/en/latest/pkg_resources.html#entry-points>`__ +mechanism: + +.. code-block:: python + + # setup.py of your style package + setup( + name='flake8-import-order-reversed-cryptography', + ..., + entry_points={ + 'flake8_import_order.styles': [ + 'reversed = reversedcryptography:ReversedCryptography', + # 'reversed' is a style name. You can pass it to + # --import-order-style option + # 'reversedcryptography:ReversedCryptography' is an import path + # of your extended style class. + ] + } + ) + +.. |Build Status| image:: https://travis-ci.org/PyCQA/flake8-import-order.svg?branch=master + :target: https://travis-ci.org/PyCQA/flake8-import-order diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-import-order-0.18.1/flake8_import_order.egg-info/entry_points.txt new/flake8-import-order-0.18.2/flake8_import_order.egg-info/entry_points.txt --- old/flake8-import-order-0.18.1/flake8_import_order.egg-info/entry_points.txt 2019-03-04 09:38:23.000000000 +0100 +++ new/flake8-import-order-0.18.2/flake8_import_order.egg-info/entry_points.txt 2022-11-26 21:13:29.000000000 +0100 @@ -12,4 +12,3 @@ [pylama.linter] import_order = flake8_import_order.pylama_linter:Linter - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-import-order-0.18.1/tests/test_stdlib.py new/flake8-import-order-0.18.2/tests/test_stdlib.py --- old/flake8-import-order-0.18.1/tests/test_stdlib.py 2017-10-30 20:55:04.000000000 +0100 +++ new/flake8-import-order-0.18.2/tests/test_stdlib.py 2022-11-26 21:08:40.000000000 +0100 @@ -26,7 +26,7 @@ @pytest.mark.parametrize('import_name', _load_test_cases()) def test_styles(import_name): - data = "import {}\nimport zlib\n".format(import_name) + data = "import {}\nimport zoneinfo\n".format(import_name) checker = _checker(data) codes = [error.code for error in checker.check_order()] assert codes == []