From e9cd4055dd0bbcdaa81d6153b9fb4da5eaabfc46 Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Sun, 29 Sep 2024 11:52:52 +0200 Subject: [PATCH 1/5] Disable ruff/Pyflakes preview rule F841 F841 Local variable is assigned to but never used --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 4d8d1181697..67d1c4d8d64 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -165,6 +165,7 @@ ignore = [ "B020", "B904", # Ruff enables opinionated warnings by default "B905", # Ruff enables opinionated warnings by default + "F841", ] select = [ "ASYNC", From 0d74b4cbc05a6aa3ee6fcac3006052f0cd6da1d9 Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Sun, 29 Sep 2024 11:54:49 +0200 Subject: [PATCH 2/5] Disable ruff/pycodestyle preview rule E226 E226 Missing whitespace around arithmetic operator --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 67d1c4d8d64..d7754d3b39d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -165,6 +165,7 @@ ignore = [ "B020", "B904", # Ruff enables opinionated warnings by default "B905", # Ruff enables opinionated warnings by default + "E226", "F841", ] select = [ From 5087faa356ea36a272e14a573e4fa466619bcbb2 Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Sat, 28 Sep 2024 20:23:07 +0200 Subject: [PATCH 3/5] Apply ruff/pycodestyle preview rule E262 E262 Inline comment should start with `# ` --- tests/unit/test_vcs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/test_vcs.py b/tests/unit/test_vcs.py index 13ef42fc43f..81843334615 100644 --- a/tests/unit/test_vcs.py +++ b/tests/unit/test_vcs.py @@ -604,7 +604,7 @@ def test_get_git_version() -> None: ("git version 2.17", (2, 17)), ("git version 2.18.1", (2, 18)), ("git version 2.35.GIT", (2, 35)), # gh:12280 - ("oh my git version 2.37.GIT", ()), # invalid version + ("oh my git version 2.37.GIT", ()), # invalid version ("git version 2.GIT", ()), # invalid version ], ) From e0c405e123e63282da1031231152f6e25556156f Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Sat, 28 Sep 2024 20:31:54 +0200 Subject: [PATCH 4/5] Apply ruff/flake8-comprehensions preview rule C419 C419 Unnecessary list comprehension --- src/pip/_internal/commands/search.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/pip/_internal/commands/search.py b/src/pip/_internal/commands/search.py index 74b8d656b47..26bfde63768 100644 --- a/src/pip/_internal/commands/search.py +++ b/src/pip/_internal/commands/search.py @@ -140,10 +140,8 @@ def print_results( if name_column_width is None: name_column_width = ( max( - [ - len(hit["name"]) + len(highest_version(hit.get("versions", ["-"]))) - for hit in hits - ] + len(hit["name"]) + len(highest_version(hit.get("versions", ["-"]))) + for hit in hits ) + 4 ) From d19be363e77552aa2780689ecf91d95da4265b18 Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Sat, 28 Sep 2024 20:33:22 +0200 Subject: [PATCH 5/5] Apply ruff/flake8-comprehensions preview rule C420 C420 Unnecessary dict comprehension for iterable; use `dict.fromkeys` instead --- src/pip/_internal/locations/_sysconfig.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pip/_internal/locations/_sysconfig.py b/src/pip/_internal/locations/_sysconfig.py index ca860ea562c..efc3cbadcf2 100644 --- a/src/pip/_internal/locations/_sysconfig.py +++ b/src/pip/_internal/locations/_sysconfig.py @@ -161,9 +161,9 @@ def get_scheme( scheme_name = "posix_prefix" if home is not None: - variables = {k: home for k in _HOME_KEYS} + variables = dict.fromkeys(_HOME_KEYS, home) elif prefix is not None: - variables = {k: prefix for k in _HOME_KEYS} + variables = dict.fromkeys(_HOME_KEYS, prefix) else: variables = {}