diff --git a/.flake8 b/.flake8 index 29717a641..23a4abf33 100644 --- a/.flake8 +++ b/.flake8 @@ -2,9 +2,12 @@ min_python_version = 3.7.0 max-line-length = 88 ban-relative-imports = True +# flake8-use-fstring: https://github.com/MichaelKim0407/flake8-use-fstring#--percent-greedy-and---format-greedy +format-greedy = 1 +inline-quotes = double enable-extensions = TC, TC1 type-checking-exempt-modules = typing, typing-extensions -format-greedy = 1 +eradicate-whitelist-extend = ^-.*; extend-ignore = # E203: Whitespace before ':' (pycqa/pycodestyle#373) E203, @@ -19,15 +22,7 @@ extend-ignore = per-file-ignores = tests/test_*:ANN201 tests/**/test_*:ANN201 -exclude = - .git - __pycache__ - build - dist - .venv - .tox - .pytest_cache - .github +extend-exclude = src/poetry/core/_vendor/* tests/fixtures/* tests/**/fixtures/* diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9b10a2a97..eac30e92a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -39,13 +39,17 @@ repos: - id: yesqa additional_dependencies: &flake8_deps - flake8-annotations==2.9.0 - - flake8-bugbear==22.4.25 + - flake8-broken-line==0.4.0 + - flake8-bugbear==22.7.1 - flake8-comprehensions==3.10.0 - flake8-eradicate==1.2.1 - - flake8-simplify==0.19.2 + - flake8-quotes==3.3.1 + - flake8-simplify==0.19.3 - flake8-tidy-imports==4.8.0 - - flake8-type-checking==1.5.0 - - flake8-use-fstring==1.3 + - flake8-type-checking==2.1.0 + - flake8-typing-imports==1.12.0 + - flake8-use-fstring==1.4 + - pep8-naming==0.13.1 - repo: https://github.com/asottile/pyupgrade rev: v2.37.2 diff --git a/src/poetry/core/masonry/builders/sdist.py b/src/poetry/core/masonry/builders/sdist.py index e6fc9b76e..7aa1e3313 100644 --- a/src/poetry/core/masonry/builders/sdist.py +++ b/src/poetry/core/masonry/builders/sdist.py @@ -13,7 +13,6 @@ from pathlib import Path from posixpath import join as pjoin from pprint import pformat -from tarfile import TarInfo from typing import TYPE_CHECKING from typing import Iterator @@ -22,6 +21,8 @@ if TYPE_CHECKING: + from tarfile import TarInfo + from poetry.core.masonry.utils.package_include import PackageInclude from poetry.core.packages.dependency import Dependency from poetry.core.packages.project_package import ProjectPackage diff --git a/src/poetry/core/packages/utils/utils.py b/src/poetry/core/packages/utils/utils.py index 5aed5b0c9..74a119e84 100644 --- a/src/poetry/core/packages/utils/utils.py +++ b/src/poetry/core/packages/utils/utils.py @@ -40,7 +40,7 @@ SUPPORTED_EXTENSIONS: tuple[str, ...] = ZIP_EXTENSIONS + TAR_EXTENSIONS try: - import bz2 # noqa: F401, TC002 + import bz2 # noqa: F401 SUPPORTED_EXTENSIONS += BZ2_EXTENSIONS except ImportError: @@ -48,7 +48,7 @@ try: # Only for Python 3.3+ - import lzma # noqa: F401, TC002 + import lzma # noqa: F401 SUPPORTED_EXTENSIONS += XZ_EXTENSIONS except ImportError: diff --git a/tests/packages/test_file_dependency.py b/tests/packages/test_file_dependency.py index e29479b63..c0db558dd 100644 --- a/tests/packages/test_file_dependency.py +++ b/tests/packages/test_file_dependency.py @@ -33,14 +33,14 @@ def test_file_dependency_dir() -> None: def test_default_hash() -> None: path = DIST_PATH / TEST_FILE dep = FileDependency("demo", path) - SHA_256 = "72e8531e49038c5f9c4a837b088bfcb8011f4a9f76335c8f0654df6ac539b3d6" - assert dep.hash() == SHA_256 + sha_256 = "72e8531e49038c5f9c4a837b088bfcb8011f4a9f76335c8f0654df6ac539b3d6" + assert dep.hash() == sha_256 try: - from hashlib import algorithms_guaranteed as ALGORITHMS_GUARANTEED + from hashlib import algorithms_guaranteed except ImportError: - ALGORITHMS_GUARANTEED = {"md5", "sha1", "sha224", "sha256", "sha384", "sha512"} + algorithms_guaranteed = {"md5", "sha1", "sha224", "sha256", "sha384", "sha512"} @pytest.mark.parametrize( @@ -84,7 +84,7 @@ def test_default_hash() -> None: "ba3d2a964b0680b6dc9565a03952e29c294c785d5a2307d3e2d785d73b75ed7e", ), ] - if hash_name in ALGORITHMS_GUARANTEED + if hash_name in algorithms_guaranteed ], ) def test_guaranteed_hash(hash_name: str, expected: str) -> None: