Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (#8806)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
pre-commit-ci[bot] authored Dec 19, 2023
1 parent 2963d74 commit 6f85605
Show file tree
Hide file tree
Showing 15 changed files with 203 additions and 229 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ repos:
- id: check-docstring-first

- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.11.0
rev: 23.12.0
hooks:
- id: black
exclude: tests/([^/]*/)*fixtures/
Expand All @@ -32,6 +32,6 @@ repos:
- id: validate_manifest

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.7
rev: v0.1.8
hooks:
- id: ruff
12 changes: 5 additions & 7 deletions src/poetry/installation/chef.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,11 @@ class ChefBuildError(ChefError): ...

class ChefInstallError(ChefError):
def __init__(self, requirements: Collection[str], output: str, error: str) -> None:
message = "\n\n".join(
(
f"Failed to install {', '.join(requirements)}.",
f"Output:\n{output}",
f"Error:\n{error}",
)
)
message = "\n\n".join((
f"Failed to install {', '.join(requirements)}.",
f"Output:\n{output}",
f"Error:\n{error}",
))
super().__init__(message)
self._requirements = requirements

Expand Down
18 changes: 9 additions & 9 deletions src/poetry/mixology/incompatibility.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,13 +255,13 @@ def _try_requires_both(
if this_positive.dependency != other_positive.dependency:
return None

this_negatives = " or ".join([
self._terse(term) for term in self._terms if not term.is_positive()
])
this_negatives = " or ".join(
[self._terse(term) for term in self._terms if not term.is_positive()]
)

other_negatives = " or ".join([
self._terse(term) for term in other.terms if not term.is_positive()
])
other_negatives = " or ".join(
[self._terse(term) for term in other.terms if not term.is_positive()]
)

buffer = [self._terse(this_positive, allow_every=True) + " "]
is_dependency = isinstance(self.cause, DependencyCause) and isinstance(
Expand Down Expand Up @@ -355,9 +355,9 @@ def _try_requires_through(
buffer.append("requires ")

buffer.append(
" or ".join([
self._terse(term) for term in latter.terms if not term.is_positive()
])
" or ".join(
[self._terse(term) for term in latter.terms if not term.is_positive()]
)
)

if latter_line is not None:
Expand Down
10 changes: 4 additions & 6 deletions src/poetry/puzzle/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,12 +347,10 @@ def _search_for_file(self, dependency: FileDependency) -> Package:
if dependency.base is not None:
package.root_dir = dependency.base

package.files = [
{
"file": dependency.path.name,
"hash": "sha256:" + get_file_hash(dependency.full_path),
}
]
package.files = [{
"file": dependency.path.name,
"hash": "sha256:" + get_file_hash(dependency.full_path),
}]

return package

Expand Down
36 changes: 15 additions & 21 deletions tests/console/commands/self/test_show_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,10 @@ def mock_metadata_entry_points(
@pytest.mark.parametrize("entry_point_name", ["poetry-plugin", "not-package-name"])
@pytest.mark.parametrize(
"entry_point_values_by_group",
[
{
ApplicationPlugin.group: ["FirstApplicationPlugin"],
Plugin.group: ["FirstPlugin"],
}
],
[{
ApplicationPlugin.group: ["FirstApplicationPlugin"],
Plugin.group: ["FirstPlugin"],
}],
)
def test_show_displays_installed_plugins(
app: PoetryTestApplication,
Expand All @@ -170,15 +168,13 @@ def test_show_displays_installed_plugins(

@pytest.mark.parametrize(
"entry_point_values_by_group",
[
{
ApplicationPlugin.group: [
"FirstApplicationPlugin",
"SecondApplicationPlugin",
],
Plugin.group: ["FirstPlugin", "SecondPlugin"],
}
],
[{
ApplicationPlugin.group: [
"FirstApplicationPlugin",
"SecondApplicationPlugin",
],
Plugin.group: ["FirstPlugin", "SecondPlugin"],
}],
)
def test_show_displays_installed_plugins_with_multiple_plugins(
app: PoetryTestApplication,
Expand All @@ -199,12 +195,10 @@ def test_show_displays_installed_plugins_with_multiple_plugins(
)
@pytest.mark.parametrize(
"entry_point_values_by_group",
[
{
ApplicationPlugin.group: ["FirstApplicationPlugin"],
Plugin.group: ["FirstPlugin"],
}
],
[{
ApplicationPlugin.group: ["FirstApplicationPlugin"],
Plugin.group: ["FirstPlugin"],
}],
)
def test_show_displays_installed_plugins_with_dependencies(
app: PoetryTestApplication,
Expand Down
28 changes: 13 additions & 15 deletions tests/console/commands/test_show.py
Original file line number Diff line number Diff line change
Expand Up @@ -2026,21 +2026,19 @@ def test_url_dependency_is_not_outdated_by_repository_package(

assert isinstance(poetry.locker, TestLocker)
poetry.locker.mock_lock_data({
"package": [
{
"name": "demo",
"version": "0.1.0",
"description": "Demo package",
"optional": False,
"platform": "*",
"python-versions": "*",
"checksum": [],
"source": {
"type": "url",
"url": demo_url,
},
}
],
"package": [{
"name": "demo",
"version": "0.1.0",
"description": "Demo package",
"optional": False,
"platform": "*",
"python-versions": "*",
"checksum": [],
"source": {
"type": "url",
"url": demo_url,
},
}],
"metadata": {
"python-versions": "*",
"platform": "*",
Expand Down
48 changes: 24 additions & 24 deletions tests/installation/test_chooser.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,12 +275,12 @@ def test_chooser_chooses_distributions_that_match_the_package_hashes(
chooser = Chooser(pool, env)

package = Package("isort", "4.3.4")
files = [
{
"hash": "sha256:b9c40e9750f3d77e6e4d441d8b0266cf555e7cdabdcff33c4fd06366ca761ef8",
"filename": "isort-4.3.4.tar.gz",
}
]
files = [{
"hash": (
"sha256:b9c40e9750f3d77e6e4d441d8b0266cf555e7cdabdcff33c4fd06366ca761ef8"
),
"filename": "isort-4.3.4.tar.gz",
}]
if source_type == "legacy":
package = Package(
package.name,
Expand Down Expand Up @@ -308,12 +308,12 @@ def test_chooser_chooses_yanked_if_no_others(
chooser = Chooser(pool, env)

package = Package("black", "21.11b0")
files = [
{
"filename": "black-21.11b0-py3-none-any.whl",
"hash": "sha256:0b1f66cbfadcd332ceeaeecf6373d9991d451868d2e2219ad0ac1213fb701117",
}
]
files = [{
"filename": "black-21.11b0-py3-none-any.whl",
"hash": (
"sha256:0b1f66cbfadcd332ceeaeecf6373d9991d451868d2e2219ad0ac1213fb701117"
),
}]
if source_type == "legacy":
package = Package(
package.name,
Expand Down Expand Up @@ -385,12 +385,12 @@ def test_chooser_throws_an_error_if_package_hashes_do_not_match(
chooser = Chooser(pool, env)

package = Package("isort", "4.3.4")
files = [
{
"hash": "sha256:0000000000000000000000000000000000000000000000000000000000000000",
"filename": "isort-4.3.4.tar.gz",
}
]
files = [{
"hash": (
"sha256:0000000000000000000000000000000000000000000000000000000000000000"
),
"filename": "isort-4.3.4.tar.gz",
}]
if source_type == "legacy":
package = Package(
package.name,
Expand Down Expand Up @@ -419,11 +419,11 @@ def test_chooser_md5_remote_fallback_to_sha256_inline_calculation(
source_reference="foo",
source_url="https://foo.bar/simple/",
)
package.files = [
{
"hash": "sha256:9fa123ad707a5c6c944743bf3e11a0e80d86cb518d3cf25320866ca3ef43e2ad",
"filename": "demo-0.1.0.tar.gz",
}
]
package.files = [{
"hash": (
"sha256:9fa123ad707a5c6c944743bf3e11a0e80d86cb518d3cf25320866ca3ef43e2ad"
),
"filename": "demo-0.1.0.tar.gz",
}]
res = chooser.choose_for(package)
assert res.filename == "demo-0.1.0.tar.gz"
66 changes: 33 additions & 33 deletions tests/installation/test_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,9 +372,9 @@ def test_execute_shows_skipped_operations_if_verbose(
executor.verbose()

assert (
executor.execute([
Uninstall(Package("clikit", "0.2.3")).skip("Not currently installed")
])
executor.execute(
[Uninstall(Package("clikit", "0.2.3")).skip("Not currently installed")]
)
== 0
)

Expand Down Expand Up @@ -626,12 +626,12 @@ def test_executor_should_not_write_pep610_url_references_for_cached_package(
io: BufferedIO,
) -> None:
link_cached = fixture_dir("distributions") / "demo-0.1.0-py2.py3-none-any.whl"
package.files = [
{
"file": "demo-0.1.0-py2.py3-none-any.whl",
"hash": "sha256:70e704135718fffbcbf61ed1fc45933cfd86951a744b681000eaaa75da31f17a",
}
]
package.files = [{
"file": "demo-0.1.0-py2.py3-none-any.whl",
"hash": (
"sha256:70e704135718fffbcbf61ed1fc45933cfd86951a744b681000eaaa75da31f17a"
),
}]

mocker.patch(
"poetry.installation.executor.Executor._download", return_value=link_cached
Expand All @@ -653,12 +653,12 @@ def test_executor_should_write_pep610_url_references_for_wheel_files(
url = (fixture_dir("distributions") / "demo-0.1.0-py2.py3-none-any.whl").resolve()
package = Package("demo", "0.1.0", source_type="file", source_url=url.as_posix())
# Set package.files so the executor will attempt to hash the package
package.files = [
{
"file": "demo-0.1.0-py2.py3-none-any.whl",
"hash": "sha256:70e704135718fffbcbf61ed1fc45933cfd86951a744b681000eaaa75da31f17a",
}
]
package.files = [{
"file": "demo-0.1.0-py2.py3-none-any.whl",
"hash": (
"sha256:70e704135718fffbcbf61ed1fc45933cfd86951a744b681000eaaa75da31f17a"
),
}]

executor = Executor(tmp_venv, pool, config, io)
executor.execute([Install(package)])
Expand Down Expand Up @@ -687,12 +687,12 @@ def test_executor_should_write_pep610_url_references_for_non_wheel_files(
url = (fixture_dir("distributions") / "demo-0.1.0.tar.gz").resolve()
package = Package("demo", "0.1.0", source_type="file", source_url=url.as_posix())
# Set package.files so the executor will attempt to hash the package
package.files = [
{
"file": "demo-0.1.0.tar.gz",
"hash": "sha256:9fa123ad707a5c6c944743bf3e11a0e80d86cb518d3cf25320866ca3ef43e2ad",
}
]
package.files = [{
"file": "demo-0.1.0.tar.gz",
"hash": (
"sha256:9fa123ad707a5c6c944743bf3e11a0e80d86cb518d3cf25320866ca3ef43e2ad"
),
}]

executor = Executor(tmp_venv, pool, config, io)
executor.execute([Install(package)])
Expand Down Expand Up @@ -796,12 +796,12 @@ def test_executor_should_write_pep610_url_references_for_wheel_urls(
source_url="https://files.pythonhosted.org/demo-0.1.0-py2.py3-none-any.whl",
)
# Set package.files so the executor will attempt to hash the package
package.files = [
{
"file": "demo-0.1.0-py2.py3-none-any.whl",
"hash": "sha256:70e704135718fffbcbf61ed1fc45933cfd86951a744b681000eaaa75da31f17a",
}
]
package.files = [{
"file": "demo-0.1.0-py2.py3-none-any.whl",
"hash": (
"sha256:70e704135718fffbcbf61ed1fc45933cfd86951a744b681000eaaa75da31f17a"
),
}]

executor = Executor(tmp_venv, pool, config, io)
operation = Install(package)
Expand Down Expand Up @@ -890,12 +890,12 @@ def mock_get_cached_archive_func(
source_url="https://files.pythonhosted.org/demo-0.1.0.tar.gz",
)
# Set package.files so the executor will attempt to hash the package
package.files = [
{
"file": "demo-0.1.0.tar.gz",
"hash": "sha256:9fa123ad707a5c6c944743bf3e11a0e80d86cb518d3cf25320866ca3ef43e2ad",
}
]
package.files = [{
"file": "demo-0.1.0.tar.gz",
"hash": (
"sha256:9fa123ad707a5c6c944743bf3e11a0e80d86cb518d3cf25320866ca3ef43e2ad"
),
}]

executor = Executor(tmp_venv, pool, config, io)
operation = Install(package)
Expand Down
Loading

0 comments on commit 6f85605

Please sign in to comment.