Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-flake8-comprehensions for openSUSE:Factory checked in at 2023-03-21 17:44:46 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-flake8-comprehensions (Old) and /work/SRC/openSUSE:Factory/.python-flake8-comprehensions.new.31432 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-flake8-comprehensions" Tue Mar 21 17:44:46 2023 rev:9 rq:1073581 version:3.11.1 Changes: -------- --- /work/SRC/openSUSE:Factory/python-flake8-comprehensions/python-flake8-comprehensions.changes 2023-03-14 18:17:10.763903296 +0100 +++ /work/SRC/openSUSE:Factory/.python-flake8-comprehensions.new.31432/python-flake8-comprehensions.changes 2023-03-21 17:44:58.250817688 +0100 @@ -1,0 +2,7 @@ +Tue Mar 21 15:37:43 UTC 2023 - Dirk Müller <dmuel...@suse.com> + +- update to 3.11.1: + * Fix false positives in C406 âunnecessary dict literalâ. + * Expand C416 to ``dict`` comprehensions. + +------------------------------------------------------------------- Old: ---- 3.10.1.tar.gz New: ---- 3.11.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-flake8-comprehensions.spec ++++++ --- /var/tmp/diff_new_pack.3tw9jh/_old 2023-03-21 17:44:58.782820201 +0100 +++ /var/tmp/diff_new_pack.3tw9jh/_new 2023-03-21 17:44:58.790820239 +0100 @@ -18,7 +18,7 @@ %define skip_python2 1 Name: python-flake8-comprehensions -Version: 3.10.1 +Version: 3.11.1 Release: 0 Summary: A flake8 plugin to help you write better list/set/dict comprehensions License: ISC ++++++ 3.10.1.tar.gz -> 3.11.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-comprehensions-3.10.1/.github/workflows/main.yml new/flake8-comprehensions-3.11.1/.github/workflows/main.yml --- old/flake8-comprehensions-3.10.1/.github/workflows/main.yml 2022-10-30 00:52:18.000000000 +0200 +++ new/flake8-comprehensions-3.11.1/.github/workflows/main.yml 2023-03-21 15:28:53.000000000 +0100 @@ -36,7 +36,7 @@ - name: Install dependencies run: | python -m pip install --upgrade pip setuptools wheel - python -m pip install --upgrade tox tox-py + python -m pip install --upgrade 'tox>=4.0.0rc3' - name: Run tox targets for ${{ matrix.python-version }} - run: tox --py current + run: tox run -f py$(echo ${{ matrix.python-version }} | tr -d .) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-comprehensions-3.10.1/.gitignore new/flake8-comprehensions-3.11.1/.gitignore --- old/flake8-comprehensions-3.10.1/.gitignore 2022-10-30 00:52:18.000000000 +0200 +++ new/flake8-comprehensions-3.11.1/.gitignore 2023-03-21 15:28:53.000000000 +0100 @@ -1,60 +1,7 @@ -# Byte-compiled / optimized / DLL files -__pycache__/ -*.py[cod] -*$py.class - -# C extensions -*.so - -# Distribution / packaging -.Python -env/ -build/ -develop-eggs/ -dist/ -downloads/ -eggs/ -.eggs/ -lib/ -lib64/ -parts/ -sdist/ -var/ *.egg-info/ -.installed.cfg -*.egg - -# PyInstaller -# Usually these files are written by a python script from a template -# before PyInstaller builds the exe, so as to inject date/other infos into it. -*.manifest -*.spec - -# Installer logs -pip-log.txt -pip-delete-this-directory.txt - -# Unit test / coverage reports -htmlcov/ -.tox/ -.coverage -.coverage.* -.cache -nosetests.xml -coverage.xml -*,cover -.hypothesis/ -.pytest_cache - -# Translations -*.mo -*.pot - -# Django stuff: -*.log - -# Sphinx documentation -docs/_build/ - -# PyBuilder -target/ +*.pyc +/.coverage +/.coverage.* +/.tox +/build/ +/dist/ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-comprehensions-3.10.1/.pre-commit-config.yaml new/flake8-comprehensions-3.11.1/.pre-commit-config.yaml --- old/flake8-comprehensions-3.10.1/.pre-commit-config.yaml 2022-10-30 00:52:18.000000000 +0200 +++ new/flake8-comprehensions-3.11.1/.pre-commit-config.yaml 2023-03-21 15:28:53.000000000 +0100 @@ -1,9 +1,9 @@ default_language_version: - python: python3.10 + python: python3.11 repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.3.0 + rev: v4.4.0 hooks: - id: check-added-large-files - id: check-case-conflict @@ -13,27 +13,49 @@ - id: check-toml - id: end-of-file-fixer - id: trailing-whitespace +- repo: https://github.com/tox-dev/pyproject-fmt + rev: 0.9.2 + hooks: + - id: pyproject-fmt +- repo: https://github.com/asottile/setup-cfg-fmt + rev: v2.2.0 + hooks: + - id: setup-cfg-fmt + args: + - --include-version-classifiers +- repo: https://github.com/rstcheck/rstcheck + rev: v6.1.2 + hooks: + - id: rstcheck + additional_dependencies: + - tomli==2.0.1 - repo: https://github.com/asottile/pyupgrade - rev: v3.1.0 + rev: v3.3.1 hooks: - id: pyupgrade args: [--py37-plus] - repo: https://github.com/psf/black - rev: 22.10.0 + rev: 23.1.0 hooks: - id: black -- repo: https://github.com/asottile/blacken-docs - rev: v1.12.1 +- repo: https://github.com/adamchainz/blacken-docs + rev: 1.13.0 hooks: - id: blacken-docs additional_dependencies: - - black==22.1.0 -- repo: https://github.com/pycqa/isort - rev: 5.10.1 - hooks: - - id: isort + - black==23.1.0 +- repo: https://github.com/asottile/reorder_python_imports + rev: v3.9.0 + hooks: + - id: reorder-python-imports + args: + - --py37-plus + - --application-directories + - .:example:src + - --add-import + - 'from __future__ import annotations' - repo: https://github.com/PyCQA/flake8 - rev: 5.0.4 + rev: 6.0.0 hooks: - id: flake8 additional_dependencies: @@ -42,6 +64,6 @@ - flake8-tidy-imports - flake8-typing-imports - repo: https://github.com/pre-commit/mirrors-mypy - rev: v0.982 + rev: v1.1.1 hooks: - id: mypy diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-comprehensions-3.10.1/CHANGELOG.rst new/flake8-comprehensions-3.11.1/CHANGELOG.rst --- old/flake8-comprehensions-3.10.1/CHANGELOG.rst 1970-01-01 01:00:00.000000000 +0100 +++ new/flake8-comprehensions-3.11.1/CHANGELOG.rst 2023-03-21 15:28:53.000000000 +0100 @@ -0,0 +1,261 @@ +========= +Changelog +========= + +3.11.1 (2023-03-21) +------------------- + +* Fix false positives in C406 âunnecessary dict literalâ. + + Fixes `Issue #260 <https://github.com/adamchainz/flake8-comprehensions/issues/260>`__. + +3.11.0 (2023-03-18) +------------------- + +* Expand C416 to ``dict`` comprehensions. + + Thanks to Aaron Gokaslan in `PR #490 <https://github.com/adamchainz/flake8-comprehensions/pull/490>`__. + +3.10.1 (2022-10-29) +------------------- + +* Fix false positive in rules C402 and C404 for ``dict()`` calls with keyword arguments. + + Thanks to Anders Kaseorg for the report in `Issue #457 <https://github.com/adamchainz/flake8-comprehensions/issues/457>`__. + +3.10.0 (2022-05-19) +------------------- + +* Add rule C417 which recommends rewriting use of ``map()`` with ``lambda`` to an equivalent generator expression or comprehension. + + Thanks to Tushar Sadhwani in `PR #409 <https://github.com/adamchainz/flake8-comprehensions/pull/409>`__. + +3.9.0 (2022-05-11) +------------------ + +* Support Python 3.11. + +3.8.0 (2022-01-10) +------------------ + +* Drop Python 3.6 support. + +* Remove upper bound on Flake8 version. + +3.7.0 (2021-10-11) +------------------ + +* Support Flake8 4. + +3.6.1 (2021-08-16) +------------------ + +* Fix type hint for ``tree`` argument. + + Thanks to kasium for the report in `Issue #352 + <https://github.com/adamchainz/flake8-comprehensions/issues/352>`__. + +3.6.0 (2021-08-13) +------------------ + +* Add type hints. + +3.5.0 (2021-05-10) +------------------ + +* Support Python 3.10. + +* Stop distributing tests to reduce package size. Tests are not intended to be + run outside of the tox setup in the repository. Repackagers can use GitHub's + tarballs per tag. + +3.4.0 (2021-03-18) +------------------ + +* Remove rules C407 (Unnecessary ``<dict/list>`` comprehension - ``<builtin>`` + can take a generator) and C412 (Unnecessary ``<dict/list/set>`` comprehension + - 'in' can take a generator). Both rules recommended increasing laziness, + which is not always desirable and can lead to subtle bugs. Also, a fully + exhausted generator is slower than an equivalent comprehension, so the advice + did not always improve performance. + + Thanks to David Smith, Dylan Young, and Leonidas Loucas for the report in + `Issue #247 + <https://github.com/adamchainz/flake8-comprehensions/issues/247>`__. + +3.3.1 (2020-12-19) +------------------ + +* Drop Python 3.5 support. +* Improved installation instructions in README. + +3.3.0 (2020-10-23) +------------------ + +* Support Python 3.9. +* Move license from ISC to MIT License. +* Partially reverted the change to ``C408`` to make it apply again to when + ``dict`` is called with keyword arguments, e.g. ``dict(a=1, b=2)`` will be + flagged to be rewritten in the literal form ``{"a": 1, "b": 2}`` + +3.2.3 (2020-06-06) +------------------ + +* Made ``C408`` only apply when no arguments are passed to + ``dict``/``list``/``tuple``. + +3.2.2 (2020-01-20) +------------------ + +* Remove check for dict comprehensions in rule C407 as it would also change the + results for certain builtins such as ``sum()``. + +3.2.1 (2020-01-20) +------------------ + +* Remove check for set comprehensions in rule C407 as it would change the + results for certain builtins such as ``sum()``. + +3.2.0 (2020-01-20) +------------------ + +* Add ``filter`` and ``map`` to rule C407. +* Check for dict and set comprehensions in rules C407 and C412. + +3.1.4 (2019-11-20) +------------------ + +* Remove the tuple/unpacking check from C416 to prevent false positives where + the type of the iterable is changed from some iterable to a tuple. + +3.1.3 (2019-11-19) +------------------ + +* Ensure the fix for false positives in ``C416`` rule for asynchronous + comprehensions runs on Python 3.6 too. + +3.1.2 (2019-11-18) +------------------ + +* Fix false positives in ``C416`` rule for list comprehensions returning + tuples. + +3.1.1 (2019-11-16) +------------------ + +* Fix false positives in ``C416`` rule for asynchronous comprehensions. + +3.1.0 (2019-11-15) +------------------ + +* Update Python support to 3.5-3.8. +* Fix false positives for C404 for list comprehensions not directly creating + tuples. +* Add ``C413`` rule that checks for unnecessary use of ``list()`` or + ``reversed()`` around ``sorted()``. +* Add ``C414`` rule that checks for unnecessary use of the following: + * ``list()``, ``reversed()``, ``sorted()``, or ``tuple()`` within ``set`` + or ``sorted()`` + * ``list()`` or ``tuple()`` within ``list()`` or ``tuple()`` + * ``set()`` within ``set`` +* Add ``C415`` rule that checks for unnecessary reversal of an iterable via + subscript within ``reversed()``, ``set()``, or ``sorted()``. +* Add ``C416`` rule that checks for unnecessary list or set comprehensions that + can be rewritten using ``list()`` or ``set()``. + +3.0.1 (2019-10-28) +------------------ + +* Fix version display on ``flake8 --version`` (removing dependency on + ``cached-property``). Thanks to Jon Dufresne. + +3.0.0 (2019-10-25) +------------------ + +* Update Flake8 support to 3.0+ only. 3.0.0 was released in 2016 and the plugin + hasn't been tested with it since. + +2.3.0 (2019-10-25) +------------------ + +* Converted setuptools metadata to configuration file. This meant removing the + ``__version__`` attribute from the package. If you want to inspect the + installed version, use + ``importlib.metadata.version("flake8-comprehensions")`` + (`docs <https://docs.python.org/3.8/library/importlib.metadata.html#distribution-versions>`__ / + `backport <https://pypi.org/project/importlib-metadata/>`__). +* Add dependencies on ``cached-property`` and ``importlib-metadata``. +* Fix false negatives in ``C407`` for cases when ``enumerate`` and ``sum()`` + are passed more than one argument. + +2.2.0 (2019-08-12) +------------------ + +* Update Python support to 3.5-3.7, as 3.4 has reached its end of life. +* ``C412`` rule that complains about using list comprehension with ``in``. + +2.1.0 (2019-03-01) +------------------ + +* Add missing builtin ``enumerate`` to ``C407``. + +2.0.0 (2019-02-02) +------------------ + +* Drop Python 2 support, only Python 3.4+ is supported now. + +1.4.1 (2017-05-17) +------------------ + +* Fix false positives in ``C408`` for calls using ``*args`` or ``**kwargs``. + +1.4.0 (2017-05-14) +------------------ + +* Plugin now reserves the full ``C4XX`` code space rather than just ``C40X`` +* ``C408`` rule that complains about using ``tuple()``, ``list()``, or + ``dict()`` instead of a literal. +* ``C409`` and ``C410`` rules that complain about an unnecessary list or tuple + that could be rewritten as a literal. +* ``C411`` rule that complains about using list comprehension inside a + ``list()`` call. + +1.3.0 (2017-05-01) +------------------ + +* Don't allow installation with Flake8 3.2.0 which doesn't enable the plugin. + This bug was fixed in Flake8 3.2.1. +* Prevent false positives of ``C402`` from generators of expressions that + aren't two-tuples. +* ``C405`` and ``C406`` now also complain about unnecessary tuple literals. + +1.2.1 (2016-06-27) +------------------ + +* ``C407`` rule that complains about unnecessary list comprehensions inside + builtins that can work on generators. + +1.2.0 (2016-07-11) +------------------ + +* Split all rule codes by type. This allows granular selection of the rules in + flake8 configuration. + +1.1.1 (2016-04-06) +------------------ + +* Fix crash on method calls + +1.1.0 (2016-04-06) +------------------ + +* ``C401`` rule that complains about unnecessary list comprehensions inside + calls to ``set()`` or ``dict()``. +* ``C402`` rule that complains about unnecessary list literals inside calls to + ``set()`` or ``dict()``. + +1.0.0 (2016-04-05) +------------------ + +* ``C400`` rule that complains about an unnecessary usage of a generator when a + list/set/dict comprehension would do. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-comprehensions-3.10.1/HISTORY.rst new/flake8-comprehensions-3.11.1/HISTORY.rst --- old/flake8-comprehensions-3.10.1/HISTORY.rst 2022-10-30 00:52:18.000000000 +0200 +++ new/flake8-comprehensions-3.11.1/HISTORY.rst 2023-03-21 15:28:53.000000000 +0100 @@ -1,247 +1 @@ -======= -History -======= - -3.10.1 (2022-10-29) -------------------- - -* Fix false positive in rules C402 and C404 for ``dict()`` calls with keyword arguments. - - Thanks to Anders Kaseorg for the report in `Issue #457 <https://github.com/adamchainz/flake8-comprehensions/issues/457>`__. - -3.10.0 (2022-05-19) -------------------- - -* Add rule C417 which recommends rewriting use of ``map()`` with ``lambda`` to an equivalent generator expression or comprehension. - - Thanks to Tushar Sadhwani in `PR #409 <https://github.com/adamchainz/flake8-comprehensions/pull/409>`__. - -3.9.0 (2022-05-11) ------------------- - -* Support Python 3.11. - -3.8.0 (2022-01-10) ------------------- - -* Drop Python 3.6 support. - -* Remove upper bound on Flake8 version. - -3.7.0 (2021-10-11) ------------------- - -* Support Flake8 4. - -3.6.1 (2021-08-16) ------------------- - -* Fix type hint for ``tree`` argument. - - Thanks to kasium for the report in `Issue #352 - <https://github.com/adamchainz/flake8-comprehensions/issues/352>`__. - -3.6.0 (2021-08-13) ------------------- - -* Add type hints. - -3.5.0 (2021-05-10) ------------------- - -* Support Python 3.10. - -* Stop distributing tests to reduce package size. Tests are not intended to be - run outside of the tox setup in the repository. Repackagers can use GitHub's - tarballs per tag. - -3.4.0 (2021-03-18) ------------------- - -* Remove rules C407 (Unnecessary ``<dict/list>`` comprehension - ``<builtin>`` - can take a generator) and C412 (Unnecessary ``<dict/list/set>`` comprehension - - 'in' can take a generator). Both rules recommended increasing laziness, - which is not always desirable and can lead to subtle bugs. Also, a fully - exhausted generator is slower than an equivalent comprehension, so the advice - did not always improve performance. - - Thanks to David Smith, Dylan Young, and Leonidas Loucas for the report in - `Issue #247 - <https://github.com/adamchainz/flake8-comprehensions/issues/247>`__. - -3.3.1 (2020-12-19) ------------------- - -* Drop Python 3.5 support. -* Improved installation instructions in README. - -3.3.0 (2020-10-23) ------------------- - -* Support Python 3.9. -* Move license from ISC to MIT License. -* Partially reverted the change to ``C408`` to make it apply again to when - ``dict`` is called with keyword arguments, e.g. ``dict(a=1, b=2)`` will be - flagged to be rewritten in the literal form ``{"a": 1, "b": 2}`` - -3.2.3 (2020-06-06) ------------------- - -* Made ``C408`` only apply when no arguments are passed to - ``dict``/``list``/``tuple``. - -3.2.2 (2020-01-20) ------------------- - -* Remove check for dict comprehensions in rule C407 as it would also change the - results for certain builtins such as ``sum()``. - -3.2.1 (2020-01-20) ------------------- - -* Remove check for set comprehensions in rule C407 as it would change the - results for certain builtins such as ``sum()``. - -3.2.0 (2020-01-20) ------------------- - -* Add ``filter`` and ``map`` to rule C407. -* Check for dict and set comprehensions in rules C407 and C412. - -3.1.4 (2019-11-20) ------------------- - -* Remove the tuple/unpacking check from C416 to prevent false positives where - the type of the iterable is changed from some iterable to a tuple. - -3.1.3 (2019-11-19) ------------------- - -* Ensure the fix for false positives in ``C416`` rule for asynchronous - comprehensions runs on Python 3.6 too. - -3.1.2 (2019-11-18) ------------------- - -* Fix false positives in ``C416`` rule for list comprehensions returning - tuples. - -3.1.1 (2019-11-16) ------------------- - -* Fix false positives in ``C416`` rule for asynchronous comprehensions. - -3.1.0 (2019-11-15) ------------------- - -* Update Python support to 3.5-3.8. -* Fix false positives for C404 for list comprehensions not directly creating - tuples. -* Add ``C413`` rule that checks for unnecessary use of ``list()`` or - ``reversed()`` around ``sorted()``. -* Add ``C414`` rule that checks for unnecessary use of the following: - * ``list()``, ``reversed()``, ``sorted()``, or ``tuple()`` within ``set`` - or ``sorted()`` - * ``list()`` or ``tuple()`` within ``list()`` or ``tuple()`` - * ``set()`` within ``set`` -* Add ``C415`` rule that checks for unnecessary reversal of an iterable via - subscript within ``reversed()``, ``set()``, or ``sorted()``. -* Add ``C416`` rule that checks for unnecessary list or set comprehensions that - can be rewritten using ``list()`` or ``set()``. - -3.0.1 (2019-10-28) ------------------- - -* Fix version display on ``flake8 --version`` (removing dependency on - ``cached-property``). Thanks to Jon Dufresne. - -3.0.0 (2019-10-25) ------------------- - -* Update Flake8 support to 3.0+ only. 3.0.0 was released in 2016 and the plugin - hasn't been tested with it since. - -2.3.0 (2019-10-25) ------------------- - -* Converted setuptools metadata to configuration file. This meant removing the - ``__version__`` attribute from the package. If you want to inspect the - installed version, use - ``importlib.metadata.version("flake8-comprehensions")`` - (`docs <https://docs.python.org/3.8/library/importlib.metadata.html#distribution-versions>`__ / - `backport <https://pypi.org/project/importlib-metadata/>`__). -* Add dependencies on ``cached-property`` and ``importlib-metadata``. -* Fix false negatives in ``C407`` for cases when ``enumerate`` and ``sum()`` - are passed more than one argument. - -2.2.0 (2019-08-12) ------------------- - -* Update Python support to 3.5-3.7, as 3.4 has reached its end of life. -* ``C412`` rule that complains about using list comprehension with ``in``. - -2.1.0 (2019-03-01) ------------------- - -* Add missing builtin ``enumerate`` to ``C407``. - -2.0.0 (2019-02-02) ------------------- - -* Drop Python 2 support, only Python 3.4+ is supported now. - -1.4.1 (2017-05-17) ------------------- - -* Fix false positives in ``C408`` for calls using ``*args`` or ``**kwargs``. - -1.4.0 (2017-05-14) ------------------- - -* Plugin now reserves the full ``C4XX`` code space rather than just ``C40X`` -* ``C408`` rule that complains about using ``tuple()``, ``list()``, or - ``dict()`` instead of a literal. -* ``C409`` and ``C410`` rules that complain about an unnecessary list or tuple - that could be rewritten as a literal. -* ``C411`` rule that complains about using list comprehension inside a - ``list()`` call. - -1.3.0 (2017-05-01) ------------------- - -* Don't allow installation with Flake8 3.2.0 which doesn't enable the plugin. - This bug was fixed in Flake8 3.2.1. -* Prevent false positives of ``C402`` from generators of expressions that - aren't two-tuples. -* ``C405`` and ``C406`` now also complain about unnecessary tuple literals. - -1.2.1 (2016-06-27) ------------------- - -* ``C407`` rule that complains about unnecessary list comprehensions inside - builtins that can work on generators. - -1.2.0 (2016-07-11) ------------------- - -* Split all rule codes by type. This allows granular selection of the rules in - flake8 configuration. - -1.1.1 (2016-04-06) ------------------- - -* Fix crash on method calls - -1.1.0 (2016-04-06) ------------------- - -* ``C401`` rule that complains about unnecessary list comprehensions inside - calls to ``set()`` or ``dict()``. -* ``C402`` rule that complains about unnecessary list literals inside calls to - ``set()`` or ``dict()``. - -1.0.0 (2016-04-05) ------------------- - -* ``C400`` rule that complains about an unnecessary usage of a generator when a - list/set/dict comprehension would do. +See https://github.com/adamchainz/flake8-comprehensions/blob/main/CHANGELOG.rst diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-comprehensions-3.10.1/MANIFEST.in new/flake8-comprehensions-3.11.1/MANIFEST.in --- old/flake8-comprehensions-3.10.1/MANIFEST.in 2022-10-30 00:52:18.000000000 +0200 +++ new/flake8-comprehensions-3.11.1/MANIFEST.in 2023-03-21 15:28:53.000000000 +0100 @@ -1,4 +1,4 @@ -include HISTORY.rst +include CHANGELOG.rst include LICENSE include pyproject.toml include README.rst diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-comprehensions-3.10.1/README.rst new/flake8-comprehensions-3.11.1/README.rst --- old/flake8-comprehensions-3.10.1/README.rst 2022-10-30 00:52:18.000000000 +0200 +++ new/flake8-comprehensions-3.11.1/README.rst 2023-03-21 15:28:53.000000000 +0100 @@ -2,7 +2,7 @@ flake8-comprehensions ===================== -.. image:: https://img.shields.io/github/workflow/status/adamchainz/flake8-comprehensions/CI/main?style=for-the-badge +.. image:: https://img.shields.io/github/actions/workflow/status/adamchainz/flake8-comprehensions/main.yml?branch=main&style=for-the-badge :target: https://github.com/adamchainz/flake8-comprehensions/actions?workflow=CI .. image:: https://img.shields.io/pypi/v/flake8-comprehensions.svg?style=for-the-badge @@ -47,6 +47,12 @@ C400-402: Unnecessary generator - rewrite as a ``<list/set/dict>`` comprehension. --------------------------------------------------------------------------------- +Rules: + +* C400 Unnecessary generator - rewrite as a list comprehension. +* C401 Unnecessary generator - rewrite as a set comprehension. +* C402 Unnecessary generator - rewrite as a dict comprehension. + It's unnecessary to use ``list``, ``set``, or ``dict`` around a generator expression, since there are equivalent comprehensions for these types. For example: @@ -57,6 +63,11 @@ C403-404: Unnecessary list comprehension - rewrite as a ``<set/dict>`` comprehension. ------------------------------------------------------------------------------------- +Rules: + +* C403 Unnecessary list comprehension - rewrite as a set comprehension. +* C404 Unnecessary list comprehension - rewrite as a dict comprehension. + It's unnecessary to use a list comprehension inside a call to ``set`` or ``dict``, since there are equivalent comprehensions for these types. For example: @@ -66,6 +77,9 @@ C405-406: Unnecessary ``<list/tuple>`` literal - rewrite as a ``<set/dict>`` literal. ------------------------------------------------------------------------------------- +* C405 Unnecessary ``<list/tuple>`` literal - rewrite as a set literal. +* C406 Unnecessary ``<list/tuple>`` literal - rewrite as a dict literal. + It's unnecessary to use a list or tuple literal within a call to ``set`` or ``dict``. For example: @@ -76,6 +90,11 @@ * Rewrite ``dict(((1, 2),))`` as ``{1: 2}`` * Rewrite ``dict([])`` as ``{}`` +C407: Unnecessary ``<dict/list>`` comprehension - ``<builtin>`` can take a generator +------------------------------------------------------------------------------------ + +This rule was dropped in version 3.4.0, because it promoted an increase in laziness which could lead to bugs. + C408: Unnecessary ``<dict/list/tuple>`` call - rewrite as a literal. -------------------------------------------------------------------- @@ -88,8 +107,18 @@ * Rewrite ``list()`` as ``[]`` * Rewrite ``tuple()`` as ``()`` -C409-410: Unnecessary ``<list/tuple>`` passed to ``<list/tuple>``\() - (remove the outer call to ``<list/tuple>``()/rewrite as a ``<list/tuple>`` literal). ------------------------------------------------------------------------------------------------------------------------------------------------------------ +C409-410: Unnecessary ``<list/tuple>`` passed to ``<list/tuple>``\() - ``<advice>``. +------------------------------------------------------------------------------------ + +Rules: + +* C409 Unnecessary ``<list/tuple>`` passed to tuple() - ``<advice>``. +* C410 Unnecessary ``list passed to list() - ``<advice>``. + +Where ``<advice>`` is either: + +* remove the outer call to ``<list/tuple>``\() +* rewrite as a ``<list/tuple>`` literal It's unnecessary to use a list or tuple literal within a call to ``list`` or ``tuple``, since there is literal syntax for these types. For example: @@ -109,6 +138,11 @@ * Rewrite ``list([f(x) for x in foo])`` as ``[f(x) for x in foo]`` +C412: Unnecessary ``<dict/list/set>`` comprehension - 'in' can take a generator. +-------------------------------------------------------------------------------- + +This rule was dropped in version 3.4.0, because it promoted an increase in laziness which could lead to bugs. + C413: Unnecessary ``<list/reversed>`` call around sorted(). ----------------------------------------------------------- @@ -150,13 +184,14 @@ * Rewrite ``sorted(iterable)[::-1]`` as ``sorted(iterable, reverse=True)`` * Rewrite ``reversed(iterable[::-1])`` as ``iterable`` -C416: Unnecessary ``<list/set>`` comprehension - rewrite using ``<list/set>``\(). ---------------------------------------------------------------------------------- +C416: Unnecessary ``<dict/list/set>`` comprehension - rewrite using ``<dict/list/set>``\(). +------------------------------------------------------------------------------------------- -It's unnecessary to use a list comprehension if the elements are unchanged. -The iterable should be wrapped in ``list()`` or ``set()`` instead. +It's unnecessary to use a dict/list/set comprehension to build a data structure if the elements are unchanged. +Wrap the iterable with ``dict()``, ``list()``, or ``set()`` instead. For example: +* Rewrite ``{a: b for a, b in iterable}`` as ``dict(iterable)`` * Rewrite ``[x for x in iterable]`` as ``list(iterable)`` * Rewrite ``{x for x in iterable}`` as ``set(iterable)`` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-comprehensions-3.10.1/pyproject.toml new/flake8-comprehensions-3.11.1/pyproject.toml --- old/flake8-comprehensions-3.10.1/pyproject.toml 2022-10-30 00:52:18.000000000 +0200 +++ new/flake8-comprehensions-3.11.1/pyproject.toml 2023-03-21 15:28:53.000000000 +0100 @@ -1,16 +1,21 @@ [build-system] -requires = ["setuptools"] build-backend = "setuptools.build_meta" +requires = [ + "setuptools", +] [tool.black] target-version = ['py37'] -[tool.isort] -profile = "black" -add_imports = "from __future__ import annotations" +[tool.pytest.ini_options] +addopts = """\ + --strict-config + --strict-markers + """ [tool.mypy] mypy_path = "src/" +namespace_packages = false show_error_codes = true strict = true warn_unreachable = true @@ -19,8 +24,5 @@ module = "tests.*" allow_untyped_defs = true -[tool.pytest.ini_options] -addopts = """\ - --strict-config - --strict-markers - """ +[tool.rstcheck] +report_level = "ERROR" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-comprehensions-3.10.1/requirements/py310.txt new/flake8-comprehensions-3.11.1/requirements/py310.txt --- old/flake8-comprehensions-3.10.1/requirements/py310.txt 2022-10-30 00:52:18.000000000 +0200 +++ new/flake8-comprehensions-3.11.1/requirements/py310.txt 2023-03-21 15:28:53.000000000 +0100 @@ -1,52 +1,48 @@ # -# This file is autogenerated by pip-compile with python 3.10 -# To update, run: +# This file is autogenerated by pip-compile with Python 3.10 +# by the following command: # # requirements/compile.py # -attrs==22.1.0 \ - --hash=sha256:29adc2665447e5191d0e7c568fde78b21f9672d344281d0c6e1ab085429b22b6 \ - --hash=sha256:86efa402f67bf2df34f51a335487cf46b1ec130d02b8d39fd248abfd30da551c +attrs==22.2.0 \ + --hash=sha256:29e95c7f6778868dbd49170f98f8818f78f3dc5e0e37c0b1f474e3561b240836 \ + --hash=sha256:c9227bfc2f01993c03f68db37d1d15c9690188323c067c641f1a35ca58185f99 # via pytest -flake8==5.0.4 \ - --hash=sha256:6fbe320aad8d6b95cec8b8e47bc933004678dc63095be98528b7bdd2a9f510db \ - --hash=sha256:7a1cf6b73744f5806ab95e526f6f0d8c01c66d7bbe349562d22dfca20610b248 +exceptiongroup==1.1.0 \ + --hash=sha256:327cbda3da756e2de031a3107b81ab7b3770a602c4d16ca618298c526f4bec1e \ + --hash=sha256:bcb67d800a4497e1b404c2dd44fca47d3b7a5e5433dbab67f96c1a685cdfdf23 + # via pytest +flake8==6.0.0 \ + --hash=sha256:3833794e27ff64ea4e9cf5d410082a8b97ff1a06c16aa3d2027339cd0f1195c7 \ + --hash=sha256:c61007e76655af75e6785a931f452915b371dc48f56efd765247c8fe68f2b181 # via pytest-flake8-path -iniconfig==1.1.1 \ - --hash=sha256:011e24c64b7f47f6ebd835bb12a743f2fbe9a26d4cecaa7f53bc4f35ee9da8b3 \ - --hash=sha256:bc3af051d7d14b2ee5ef9969666def0cd1a000e121eaea580d4a313df4b37f32 +iniconfig==2.0.0 \ + --hash=sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3 \ + --hash=sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374 # via pytest mccabe==0.7.0 \ --hash=sha256:348e0240c33b60bbdf4e523192ef919f28cb2c3d7d5c7794f74009290f236325 \ --hash=sha256:6c2d30ab6be0e4a46919781807b4f0d834ebdd6c6e3dca0bda5a15f863427b6e # via flake8 -packaging==21.3 \ - --hash=sha256:dd47c42927d89ab911e606518907cc2d3a1f38bbd026385970643f9c5b8ecfeb \ - --hash=sha256:ef103e05f519cdc783ae24ea4e2e0f508a9c99b2d4969652eed6a2e1ea5bd522 +packaging==23.0 \ + --hash=sha256:714ac14496c3e68c99c29b00845f7a2b85f3bb6f1078fd9f72fd20f0570002b2 \ + --hash=sha256:b6ad297f8907de0fa2fe1ccbd26fdaf387f5f47c7275fedf8cce89f99446cf97 # via pytest pluggy==1.0.0 \ --hash=sha256:4224373bacce55f955a878bf9cfa763c1e360858e330072059e10bad68531159 \ --hash=sha256:74134bbf457f031a36d68416e1509f34bd5ccc019f0bcc952c7b909d06b37bd3 # via pytest -py==1.11.0 \ - --hash=sha256:51c75c4126074b472f746a24399ad32f6053d1b34b68d2fa41e558e6f4a98719 \ - --hash=sha256:607c53218732647dff4acdfcd50cb62615cedf612e72d1724fb1a0cc6405b378 - # via pytest -pycodestyle==2.9.1 \ - --hash=sha256:2c9607871d58c76354b697b42f5d57e1ada7d261c261efac224b664affdc5785 \ - --hash=sha256:d1735fc58b418fd7c5f658d28d943854f8a849b01a5d0a1e6f3f3fdd0166804b +pycodestyle==2.10.0 \ + --hash=sha256:347187bdb476329d98f695c213d7295a846d1152ff4fe9bacb8a9590b8ee7053 \ + --hash=sha256:8a4eaf0d0495c7395bdab3589ac2db602797d76207242c17d470186815706610 # via flake8 -pyflakes==2.5.0 \ - --hash=sha256:4579f67d887f804e67edb544428f264b7b24f435b263c4614f384135cea553d2 \ - --hash=sha256:491feb020dca48ccc562a8c0cbe8df07ee13078df59813b83959cbdada312ea3 +pyflakes==3.0.1 \ + --hash=sha256:ec55bf7fe21fff7f1ad2f7da62363d749e2a470500eab1b555334b67aa1ef8cf \ + --hash=sha256:ec8b276a6b60bd80defed25add7e439881c19e64850afd9b346283d4165fd0fd # via flake8 -pyparsing==3.0.9 \ - --hash=sha256:2b020ecf7d21b687f219b71ecad3631f644a47f01403fa1d1036b0c6416d70fb \ - --hash=sha256:5026bae9a10eeaefb61dab2f09052b9f4307d44aee4eda64b309723d8d206bbc - # via packaging -pytest==7.1.3 \ - --hash=sha256:1377bda3466d70b55e3f5cecfa55bb7cfcf219c7964629b967c37cf0bda818b7 \ - --hash=sha256:4f365fec2dff9c1162f834d9f18af1ba13062db0c708bf7b946f8a5c76180c39 +pytest==7.2.2 \ + --hash=sha256:130328f552dcfac0b1cec75c12e3f005619dc5f874f0a06e8ff7263f0ee6225e \ + --hash=sha256:c99ab0c73aceb050f68929bc93af19ab6db0558791c6a0715723abe9d0ade9d4 # via # -r requirements.in # pytest-flake8-path diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-comprehensions-3.10.1/requirements/py311.txt new/flake8-comprehensions-3.11.1/requirements/py311.txt --- old/flake8-comprehensions-3.10.1/requirements/py311.txt 2022-10-30 00:52:18.000000000 +0200 +++ new/flake8-comprehensions-3.11.1/requirements/py311.txt 2023-03-21 15:28:53.000000000 +0100 @@ -1,52 +1,44 @@ # -# This file is autogenerated by pip-compile with python 3.11 -# To update, run: +# This file is autogenerated by pip-compile with Python 3.11 +# by the following command: # # requirements/compile.py # -attrs==22.1.0 \ - --hash=sha256:29adc2665447e5191d0e7c568fde78b21f9672d344281d0c6e1ab085429b22b6 \ - --hash=sha256:86efa402f67bf2df34f51a335487cf46b1ec130d02b8d39fd248abfd30da551c - # via pytest -flake8==5.0.4 \ - --hash=sha256:6fbe320aad8d6b95cec8b8e47bc933004678dc63095be98528b7bdd2a9f510db \ - --hash=sha256:7a1cf6b73744f5806ab95e526f6f0d8c01c66d7bbe349562d22dfca20610b248 +attrs==22.2.0 \ + --hash=sha256:29e95c7f6778868dbd49170f98f8818f78f3dc5e0e37c0b1f474e3561b240836 \ + --hash=sha256:c9227bfc2f01993c03f68db37d1d15c9690188323c067c641f1a35ca58185f99 + # via pytest +flake8==6.0.0 \ + --hash=sha256:3833794e27ff64ea4e9cf5d410082a8b97ff1a06c16aa3d2027339cd0f1195c7 \ + --hash=sha256:c61007e76655af75e6785a931f452915b371dc48f56efd765247c8fe68f2b181 # via pytest-flake8-path -iniconfig==1.1.1 \ - --hash=sha256:011e24c64b7f47f6ebd835bb12a743f2fbe9a26d4cecaa7f53bc4f35ee9da8b3 \ - --hash=sha256:bc3af051d7d14b2ee5ef9969666def0cd1a000e121eaea580d4a313df4b37f32 +iniconfig==2.0.0 \ + --hash=sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3 \ + --hash=sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374 # via pytest mccabe==0.7.0 \ --hash=sha256:348e0240c33b60bbdf4e523192ef919f28cb2c3d7d5c7794f74009290f236325 \ --hash=sha256:6c2d30ab6be0e4a46919781807b4f0d834ebdd6c6e3dca0bda5a15f863427b6e # via flake8 -packaging==21.3 \ - --hash=sha256:dd47c42927d89ab911e606518907cc2d3a1f38bbd026385970643f9c5b8ecfeb \ - --hash=sha256:ef103e05f519cdc783ae24ea4e2e0f508a9c99b2d4969652eed6a2e1ea5bd522 +packaging==23.0 \ + --hash=sha256:714ac14496c3e68c99c29b00845f7a2b85f3bb6f1078fd9f72fd20f0570002b2 \ + --hash=sha256:b6ad297f8907de0fa2fe1ccbd26fdaf387f5f47c7275fedf8cce89f99446cf97 # via pytest pluggy==1.0.0 \ --hash=sha256:4224373bacce55f955a878bf9cfa763c1e360858e330072059e10bad68531159 \ --hash=sha256:74134bbf457f031a36d68416e1509f34bd5ccc019f0bcc952c7b909d06b37bd3 # via pytest -py==1.11.0 \ - --hash=sha256:51c75c4126074b472f746a24399ad32f6053d1b34b68d2fa41e558e6f4a98719 \ - --hash=sha256:607c53218732647dff4acdfcd50cb62615cedf612e72d1724fb1a0cc6405b378 - # via pytest -pycodestyle==2.9.1 \ - --hash=sha256:2c9607871d58c76354b697b42f5d57e1ada7d261c261efac224b664affdc5785 \ - --hash=sha256:d1735fc58b418fd7c5f658d28d943854f8a849b01a5d0a1e6f3f3fdd0166804b +pycodestyle==2.10.0 \ + --hash=sha256:347187bdb476329d98f695c213d7295a846d1152ff4fe9bacb8a9590b8ee7053 \ + --hash=sha256:8a4eaf0d0495c7395bdab3589ac2db602797d76207242c17d470186815706610 # via flake8 -pyflakes==2.5.0 \ - --hash=sha256:4579f67d887f804e67edb544428f264b7b24f435b263c4614f384135cea553d2 \ - --hash=sha256:491feb020dca48ccc562a8c0cbe8df07ee13078df59813b83959cbdada312ea3 +pyflakes==3.0.1 \ + --hash=sha256:ec55bf7fe21fff7f1ad2f7da62363d749e2a470500eab1b555334b67aa1ef8cf \ + --hash=sha256:ec8b276a6b60bd80defed25add7e439881c19e64850afd9b346283d4165fd0fd # via flake8 -pyparsing==3.0.9 \ - --hash=sha256:2b020ecf7d21b687f219b71ecad3631f644a47f01403fa1d1036b0c6416d70fb \ - --hash=sha256:5026bae9a10eeaefb61dab2f09052b9f4307d44aee4eda64b309723d8d206bbc - # via packaging -pytest==7.1.3 \ - --hash=sha256:1377bda3466d70b55e3f5cecfa55bb7cfcf219c7964629b967c37cf0bda818b7 \ - --hash=sha256:4f365fec2dff9c1162f834d9f18af1ba13062db0c708bf7b946f8a5c76180c39 +pytest==7.2.2 \ + --hash=sha256:130328f552dcfac0b1cec75c12e3f005619dc5f874f0a06e8ff7263f0ee6225e \ + --hash=sha256:c99ab0c73aceb050f68929bc93af19ab6db0558791c6a0715723abe9d0ade9d4 # via # -r requirements.in # pytest-flake8-path @@ -59,7 +51,3 @@ --hash=sha256:d60c2db71ac319aee0fc6c4110a7597d611a8b94a5590918bfa8583f00caccb2 \ --hash=sha256:f4f2e803daf5d1ba036cc22bf4fe9dbbf99389ec56b00e5cba732fb5c1d07fdd # via -r requirements.in -tomli==2.0.1 \ - --hash=sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc \ - --hash=sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f - # via pytest diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-comprehensions-3.10.1/requirements/py37.txt new/flake8-comprehensions-3.11.1/requirements/py37.txt --- old/flake8-comprehensions-3.10.1/requirements/py37.txt 2022-10-30 00:52:18.000000000 +0200 +++ new/flake8-comprehensions-3.11.1/requirements/py37.txt 2023-03-21 15:28:53.000000000 +0100 @@ -1,12 +1,16 @@ # -# This file is autogenerated by pip-compile with python 3.7 -# To update, run: +# This file is autogenerated by pip-compile with Python 3.7 +# by the following command: # # requirements/compile.py # -attrs==22.1.0 \ - --hash=sha256:29adc2665447e5191d0e7c568fde78b21f9672d344281d0c6e1ab085429b22b6 \ - --hash=sha256:86efa402f67bf2df34f51a335487cf46b1ec130d02b8d39fd248abfd30da551c +attrs==22.2.0 \ + --hash=sha256:29e95c7f6778868dbd49170f98f8818f78f3dc5e0e37c0b1f474e3561b240836 \ + --hash=sha256:c9227bfc2f01993c03f68db37d1d15c9690188323c067c641f1a35ca58185f99 + # via pytest +exceptiongroup==1.1.0 \ + --hash=sha256:327cbda3da756e2de031a3107b81ab7b3770a602c4d16ca618298c526f4bec1e \ + --hash=sha256:bcb67d800a4497e1b404c2dd44fca47d3b7a5e5433dbab67f96c1a685cdfdf23 # via pytest flake8==5.0.4 \ --hash=sha256:6fbe320aad8d6b95cec8b8e47bc933004678dc63095be98528b7bdd2a9f510db \ @@ -21,26 +25,22 @@ # pluggy # pytest # pytest-randomly -iniconfig==1.1.1 \ - --hash=sha256:011e24c64b7f47f6ebd835bb12a743f2fbe9a26d4cecaa7f53bc4f35ee9da8b3 \ - --hash=sha256:bc3af051d7d14b2ee5ef9969666def0cd1a000e121eaea580d4a313df4b37f32 +iniconfig==2.0.0 \ + --hash=sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3 \ + --hash=sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374 # via pytest mccabe==0.7.0 \ --hash=sha256:348e0240c33b60bbdf4e523192ef919f28cb2c3d7d5c7794f74009290f236325 \ --hash=sha256:6c2d30ab6be0e4a46919781807b4f0d834ebdd6c6e3dca0bda5a15f863427b6e # via flake8 -packaging==21.3 \ - --hash=sha256:dd47c42927d89ab911e606518907cc2d3a1f38bbd026385970643f9c5b8ecfeb \ - --hash=sha256:ef103e05f519cdc783ae24ea4e2e0f508a9c99b2d4969652eed6a2e1ea5bd522 +packaging==23.0 \ + --hash=sha256:714ac14496c3e68c99c29b00845f7a2b85f3bb6f1078fd9f72fd20f0570002b2 \ + --hash=sha256:b6ad297f8907de0fa2fe1ccbd26fdaf387f5f47c7275fedf8cce89f99446cf97 # via pytest pluggy==1.0.0 \ --hash=sha256:4224373bacce55f955a878bf9cfa763c1e360858e330072059e10bad68531159 \ --hash=sha256:74134bbf457f031a36d68416e1509f34bd5ccc019f0bcc952c7b909d06b37bd3 # via pytest -py==1.11.0 \ - --hash=sha256:51c75c4126074b472f746a24399ad32f6053d1b34b68d2fa41e558e6f4a98719 \ - --hash=sha256:607c53218732647dff4acdfcd50cb62615cedf612e72d1724fb1a0cc6405b378 - # via pytest pycodestyle==2.9.1 \ --hash=sha256:2c9607871d58c76354b697b42f5d57e1ada7d261c261efac224b664affdc5785 \ --hash=sha256:d1735fc58b418fd7c5f658d28d943854f8a849b01a5d0a1e6f3f3fdd0166804b @@ -49,13 +49,9 @@ --hash=sha256:4579f67d887f804e67edb544428f264b7b24f435b263c4614f384135cea553d2 \ --hash=sha256:491feb020dca48ccc562a8c0cbe8df07ee13078df59813b83959cbdada312ea3 # via flake8 -pyparsing==3.0.9 \ - --hash=sha256:2b020ecf7d21b687f219b71ecad3631f644a47f01403fa1d1036b0c6416d70fb \ - --hash=sha256:5026bae9a10eeaefb61dab2f09052b9f4307d44aee4eda64b309723d8d206bbc - # via packaging -pytest==7.1.3 \ - --hash=sha256:1377bda3466d70b55e3f5cecfa55bb7cfcf219c7964629b967c37cf0bda818b7 \ - --hash=sha256:4f365fec2dff9c1162f834d9f18af1ba13062db0c708bf7b946f8a5c76180c39 +pytest==7.2.2 \ + --hash=sha256:130328f552dcfac0b1cec75c12e3f005619dc5f874f0a06e8ff7263f0ee6225e \ + --hash=sha256:c99ab0c73aceb050f68929bc93af19ab6db0558791c6a0715723abe9d0ade9d4 # via # -r requirements.in # pytest-flake8-path @@ -72,11 +68,11 @@ --hash=sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc \ --hash=sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f # via pytest -typing-extensions==4.4.0 \ - --hash=sha256:1511434bb92bf8dd198c12b1cc812e800d4181cfcb867674e0f8279cc93087aa \ - --hash=sha256:16fa4864408f655d35ec496218b85f79b3437c829e93320c7c9215ccfd92489e +typing-extensions==4.5.0 \ + --hash=sha256:5cb5f4a79139d699607b3ef622a1dedafa84e115ab0024e0d9c044a9479ca7cb \ + --hash=sha256:fb33085c39dd998ac16d1431ebc293a8b3eedd00fd4a32de0ff79002c19511b4 # via importlib-metadata -zipp==3.9.0 \ - --hash=sha256:3a7af91c3db40ec72dd9d154ae18e008c69efe8ca88dde4f9a731bb82fe2f9eb \ - --hash=sha256:972cfa31bc2fedd3fa838a51e9bc7e64b7fb725a8c00e7431554311f180e9980 +zipp==3.15.0 \ + --hash=sha256:112929ad649da941c23de50f356a2b5570c954b65150642bccdd66bf194d224b \ + --hash=sha256:48904fc76a60e542af151aded95726c1a5c34ed43ab4134b597665c86d7ad556 # via importlib-metadata diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-comprehensions-3.10.1/requirements/py38.txt new/flake8-comprehensions-3.11.1/requirements/py38.txt --- old/flake8-comprehensions-3.10.1/requirements/py38.txt 2022-10-30 00:52:18.000000000 +0200 +++ new/flake8-comprehensions-3.11.1/requirements/py38.txt 2023-03-21 15:28:53.000000000 +0100 @@ -1,56 +1,52 @@ # -# This file is autogenerated by pip-compile with python 3.8 -# To update, run: +# This file is autogenerated by pip-compile with Python 3.8 +# by the following command: # # requirements/compile.py # -attrs==22.1.0 \ - --hash=sha256:29adc2665447e5191d0e7c568fde78b21f9672d344281d0c6e1ab085429b22b6 \ - --hash=sha256:86efa402f67bf2df34f51a335487cf46b1ec130d02b8d39fd248abfd30da551c - # via pytest -flake8==5.0.4 \ - --hash=sha256:6fbe320aad8d6b95cec8b8e47bc933004678dc63095be98528b7bdd2a9f510db \ - --hash=sha256:7a1cf6b73744f5806ab95e526f6f0d8c01c66d7bbe349562d22dfca20610b248 +attrs==22.2.0 \ + --hash=sha256:29e95c7f6778868dbd49170f98f8818f78f3dc5e0e37c0b1f474e3561b240836 \ + --hash=sha256:c9227bfc2f01993c03f68db37d1d15c9690188323c067c641f1a35ca58185f99 + # via pytest +exceptiongroup==1.1.0 \ + --hash=sha256:327cbda3da756e2de031a3107b81ab7b3770a602c4d16ca618298c526f4bec1e \ + --hash=sha256:bcb67d800a4497e1b404c2dd44fca47d3b7a5e5433dbab67f96c1a685cdfdf23 + # via pytest +flake8==6.0.0 \ + --hash=sha256:3833794e27ff64ea4e9cf5d410082a8b97ff1a06c16aa3d2027339cd0f1195c7 \ + --hash=sha256:c61007e76655af75e6785a931f452915b371dc48f56efd765247c8fe68f2b181 # via pytest-flake8-path -importlib-metadata==5.0.0 \ - --hash=sha256:da31db32b304314d044d3c12c79bd59e307889b287ad12ff387b3500835fc2ab \ - --hash=sha256:ddb0e35065e8938f867ed4928d0ae5bf2a53b7773871bfe6bcc7e4fcdc7dea43 +importlib-metadata==6.0.0 \ + --hash=sha256:7efb448ec9a5e313a57655d35aa54cd3e01b7e1fbcf72dce1bf06119420f5bad \ + --hash=sha256:e354bedeb60efa6affdcc8ae121b73544a7aa74156d047311948f6d711cd378d # via pytest-randomly -iniconfig==1.1.1 \ - --hash=sha256:011e24c64b7f47f6ebd835bb12a743f2fbe9a26d4cecaa7f53bc4f35ee9da8b3 \ - --hash=sha256:bc3af051d7d14b2ee5ef9969666def0cd1a000e121eaea580d4a313df4b37f32 +iniconfig==2.0.0 \ + --hash=sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3 \ + --hash=sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374 # via pytest mccabe==0.7.0 \ --hash=sha256:348e0240c33b60bbdf4e523192ef919f28cb2c3d7d5c7794f74009290f236325 \ --hash=sha256:6c2d30ab6be0e4a46919781807b4f0d834ebdd6c6e3dca0bda5a15f863427b6e # via flake8 -packaging==21.3 \ - --hash=sha256:dd47c42927d89ab911e606518907cc2d3a1f38bbd026385970643f9c5b8ecfeb \ - --hash=sha256:ef103e05f519cdc783ae24ea4e2e0f508a9c99b2d4969652eed6a2e1ea5bd522 +packaging==23.0 \ + --hash=sha256:714ac14496c3e68c99c29b00845f7a2b85f3bb6f1078fd9f72fd20f0570002b2 \ + --hash=sha256:b6ad297f8907de0fa2fe1ccbd26fdaf387f5f47c7275fedf8cce89f99446cf97 # via pytest pluggy==1.0.0 \ --hash=sha256:4224373bacce55f955a878bf9cfa763c1e360858e330072059e10bad68531159 \ --hash=sha256:74134bbf457f031a36d68416e1509f34bd5ccc019f0bcc952c7b909d06b37bd3 # via pytest -py==1.11.0 \ - --hash=sha256:51c75c4126074b472f746a24399ad32f6053d1b34b68d2fa41e558e6f4a98719 \ - --hash=sha256:607c53218732647dff4acdfcd50cb62615cedf612e72d1724fb1a0cc6405b378 - # via pytest -pycodestyle==2.9.1 \ - --hash=sha256:2c9607871d58c76354b697b42f5d57e1ada7d261c261efac224b664affdc5785 \ - --hash=sha256:d1735fc58b418fd7c5f658d28d943854f8a849b01a5d0a1e6f3f3fdd0166804b +pycodestyle==2.10.0 \ + --hash=sha256:347187bdb476329d98f695c213d7295a846d1152ff4fe9bacb8a9590b8ee7053 \ + --hash=sha256:8a4eaf0d0495c7395bdab3589ac2db602797d76207242c17d470186815706610 # via flake8 -pyflakes==2.5.0 \ - --hash=sha256:4579f67d887f804e67edb544428f264b7b24f435b263c4614f384135cea553d2 \ - --hash=sha256:491feb020dca48ccc562a8c0cbe8df07ee13078df59813b83959cbdada312ea3 +pyflakes==3.0.1 \ + --hash=sha256:ec55bf7fe21fff7f1ad2f7da62363d749e2a470500eab1b555334b67aa1ef8cf \ + --hash=sha256:ec8b276a6b60bd80defed25add7e439881c19e64850afd9b346283d4165fd0fd # via flake8 -pyparsing==3.0.9 \ - --hash=sha256:2b020ecf7d21b687f219b71ecad3631f644a47f01403fa1d1036b0c6416d70fb \ - --hash=sha256:5026bae9a10eeaefb61dab2f09052b9f4307d44aee4eda64b309723d8d206bbc - # via packaging -pytest==7.1.3 \ - --hash=sha256:1377bda3466d70b55e3f5cecfa55bb7cfcf219c7964629b967c37cf0bda818b7 \ - --hash=sha256:4f365fec2dff9c1162f834d9f18af1ba13062db0c708bf7b946f8a5c76180c39 +pytest==7.2.2 \ + --hash=sha256:130328f552dcfac0b1cec75c12e3f005619dc5f874f0a06e8ff7263f0ee6225e \ + --hash=sha256:c99ab0c73aceb050f68929bc93af19ab6db0558791c6a0715723abe9d0ade9d4 # via # -r requirements.in # pytest-flake8-path @@ -67,7 +63,7 @@ --hash=sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc \ --hash=sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f # via pytest -zipp==3.9.0 \ - --hash=sha256:3a7af91c3db40ec72dd9d154ae18e008c69efe8ca88dde4f9a731bb82fe2f9eb \ - --hash=sha256:972cfa31bc2fedd3fa838a51e9bc7e64b7fb725a8c00e7431554311f180e9980 +zipp==3.15.0 \ + --hash=sha256:112929ad649da941c23de50f356a2b5570c954b65150642bccdd66bf194d224b \ + --hash=sha256:48904fc76a60e542af151aded95726c1a5c34ed43ab4134b597665c86d7ad556 # via importlib-metadata diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-comprehensions-3.10.1/requirements/py39.txt new/flake8-comprehensions-3.11.1/requirements/py39.txt --- old/flake8-comprehensions-3.10.1/requirements/py39.txt 2022-10-30 00:52:18.000000000 +0200 +++ new/flake8-comprehensions-3.11.1/requirements/py39.txt 2023-03-21 15:28:53.000000000 +0100 @@ -1,56 +1,52 @@ # -# This file is autogenerated by pip-compile with python 3.9 -# To update, run: +# This file is autogenerated by pip-compile with Python 3.9 +# by the following command: # # requirements/compile.py # -attrs==22.1.0 \ - --hash=sha256:29adc2665447e5191d0e7c568fde78b21f9672d344281d0c6e1ab085429b22b6 \ - --hash=sha256:86efa402f67bf2df34f51a335487cf46b1ec130d02b8d39fd248abfd30da551c - # via pytest -flake8==5.0.4 \ - --hash=sha256:6fbe320aad8d6b95cec8b8e47bc933004678dc63095be98528b7bdd2a9f510db \ - --hash=sha256:7a1cf6b73744f5806ab95e526f6f0d8c01c66d7bbe349562d22dfca20610b248 +attrs==22.2.0 \ + --hash=sha256:29e95c7f6778868dbd49170f98f8818f78f3dc5e0e37c0b1f474e3561b240836 \ + --hash=sha256:c9227bfc2f01993c03f68db37d1d15c9690188323c067c641f1a35ca58185f99 + # via pytest +exceptiongroup==1.1.0 \ + --hash=sha256:327cbda3da756e2de031a3107b81ab7b3770a602c4d16ca618298c526f4bec1e \ + --hash=sha256:bcb67d800a4497e1b404c2dd44fca47d3b7a5e5433dbab67f96c1a685cdfdf23 + # via pytest +flake8==6.0.0 \ + --hash=sha256:3833794e27ff64ea4e9cf5d410082a8b97ff1a06c16aa3d2027339cd0f1195c7 \ + --hash=sha256:c61007e76655af75e6785a931f452915b371dc48f56efd765247c8fe68f2b181 # via pytest-flake8-path -importlib-metadata==5.0.0 \ - --hash=sha256:da31db32b304314d044d3c12c79bd59e307889b287ad12ff387b3500835fc2ab \ - --hash=sha256:ddb0e35065e8938f867ed4928d0ae5bf2a53b7773871bfe6bcc7e4fcdc7dea43 +importlib-metadata==6.0.0 \ + --hash=sha256:7efb448ec9a5e313a57655d35aa54cd3e01b7e1fbcf72dce1bf06119420f5bad \ + --hash=sha256:e354bedeb60efa6affdcc8ae121b73544a7aa74156d047311948f6d711cd378d # via pytest-randomly -iniconfig==1.1.1 \ - --hash=sha256:011e24c64b7f47f6ebd835bb12a743f2fbe9a26d4cecaa7f53bc4f35ee9da8b3 \ - --hash=sha256:bc3af051d7d14b2ee5ef9969666def0cd1a000e121eaea580d4a313df4b37f32 +iniconfig==2.0.0 \ + --hash=sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3 \ + --hash=sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374 # via pytest mccabe==0.7.0 \ --hash=sha256:348e0240c33b60bbdf4e523192ef919f28cb2c3d7d5c7794f74009290f236325 \ --hash=sha256:6c2d30ab6be0e4a46919781807b4f0d834ebdd6c6e3dca0bda5a15f863427b6e # via flake8 -packaging==21.3 \ - --hash=sha256:dd47c42927d89ab911e606518907cc2d3a1f38bbd026385970643f9c5b8ecfeb \ - --hash=sha256:ef103e05f519cdc783ae24ea4e2e0f508a9c99b2d4969652eed6a2e1ea5bd522 +packaging==23.0 \ + --hash=sha256:714ac14496c3e68c99c29b00845f7a2b85f3bb6f1078fd9f72fd20f0570002b2 \ + --hash=sha256:b6ad297f8907de0fa2fe1ccbd26fdaf387f5f47c7275fedf8cce89f99446cf97 # via pytest pluggy==1.0.0 \ --hash=sha256:4224373bacce55f955a878bf9cfa763c1e360858e330072059e10bad68531159 \ --hash=sha256:74134bbf457f031a36d68416e1509f34bd5ccc019f0bcc952c7b909d06b37bd3 # via pytest -py==1.11.0 \ - --hash=sha256:51c75c4126074b472f746a24399ad32f6053d1b34b68d2fa41e558e6f4a98719 \ - --hash=sha256:607c53218732647dff4acdfcd50cb62615cedf612e72d1724fb1a0cc6405b378 - # via pytest -pycodestyle==2.9.1 \ - --hash=sha256:2c9607871d58c76354b697b42f5d57e1ada7d261c261efac224b664affdc5785 \ - --hash=sha256:d1735fc58b418fd7c5f658d28d943854f8a849b01a5d0a1e6f3f3fdd0166804b +pycodestyle==2.10.0 \ + --hash=sha256:347187bdb476329d98f695c213d7295a846d1152ff4fe9bacb8a9590b8ee7053 \ + --hash=sha256:8a4eaf0d0495c7395bdab3589ac2db602797d76207242c17d470186815706610 # via flake8 -pyflakes==2.5.0 \ - --hash=sha256:4579f67d887f804e67edb544428f264b7b24f435b263c4614f384135cea553d2 \ - --hash=sha256:491feb020dca48ccc562a8c0cbe8df07ee13078df59813b83959cbdada312ea3 +pyflakes==3.0.1 \ + --hash=sha256:ec55bf7fe21fff7f1ad2f7da62363d749e2a470500eab1b555334b67aa1ef8cf \ + --hash=sha256:ec8b276a6b60bd80defed25add7e439881c19e64850afd9b346283d4165fd0fd # via flake8 -pyparsing==3.0.9 \ - --hash=sha256:2b020ecf7d21b687f219b71ecad3631f644a47f01403fa1d1036b0c6416d70fb \ - --hash=sha256:5026bae9a10eeaefb61dab2f09052b9f4307d44aee4eda64b309723d8d206bbc - # via packaging -pytest==7.1.3 \ - --hash=sha256:1377bda3466d70b55e3f5cecfa55bb7cfcf219c7964629b967c37cf0bda818b7 \ - --hash=sha256:4f365fec2dff9c1162f834d9f18af1ba13062db0c708bf7b946f8a5c76180c39 +pytest==7.2.2 \ + --hash=sha256:130328f552dcfac0b1cec75c12e3f005619dc5f874f0a06e8ff7263f0ee6225e \ + --hash=sha256:c99ab0c73aceb050f68929bc93af19ab6db0558791c6a0715723abe9d0ade9d4 # via # -r requirements.in # pytest-flake8-path @@ -67,7 +63,7 @@ --hash=sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc \ --hash=sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f # via pytest -zipp==3.9.0 \ - --hash=sha256:3a7af91c3db40ec72dd9d154ae18e008c69efe8ca88dde4f9a731bb82fe2f9eb \ - --hash=sha256:972cfa31bc2fedd3fa838a51e9bc7e64b7fb725a8c00e7431554311f180e9980 +zipp==3.15.0 \ + --hash=sha256:112929ad649da941c23de50f356a2b5570c954b65150642bccdd66bf194d224b \ + --hash=sha256:48904fc76a60e542af151aded95726c1a5c34ed43ab4134b597665c86d7ad556 # via importlib-metadata diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-comprehensions-3.10.1/setup.cfg new/flake8-comprehensions-3.11.1/setup.cfg --- old/flake8-comprehensions-3.10.1/setup.cfg 2022-10-30 00:52:18.000000000 +0200 +++ new/flake8-comprehensions-3.11.1/setup.cfg 2023-03-21 15:28:53.000000000 +0100 @@ -1,41 +1,43 @@ [metadata] -name = flake8-comprehensions -version = 3.10.1 +name = flake8_comprehensions +version = 3.11.1 description = A flake8 plugin to help you write better list/set/dict comprehensions. long_description = file: README.rst long_description_content_type = text/x-rst +url = https://github.com/adamchainz/flake8-comprehensions author = Adam Johnson author_email = m...@adamj.eu -url = https://github.com/adamchainz/flake8-comprehensions -project_urls = - Changelog = https://github.com/adamchainz/flake8-comprehensions/blob/main/HISTORY.rst - Twitter = https://twitter.com/adamchainz license = MIT -keywords = flake8, comprehensions, list comprehension, set comprehension, dict comprehension +license_file = LICENSE classifiers = Development Status :: 5 - Production/Stable Framework :: Flake8 Intended Audience :: Developers License :: OSI Approved :: MIT License Natural Language :: English - Programming Language :: Python :: 3 :: Only Programming Language :: Python :: 3 + Programming Language :: Python :: 3 :: Only 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 Typing :: Typed +keywords = flake8, comprehensions, list comprehension, set comprehension, dict comprehension +project_urls = + Changelog = https://github.com/adamchainz/flake8-comprehensions/blob/main/CHANGELOG.rst + Mastodon = https://fosstodon.org/@adamchainz + Twitter = https://twitter.com/adamchainz [options] -package_dir= - =src packages = find: -include_package_data = True install_requires = - flake8>=3.0,!=3.2.0 - importlib-metadata ; python_version < "3.8" + flake8!=3.2.0,>=3.0 + importlib-metadata;python_version < "3.8" python_requires = >=3.7 +include_package_data = True +package_dir = + =src zip_safe = False [options.packages.find] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-comprehensions-3.10.1/src/flake8_comprehensions/__init__.py new/flake8-comprehensions-3.11.1/src/flake8_comprehensions/__init__.py --- old/flake8-comprehensions-3.10.1/src/flake8_comprehensions/__init__.py 2022-10-30 00:52:18.000000000 +0200 +++ new/flake8-comprehensions-3.11.1/src/flake8_comprehensions/__init__.py 2023-03-21 15:28:53.000000000 +0100 @@ -2,7 +2,8 @@ import ast import sys -from typing import Any, Generator +from typing import Any +from typing import Generator if sys.version_info >= (3, 8): from importlib.metadata import version @@ -119,7 +120,16 @@ elif ( num_positional_args == 1 and isinstance(node.args[0], (ast.Tuple, ast.List)) - and node.func.id in ("tuple", "list", "set", "dict") + and ( + node.func.id in ("tuple", "list", "set") + or ( + node.func.id == "dict" + and all( + isinstance(i, ast.Tuple) and len(i.elts) == 2 + for i in node.args[0].elts + ) + ) + ) ): suffix = "rewrite as a {func} literal." msg_key = { @@ -294,18 +304,31 @@ type(self), ) - elif isinstance(node, (ast.ListComp, ast.SetComp)): + elif isinstance(node, (ast.DictComp, ast.ListComp, ast.SetComp)): if ( len(node.generators) == 1 and not node.generators[0].ifs and not node.generators[0].is_async and ( - isinstance(node.elt, ast.Name) - and isinstance(node.generators[0].target, ast.Name) - and node.elt.id == node.generators[0].target.id + ( + isinstance(node, (ast.ListComp, ast.SetComp)) + and isinstance(node.elt, ast.Name) + and isinstance(node.generators[0].target, ast.Name) + and node.elt.id == node.generators[0].target.id + ) + or ( + isinstance(node, ast.DictComp) + and isinstance(node.key, ast.Name) + and isinstance(node.value, ast.Name) + and isinstance(node.generators[0].target, ast.Tuple) + and len(node.generators[0].target.elts) == 2 + and isinstance(node.generators[0].target.elts[0], ast.Name) + and node.generators[0].target.elts[0].id == node.key.id + and isinstance(node.generators[0].target.elts[1], ast.Name) + and node.generators[0].target.elts[1].id == node.value.id + ) ) ): - yield ( node.lineno, node.col_offset, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-comprehensions-3.10.1/tests/test_flake8_comprehensions.py new/flake8-comprehensions-3.11.1/tests/test_flake8_comprehensions.py --- old/flake8-comprehensions-3.10.1/tests/test_flake8_comprehensions.py 2022-10-30 00:52:18.000000000 +0200 +++ new/flake8-comprehensions-3.11.1/tests/test_flake8_comprehensions.py 2023-03-21 15:28:53.000000000 +0100 @@ -289,6 +289,8 @@ "code", [ "foo = dict(range)", + "something = (1, 2); dict([something])", + "dict([(1,)])", ], ) def test_C406_pass(code, flake8_path): @@ -757,6 +759,10 @@ @pytest.mark.parametrize( "code", [ + "{x, y for x, y, z in zip('abc', '123', 'def')}", + "{y: x for x, y in zip('abc', '123')}", + "{x: y for x, (y,) in zip('a', ('1',))}", + "{x: z for x, (y,), z in zip('a', ('1',), 'b')}", "[str(x) for x in range(5)]", "[x + 1 for x in range(5)]", "[x for x in range(5) if x % 2]", @@ -797,6 +803,20 @@ "code,failures", [ ( + "{x: y for x, y in zip(range(5), range(5))}", + [ + "./example.py:1:1: C416 Unnecessary dict comprehension - " + + "rewrite using dict().", + ], + ), + ( + "{x: y for (x, y) in zip(range(5), range(5))}", + [ + "./example.py:1:1: C416 Unnecessary dict comprehension - " + + "rewrite using dict().", + ], + ), + ( "[x for x in range(5)]", [ f"./example.py:1:{1 + list_comp_col_offset}: C416 Unnecessary " diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-comprehensions-3.10.1/tox.ini new/flake8-comprehensions-3.11.1/tox.ini --- old/flake8-comprehensions-3.10.1/tox.ini 2022-10-30 00:52:18.000000000 +0200 +++ new/flake8-comprehensions-3.11.1/tox.ini 2023-03-21 15:28:53.000000000 +0100 @@ -1,5 +1,4 @@ [tox] -isolated_build = True envlist = py{37,38,39,310,311}