mirror of
https://github.com/pypa/pip
synced 2023-12-13 21:30:23 +01:00
Fix issues raised in code review
This commit is contained in:
parent
69a1e956da
commit
0a24a001fb
7 changed files with 9 additions and 13 deletions
|
@ -116,6 +116,7 @@ max-complexity = 33 # default is 10
|
|||
"noxfile.py" = ["G"]
|
||||
"src/pip/_internal/*" = ["PERF203"]
|
||||
"tests/*" = ["B011"]
|
||||
"tests/unit/test_finder.py" = ["C414"]
|
||||
|
||||
[tool.ruff.pylint]
|
||||
max-args = 15 # default is 5
|
||||
|
|
|
@ -134,10 +134,7 @@ def show_tags(options: Values) -> None:
|
|||
|
||||
|
||||
def ca_bundle_info(config: Configuration) -> str:
|
||||
levels = set()
|
||||
for key, _ in config.items(): # noqa: PERF102 Configuration has no keys() method.
|
||||
levels.add(key.split(".")[0])
|
||||
|
||||
levels = {key.split(".")[0] for key, _ in config.items()} # noqa: PERF102
|
||||
if not levels:
|
||||
return "Not specified"
|
||||
|
||||
|
|
|
@ -297,7 +297,7 @@ class ListCommand(IndexGroupCommand):
|
|||
|
||||
# Create and add a separator.
|
||||
if len(data) > 0:
|
||||
pkg_strings.insert(1, " ".join(("-" * x for x in sizes)))
|
||||
pkg_strings.insert(1, " ".join("-" * x for x in sizes))
|
||||
|
||||
for val in pkg_strings:
|
||||
write_output(val)
|
||||
|
|
|
@ -101,7 +101,7 @@ def list_matches_wheel(wheel_name: str, result: TestPipResult) -> bool:
|
|||
`- foo-1.2.3-py3-none-any.whl `."""
|
||||
lines = result.stdout.splitlines()
|
||||
expected = f" - {wheel_name}-py3-none-any.whl "
|
||||
return any((line.startswith(expected) for line in lines))
|
||||
return any(line.startswith(expected) for line in lines)
|
||||
|
||||
|
||||
def list_matches_wheel_abspath(wheel_name: str, result: TestPipResult) -> bool:
|
||||
|
|
|
@ -795,10 +795,8 @@ def diff_states(
|
|||
prefix = prefix.rstrip(os.path.sep) + os.path.sep
|
||||
return path.startswith(prefix)
|
||||
|
||||
start_keys = {
|
||||
k for k in start.keys() if not any(prefix_match(k, i) for i in ignore)
|
||||
}
|
||||
end_keys = {k for k in end.keys() if not any(prefix_match(k, i) for i in ignore)}
|
||||
start_keys = {k for k in start if not any(prefix_match(k, i) for i in ignore)}
|
||||
end_keys = {k for k in end if not any(prefix_match(k, i) for i in ignore)}
|
||||
deleted = {k: start[k] for k in start_keys.difference(end_keys)}
|
||||
created = {k: end[k] for k in end_keys.difference(start_keys)}
|
||||
updated = {}
|
||||
|
|
|
@ -234,7 +234,7 @@ class TestCandidateEvaluator:
|
|||
)
|
||||
sort_key = evaluator._sort_key
|
||||
results = sorted(links, key=sort_key, reverse=True)
|
||||
results2 = sorted(links, key=sort_key, reverse=True)
|
||||
results2 = sorted(reversed(links), key=sort_key, reverse=True)
|
||||
|
||||
assert links == results, results
|
||||
assert links == results2, results2
|
||||
|
@ -261,7 +261,7 @@ class TestCandidateEvaluator:
|
|||
candidate_evaluator = CandidateEvaluator.create("my-project")
|
||||
sort_key = candidate_evaluator._sort_key
|
||||
results = sorted(links, key=sort_key, reverse=True)
|
||||
results2 = sorted(links, key=sort_key, reverse=True)
|
||||
results2 = sorted(reversed(links), key=sort_key, reverse=True)
|
||||
|
||||
assert links == results, results
|
||||
assert links == results2, results2
|
||||
|
@ -301,7 +301,7 @@ class TestCandidateEvaluator:
|
|||
)
|
||||
sort_key = evaluator._sort_key
|
||||
results = sorted(links, key=sort_key, reverse=True)
|
||||
results2 = sorted(links, key=sort_key, reverse=True)
|
||||
results2 = sorted(reversed(links), key=sort_key, reverse=True)
|
||||
|
||||
assert links == results, results
|
||||
assert links == results2, results2
|
||||
|
|
Loading…
Reference in a new issue