Skip to content

Commit

Permalink
refactor: remove unnecessary maps to respect C417
Browse files Browse the repository at this point in the history
  • Loading branch information
mkniewallner committed May 22, 2022
1 parent c880fcf commit b1a6ef5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/poetry/console/commands/source/show.py
Expand Up @@ -26,7 +26,7 @@ def handle(self) -> int | None:
self.line("No sources configured for this project.")
return 0

if names and not any(map(lambda s: s.name in names, sources)):
if names and not any(s.name in names for s in sources):
self.line_error(f"No source found with name(s): {', '.join(names)}")
return 1

Expand Down
2 changes: 1 addition & 1 deletion src/poetry/utils/authenticator.py
Expand Up @@ -384,7 +384,7 @@ def get_repository_config_for_url(
logger.debug(
"Multiple source configurations found for %s - %s",
parsed_url.netloc,
", ".join(map(lambda c: c.name, candidates)),
", ".join(c.name for c in candidates),
)
# prefer the more specific path
candidates.sort(
Expand Down
21 changes: 9 additions & 12 deletions tests/console/commands/source/test_show.py
Expand Up @@ -41,10 +41,9 @@ def test_source_show_simple(tester: CommandTester):
default : no
secondary : no
""".splitlines()
assert (
list(map(lambda l: l.strip(), tester.io.fetch_output().strip().splitlines()))
== expected
)
assert [
line.strip() for line in tester.io.fetch_output().strip().splitlines()
] == expected
assert tester.status_code == 0


Expand All @@ -57,10 +56,9 @@ def test_source_show_one(tester: CommandTester, source_one: Source):
default : no
secondary : no
""".splitlines()
assert (
list(map(lambda l: l.strip(), tester.io.fetch_output().strip().splitlines()))
== expected
)
assert [
line.strip() for line in tester.io.fetch_output().strip().splitlines()
] == expected
assert tester.status_code == 0


Expand All @@ -78,10 +76,9 @@ def test_source_show_two(tester: CommandTester, source_one: Source, source_two:
default : no
secondary : no
""".splitlines()
assert (
list(map(lambda l: l.strip(), tester.io.fetch_output().strip().splitlines()))
== expected
)
assert [
line.strip() for line in tester.io.fetch_output().strip().splitlines()
] == expected
assert tester.status_code == 0


Expand Down

0 comments on commit b1a6ef5

Please sign in to comment.