Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: adamchainz/flake8-comprehensions
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 3.13.0
Choose a base ref
...
head repository: adamchainz/flake8-comprehensions
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 3.14.0
Choose a head ref
  • 7 commits
  • 17 files changed
  • 2 contributors

Commits on Jun 17, 2023

  1. Verified

    This commit was signed with the committer’s verified signature.
    renovate-bot Mend Renovate
    Copy the full SHA
    d6de54d View commit details

Commits on Jun 21, 2023

  1. [pre-commit.ci] pre-commit autoupdate (#513)

    <!--pre-commit.ci start-->
    updates:
    - [github.com/tox-dev/pyproject-fmt: 0.11.2 →
    0.12.0](tox-dev/pyproject-fmt@0.11.2...0.12.0)
    - [github.com/tox-dev/tox-ini-fmt: 1.3.0 →
    1.3.1](tox-dev/tox-ini-fmt@1.3.0...1.3.1)
    - [github.com/asottile/pyupgrade: v3.6.0 →
    v3.7.0](asottile/pyupgrade@v3.6.0...v3.7.0)
    - [github.com/adamchainz/blacken-docs: 1.13.0 →
    1.14.0](adamchainz/blacken-docs@1.13.0...1.14.0)
    - [github.com/asottile/reorder-python-imports: v3.9.0 →
    v3.10.0](asottile/reorder-python-imports@v3.9.0...v3.10.0)
    <!--pre-commit.ci end-->
    
    Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
    pre-commit-ci[bot] authored Jun 21, 2023
    Copy the full SHA
    258bc77 View commit details

Commits on Jun 27, 2023

  1. [pre-commit.ci] pre-commit autoupdate (#514)

    <!--pre-commit.ci start-->
    updates:
    - [github.com/tox-dev/pyproject-fmt: 0.12.0 →
    0.12.1](tox-dev/pyproject-fmt@0.12.0...0.12.1)
    - [github.com/pre-commit/mirrors-mypy: v1.3.0 →
    v1.4.1](pre-commit/mirrors-mypy@v1.3.0...v1.4.1)
    <!--pre-commit.ci end-->
    
    Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
    pre-commit-ci[bot] authored Jun 27, 2023
    Copy the full SHA
    2b66124 View commit details

Commits on Jul 10, 2023

  1. Copy the full SHA
    af41442 View commit details
  2. Exclude tests from sdist

    adamchainz committed Jul 10, 2023
    Copy the full SHA
    9c4403e View commit details
  3. [pre-commit.ci] pre-commit autoupdate (#515)

    Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
    pre-commit-ci[bot] authored Jul 10, 2023
    Copy the full SHA
    e6624a5 View commit details
  4. Version 3.14.0

    adamchainz committed Jul 10, 2023
    Copy the full SHA
    09e4e99 View commit details
1 change: 0 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -18,7 +18,6 @@ jobs:
strategy:
matrix:
python-version:
- 3.7
- 3.8
- 3.9
- '3.10'
18 changes: 9 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -14,19 +14,19 @@ repos:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/tox-dev/pyproject-fmt
rev: 0.11.2
rev: 0.12.1
hooks:
- id: pyproject-fmt
- repo: https://github.com/asottile/setup-cfg-fmt
rev: v2.3.0
rev: v2.4.0
hooks:
- id: setup-cfg-fmt
args:
- --include-version-classifiers
- --max-py-version
- '3.12'
- repo: https://github.com/tox-dev/tox-ini-fmt
rev: 1.3.0
rev: 1.3.1
hooks:
- id: tox-ini-fmt
- repo: https://github.com/rstcheck/rstcheck
@@ -36,26 +36,26 @@ repos:
additional_dependencies:
- tomli==2.0.1
- repo: https://github.com/asottile/pyupgrade
rev: v3.6.0
rev: v3.8.0
hooks:
- id: pyupgrade
args: [--py37-plus]
args: [--py38-plus]
- repo: https://github.com/psf/black
rev: 23.3.0
hooks:
- id: black
- repo: https://github.com/adamchainz/blacken-docs
rev: 1.13.0
rev: 1.14.0
hooks:
- id: blacken-docs
additional_dependencies:
- black==23.1.0
- repo: https://github.com/asottile/reorder-python-imports
rev: v3.9.0
rev: v3.10.0
hooks:
- id: reorder-python-imports
args:
- --py37-plus
- --py38-plus
- --application-directories
- .:example:src
- --add-import
@@ -70,6 +70,6 @@ repos:
- flake8-tidy-imports
- flake8-typing-imports
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.3.0
rev: v1.4.1
hooks:
- id: mypy
5 changes: 5 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -2,6 +2,11 @@
Changelog
=========

3.14.0 (2023-07-10)
-------------------

* Drop Python 3.7 support.

3.13.0 (2023-06-15)
-------------------

1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
prune tests
include CHANGELOG.rst
include LICENSE
include pyproject.toml
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@ A `flake8 <https://flake8.readthedocs.io/en/latest/index.html>`_ plugin that hel
Requirements
============

Python 3.7 to 3.12 supported.
Python 3.8 to 3.12 supported.

Installation
============
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ requires = [
]

[tool.black]
target-version = ['py37']
target-version = ['py38']

[tool.pytest.ini_options]
addopts = """\
5 changes: 0 additions & 5 deletions requirements/compile.py
Original file line number Diff line number Diff line change
@@ -17,11 +17,6 @@
"--generate-hashes",
"--allow-unsafe",
] + sys.argv[1:]
subprocess.run(
["python3.7", *common_args, "-o", "py37.txt"],
check=True,
capture_output=True,
)
subprocess.run(
["python3.8", *common_args, "-o", "py38.txt"],
check=True,
12 changes: 6 additions & 6 deletions requirements/py310.txt
Original file line number Diff line number Diff line change
@@ -36,16 +36,16 @@ pyflakes==3.0.1 \
--hash=sha256:ec55bf7fe21fff7f1ad2f7da62363d749e2a470500eab1b555334b67aa1ef8cf \
--hash=sha256:ec8b276a6b60bd80defed25add7e439881c19e64850afd9b346283d4165fd0fd
# via flake8
pytest==7.3.1 \
--hash=sha256:3799fa815351fea3a5e96ac7e503a96fa51cc9942c3753cda7651b93c1cfa362 \
--hash=sha256:434afafd78b1d78ed0addf160ad2b77a30d35d4bdf8af234fe621919d9ed15e3
pytest==7.3.2 \
--hash=sha256:cdcbd012c9312258922f8cd3f1b62a6580fdced17db6014896053d47cddf9295 \
--hash=sha256:ee990a3cc55ba808b80795a79944756f315c67c12b56abd3ac993a7b8c17030b
# via
# -r requirements.in
# pytest-flake8-path
# pytest-randomly
pytest-flake8-path==1.3.0 \
--hash=sha256:a1f6a7f045e73b3400a59ad1a874dad39636a8d6bedef6e962396f863e05a4ac \
--hash=sha256:a3ddf053b56dbd1981f0e74ca02041e18f4e9f82435052358ffd2c147bf5a461
pytest-flake8-path==1.4.0 \
--hash=sha256:b1c21f599158c90b68a16d301d1ffa19d25c297ef22f0ca4560160065a852e8b \
--hash=sha256:c873d169e4ea5ab889413212bc33eb13d653c0e7f6c630fce6dc982076a228b7
# via -r requirements.in
pytest-randomly==3.12.0 \
--hash=sha256:d60c2db71ac319aee0fc6c4110a7597d611a8b94a5590918bfa8583f00caccb2 \
12 changes: 6 additions & 6 deletions requirements/py311.txt
Original file line number Diff line number Diff line change
@@ -32,16 +32,16 @@ pyflakes==3.0.1 \
--hash=sha256:ec55bf7fe21fff7f1ad2f7da62363d749e2a470500eab1b555334b67aa1ef8cf \
--hash=sha256:ec8b276a6b60bd80defed25add7e439881c19e64850afd9b346283d4165fd0fd
# via flake8
pytest==7.3.1 \
--hash=sha256:3799fa815351fea3a5e96ac7e503a96fa51cc9942c3753cda7651b93c1cfa362 \
--hash=sha256:434afafd78b1d78ed0addf160ad2b77a30d35d4bdf8af234fe621919d9ed15e3
pytest==7.3.2 \
--hash=sha256:cdcbd012c9312258922f8cd3f1b62a6580fdced17db6014896053d47cddf9295 \
--hash=sha256:ee990a3cc55ba808b80795a79944756f315c67c12b56abd3ac993a7b8c17030b
# via
# -r requirements.in
# pytest-flake8-path
# pytest-randomly
pytest-flake8-path==1.3.0 \
--hash=sha256:a1f6a7f045e73b3400a59ad1a874dad39636a8d6bedef6e962396f863e05a4ac \
--hash=sha256:a3ddf053b56dbd1981f0e74ca02041e18f4e9f82435052358ffd2c147bf5a461
pytest-flake8-path==1.4.0 \
--hash=sha256:b1c21f599158c90b68a16d301d1ffa19d25c297ef22f0ca4560160065a852e8b \
--hash=sha256:c873d169e4ea5ab889413212bc33eb13d653c0e7f6c630fce6dc982076a228b7
# via -r requirements.in
pytest-randomly==3.12.0 \
--hash=sha256:d60c2db71ac319aee0fc6c4110a7597d611a8b94a5590918bfa8583f00caccb2 \
6 changes: 3 additions & 3 deletions requirements/py312.txt
Original file line number Diff line number Diff line change
@@ -39,9 +39,9 @@ pytest==7.3.2 \
# -r requirements.in
# pytest-flake8-path
# pytest-randomly
pytest-flake8-path==1.3.0 \
--hash=sha256:a1f6a7f045e73b3400a59ad1a874dad39636a8d6bedef6e962396f863e05a4ac \
--hash=sha256:a3ddf053b56dbd1981f0e74ca02041e18f4e9f82435052358ffd2c147bf5a461
pytest-flake8-path==1.4.0 \
--hash=sha256:b1c21f599158c90b68a16d301d1ffa19d25c297ef22f0ca4560160065a852e8b \
--hash=sha256:c873d169e4ea5ab889413212bc33eb13d653c0e7f6c630fce6dc982076a228b7
# via -r requirements.in
pytest-randomly==3.12.0 \
--hash=sha256:d60c2db71ac319aee0fc6c4110a7597d611a8b94a5590918bfa8583f00caccb2 \
74 changes: 0 additions & 74 deletions requirements/py37.txt

This file was deleted.

12 changes: 6 additions & 6 deletions requirements/py38.txt
Original file line number Diff line number Diff line change
@@ -40,16 +40,16 @@ pyflakes==3.0.1 \
--hash=sha256:ec55bf7fe21fff7f1ad2f7da62363d749e2a470500eab1b555334b67aa1ef8cf \
--hash=sha256:ec8b276a6b60bd80defed25add7e439881c19e64850afd9b346283d4165fd0fd
# via flake8
pytest==7.3.1 \
--hash=sha256:3799fa815351fea3a5e96ac7e503a96fa51cc9942c3753cda7651b93c1cfa362 \
--hash=sha256:434afafd78b1d78ed0addf160ad2b77a30d35d4bdf8af234fe621919d9ed15e3
pytest==7.3.2 \
--hash=sha256:cdcbd012c9312258922f8cd3f1b62a6580fdced17db6014896053d47cddf9295 \
--hash=sha256:ee990a3cc55ba808b80795a79944756f315c67c12b56abd3ac993a7b8c17030b
# via
# -r requirements.in
# pytest-flake8-path
# pytest-randomly
pytest-flake8-path==1.3.0 \
--hash=sha256:a1f6a7f045e73b3400a59ad1a874dad39636a8d6bedef6e962396f863e05a4ac \
--hash=sha256:a3ddf053b56dbd1981f0e74ca02041e18f4e9f82435052358ffd2c147bf5a461
pytest-flake8-path==1.4.0 \
--hash=sha256:b1c21f599158c90b68a16d301d1ffa19d25c297ef22f0ca4560160065a852e8b \
--hash=sha256:c873d169e4ea5ab889413212bc33eb13d653c0e7f6c630fce6dc982076a228b7
# via -r requirements.in
pytest-randomly==3.12.0 \
--hash=sha256:d60c2db71ac319aee0fc6c4110a7597d611a8b94a5590918bfa8583f00caccb2 \
12 changes: 6 additions & 6 deletions requirements/py39.txt
Original file line number Diff line number Diff line change
@@ -40,16 +40,16 @@ pyflakes==3.0.1 \
--hash=sha256:ec55bf7fe21fff7f1ad2f7da62363d749e2a470500eab1b555334b67aa1ef8cf \
--hash=sha256:ec8b276a6b60bd80defed25add7e439881c19e64850afd9b346283d4165fd0fd
# via flake8
pytest==7.3.1 \
--hash=sha256:3799fa815351fea3a5e96ac7e503a96fa51cc9942c3753cda7651b93c1cfa362 \
--hash=sha256:434afafd78b1d78ed0addf160ad2b77a30d35d4bdf8af234fe621919d9ed15e3
pytest==7.3.2 \
--hash=sha256:cdcbd012c9312258922f8cd3f1b62a6580fdced17db6014896053d47cddf9295 \
--hash=sha256:ee990a3cc55ba808b80795a79944756f315c67c12b56abd3ac993a7b8c17030b
# via
# -r requirements.in
# pytest-flake8-path
# pytest-randomly
pytest-flake8-path==1.3.0 \
--hash=sha256:a1f6a7f045e73b3400a59ad1a874dad39636a8d6bedef6e962396f863e05a4ac \
--hash=sha256:a3ddf053b56dbd1981f0e74ca02041e18f4e9f82435052358ffd2c147bf5a461
pytest-flake8-path==1.4.0 \
--hash=sha256:b1c21f599158c90b68a16d301d1ffa19d25c297ef22f0ca4560160065a852e8b \
--hash=sha256:c873d169e4ea5ab889413212bc33eb13d653c0e7f6c630fce6dc982076a228b7
# via -r requirements.in
pytest-randomly==3.12.0 \
--hash=sha256:d60c2db71ac319aee0fc6c4110a7597d611a8b94a5590918bfa8583f00caccb2 \
6 changes: 2 additions & 4 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = flake8_comprehensions
version = 3.13.0
version = 3.14.0
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
@@ -17,7 +17,6 @@ classifiers =
Natural Language :: English
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
@@ -34,8 +33,7 @@ project_urls =
packages = find:
install_requires =
flake8!=3.2.0,>=3.0
importlib-metadata;python_version < "3.8"
python_requires = >=3.7
python_requires = >=3.8
include_package_data = True
package_dir =
=src
7 changes: 1 addition & 6 deletions src/flake8_comprehensions/__init__.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
from __future__ import annotations

import ast
import sys
from importlib.metadata import version
from typing import Any
from typing import Generator

if sys.version_info >= (3, 8):
from importlib.metadata import version
else:
from importlib_metadata import version


class ComprehensionChecker:
"""
17 changes: 2 additions & 15 deletions tests/test_flake8_comprehensions.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
from __future__ import annotations

import re
import sys
from importlib.metadata import version
from textwrap import dedent

import pytest

if sys.version_info >= (3, 8):
from importlib.metadata import version
else:
from importlib_metadata import version


@pytest.fixture
def flake8_path(flake8_path):
@@ -791,14 +786,6 @@ def test_C416_pass(code, flake8_path):
assert result.out_lines == []


# Column offset for list comprehensions was incorrect in Python < 3.8.
# See https://bugs.python.org/issue31241 for details.
if sys.version_info >= (3, 8):
list_comp_col_offset = 0
else:
list_comp_col_offset = 1


@pytest.mark.parametrize(
"code,failures",
[
@@ -819,7 +806,7 @@ def test_C416_pass(code, flake8_path):
(
"[x for x in range(5)]",
[
f"./example.py:1:{1 + list_comp_col_offset}: C416 Unnecessary "
"./example.py:1:1: C416 Unnecessary "
+ "list comprehension - rewrite using list()."
],
),
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
requires =
tox>=4.2
env_list =
py{312, 311, 310, 39, 38, 37}
py{312, 311, 310, 39, 38}

[testenv]
package = wheel