Commit 85b29df0 by Daniel Eades Committed by Arun Babu Neelicattu

use flake8-bugbear for linting

parent ee67aa8c
......@@ -8,6 +8,7 @@ repos:
rev: 3.8.4
hooks:
- id: flake8
additional_dependencies: [flake8-bugbear]
- repo: https://github.com/timothycrosley/isort
rev: 5.7.0
......
......@@ -52,7 +52,7 @@ class CacheClearCommand(Command):
# Calculate number of entries
entries_count = 0
for path, dirs, files in os.walk(str(cache_dir)):
for _path, _dirs, files in os.walk(str(cache_dir)):
entries_count += len(files)
delete = self.confirm(
......
......@@ -618,8 +618,8 @@ class Provider:
# - {<Package foo (1.2.3): {"bar": <Dependency bar (>=2.0)>}
# - {<Package foo (1.2.3): {"bar": <Dependency bar (<2.0)>}
markers = []
for constraint, _deps in by_constraint.items():
markers.append(_deps[0].marker)
for deps in by_constraint.values():
markers.append(deps[0].marker)
_deps = [_dep[0] for _dep in by_constraint.values()]
self.debug(
......
......@@ -138,7 +138,7 @@ class Pool(BaseRepository):
except PackageNotFound:
pass
else:
for idx, repo in enumerate(self._repositories):
for repo in self._repositories:
try:
package = repo.package(name, version, extras=extras)
except PackageNotFound:
......
......@@ -1487,8 +1487,8 @@ class SystemEnv(Env):
paths[key] = getattr(obj, f"install_{key}")
if site.check_enableusersite() and hasattr(obj, "install_usersite"):
paths["usersite"] = getattr(obj, "install_usersite")
paths["userbase"] = getattr(obj, "install_userbase")
paths["usersite"] = obj.install_usersite
paths["userbase"] = obj.install_userbase
return paths
......
......@@ -82,7 +82,7 @@ def safe_rmtree(path: str) -> None:
def merge_dicts(d1: Dict, d2: Dict) -> None:
for k, v in d2.items():
for k in d2.keys():
if k in d1 and isinstance(d1[k], dict) and isinstance(d2[k], Mapping):
merge_dicts(d1[k], d2[k])
else:
......
......@@ -159,7 +159,7 @@ class MakeReleaseCommand(Command):
fileobj=gz,
format=tarfile.PAX_FORMAT,
) as tar:
for root, dirs, files in os.walk(tmp_dir):
for root, _dirs, files in os.walk(tmp_dir):
for f in files:
if f.endswith(".pyc"):
continue
......
......@@ -5,11 +5,14 @@ from typing import Union
from poetry.core.semver.version import Version
def build_venv(path: Union[Path, str], **_: Any) -> ():
VERSION_3_7_1 = Version.parse("3.7.1")
def build_venv(path: Union[Path, str], **_: Any) -> None:
Path(path).mkdir(parents=True, exist_ok=True)
def check_output_wrapper(version=Version.parse("3.7.1")):
def check_output_wrapper(version=VERSION_3_7_1):
def check_output(cmd, *_, **__):
if "sys.version_info[:3]" in cmd:
return version.text
......
......@@ -191,7 +191,7 @@ def test_pypi_repository_supports_reading_bz2_files():
]
}
for name, deps in expected_extras.items():
for name in expected_extras.keys():
assert expected_extras[name] == sorted(
package.extras[name], key=lambda r: r.name
)
......
......@@ -120,11 +120,14 @@ def test_env_get_venv_with_venv_folder_present(
assert venv.path == in_project_venv_dir
def build_venv(path: Union[Path, str], **__: Any) -> ():
def build_venv(path: Union[Path, str], **__: Any) -> None:
os.mkdir(str(path))
def check_output_wrapper(version=Version.parse("3.7.1")):
VERSION_3_7_1 = Version.parse("3.7.1")
def check_output_wrapper(version=VERSION_3_7_1):
def check_output(cmd, *args, **kwargs):
if "sys.version_info[:3]" in cmd:
return version.text
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment