diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index dfc06e64968..347d6a91f12 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -31,6 +31,6 @@ repos: - id: validate_manifest - repo: /~https://github.com/astral-sh/ruff-pre-commit - rev: v0.0.278 + rev: v0.0.280 hooks: - id: ruff diff --git a/src/poetry/mixology/incompatibility.py b/src/poetry/mixology/incompatibility.py index 8ac85731a17..26bf72e79ba 100644 --- a/src/poetry/mixology/incompatibility.py +++ b/src/poetry/mixology/incompatibility.py @@ -196,7 +196,7 @@ def __str__(self) -> str: if len(positive) != 1: return f"if {' and '.join(positive)} then {' or '.join(negative)}" - positive_term = [term for term in self._terms if term.is_positive()][0] + positive_term = next(term for term in self._terms if term.is_positive()) return ( f"{self._terse(positive_term, allow_every=True)} requires" f" {' or '.join(negative)}" diff --git a/tests/puzzle/test_solver.py b/tests/puzzle/test_solver.py index 61fefa59542..125b29511fb 100644 --- a/tests/puzzle/test_solver.py +++ b/tests/puzzle/test_solver.py @@ -2233,7 +2233,7 @@ def test_solver_can_resolve_git_dependencies_with_ref( "0.1.2", source_type="git", source_url="/~https://github.com/demo/demo.git", - source_reference=ref[list(ref.keys())[0]], + source_reference=ref[next(iter(ref.keys()))], source_resolved_reference=MOCK_DEFAULT_GIT_REVISION, ) @@ -2253,7 +2253,7 @@ def test_solver_can_resolve_git_dependencies_with_ref( op = ops[1] assert op.package.source_type == "git" - assert op.package.source_reference == ref[list(ref.keys())[0]] + assert op.package.source_reference == ref[next(iter(ref.keys()))] assert op.package.source_resolved_reference is not None assert op.package.source_resolved_reference.startswith("9cf87a2") diff --git a/tests/repositories/conftest.py b/tests/repositories/conftest.py index db676c6d90c..2661b46fc20 100644 --- a/tests/repositories/conftest.py +++ b/tests/repositories/conftest.py @@ -13,7 +13,7 @@ def html_page_content() -> HTMLPageGetter: def _fixture(content: str, base_url: str | None = None) -> str: base = f' @@ -26,6 +26,6 @@ def _fixture(content: str, base_url: str | None = None) -> str: {content} - """.format(content=content, base=base) + """ return _fixture diff --git a/tests/repositories/link_sources/test_html.py b/tests/repositories/link_sources/test_html.py index 2be9f6b3a13..e39edcae034 100644 --- a/tests/repositories/link_sources/test_html.py +++ b/tests/repositories/link_sources/test_html.py @@ -53,7 +53,7 @@ def test_link_attributes( page = HTMLPage("https://example.org", content) assert len(list(page.links)) == 1 - link = list(page.links)[0] + link = next(iter(page.links)) assert link.url == expected_link.url assert link.requires_python == expected_link.requires_python assert link.yanked == expected_link.yanked @@ -111,5 +111,5 @@ def test_base_url( ) -> None: content = html_page_content(anchor, base_url) page = HTMLPage("https://example.org", content) - link = list(page.links)[0] + link = next(iter(page.links)) assert link.url == expected