Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump flake8 additional dependencies #5662

Merged
merged 3 commits into from May 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 9 additions & 9 deletions .pre-commit-config.yaml
Expand Up @@ -31,17 +31,17 @@ repos:
hooks:
- id: yesqa
additional_dependencies: &flake8_deps
- flake8-annotations==2.7.0
- flake8-annotations==2.9.0
- flake8-broken-line==0.4.0
- flake8-bugbear==21.9.2
- flake8-comprehensions==3.7.0
- flake8-eradicate==1.2.0
- flake8-no-pep420==1.2.0
- flake8-bugbear==22.4.25
- flake8-comprehensions==3.10.0
- flake8-eradicate==1.2.1
- flake8-no-pep420==2.3.0
- flake8-quotes==3.3.1
- flake8-simplify==0.14.2
- flake8-tidy-imports==4.5.0
- flake8-type-checking==1.1.0
- flake8-typing-imports==1.11.0
- flake8-simplify==0.19.2
- flake8-tidy-imports==4.8.0
- flake8-type-checking==1.5.0
- flake8-typing-imports==1.12.0
- flake8-use-fstring==1.3
- pep8-naming==0.12.1

Expand Down
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
8 changes: 4 additions & 4 deletions src/poetry/mixology/term.py
Expand Up @@ -23,6 +23,8 @@ class Term:
def __init__(self, dependency: Dependency, is_positive: bool) -> None:
self._dependency = dependency
self._positive = is_positive
self.relation = functools.lru_cache(maxsize=None)(self._relation)
self.intersect = functools.lru_cache(maxsize=None)(self._intersect)

@property
def inverse(self) -> Term:
Expand All @@ -48,8 +50,7 @@ def satisfies(self, other: Term) -> bool:
and self.relation(other) == SetRelation.SUBSET
)

@functools.lru_cache(maxsize=None)
def relation(self, other: Term) -> str:
def _relation(self, other: Term) -> str:
"""
Returns the relationship between the package versions
allowed by this term and another.
Expand Down Expand Up @@ -111,8 +112,7 @@ def relation(self, other: Term) -> str:
# not foo ^1.5.0 is a superset of not foo ^1.0.0
return SetRelation.OVERLAPPING

@functools.lru_cache(maxsize=None)
def intersect(self, other: Term) -> Term | None:
def _intersect(self, other: Term) -> Term | None:
"""
Returns a Term that represents the packages
allowed by both this term and another
Expand Down
8 changes: 5 additions & 3 deletions src/poetry/utils/authenticator.py
Expand Up @@ -104,6 +104,9 @@ def __init__(
if not disable_cache
else None
)
self.get_repository_config_for_url = functools.lru_cache(maxsize=None)(
self._get_repository_config_for_url
)

@property
def cache(self) -> FileCache | None:
Expand Down Expand Up @@ -351,8 +354,7 @@ def get_certs_for_url(self, url: str) -> dict[str, Path | None]:
self._certs[url] = self._get_certs_for_url(url)
return self._certs[url]

@functools.lru_cache(maxsize=None)
def get_repository_config_for_url(
def _get_repository_config_for_url(
self, url: str, exact_match: bool = False
) -> AuthenticatorRepositoryConfig | None:
parsed_url = urllib.parse.urlsplit(url)
Expand Down Expand Up @@ -384,7 +386,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