Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (python-poetry#8664)
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 and MrGreenTea committed Dec 18, 2023
1 parent 13d6e7f commit dda852f
Show file tree
Hide file tree
Showing 23 changed files with 1,789 additions and 1,977 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.10.1
rev: 23.11.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.4
rev: v0.1.5
hooks:
- id: ruff
12 changes: 5 additions & 7 deletions src/poetry/config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,11 @@ def normalize(cls, policy: str) -> list[str]:
else:
return [":none:"]

return list(
{
name.strip() if cls.is_reserved(name) else canonicalize_name(name)
for name in policy.strip().split(",")
if name
}
)
return list({
name.strip() if cls.is_reserved(name) else canonicalize_name(name)
for name in policy.strip().split(",")
if name
})

@classmethod
def validator(cls, policy: str) -> bool:
Expand Down
10 changes: 4 additions & 6 deletions src/poetry/console/commands/debug/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,10 @@ def handle(self) -> int:
self.line("")
self.line("<b>Poetry</b>")
self.line(
"\n".join(
[
f"<info>Version</info>: <comment>{self.poetry.VERSION}</>",
f"<info>Python</info>: <comment>{poetry_python_version}</>",
]
)
"\n".join([
f"<info>Version</info>: <comment>{self.poetry.VERSION}</>",
f"<info>Python</info>: <comment>{poetry_python_version}</>",
])
)
command = self.get_application().get("env info")

Expand Down
16 changes: 7 additions & 9 deletions src/poetry/console/commands/env/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,11 @@ def _display_complete_info(self, env: Env) -> None:
python = ".".join(str(v) for v in system_env.version_info[:3])
self.line("<b>System</b>")
self.line(
"\n".join(
[
f"<info>Platform</info>: <comment>{env.platform}</>",
f"<info>OS</info>: <comment>{env.os}</>",
f"<info>Python</info>: <comment>{python}</>",
f"<info>Path</info>: <comment>{system_env.path}</>",
f"<info>Executable</info>: <comment>{system_env.python}</>",
]
)
"\n".join([
f"<info>Platform</info>: <comment>{env.platform}</>",
f"<info>OS</info>: <comment>{env.os}</>",
f"<info>Python</info>: <comment>{python}</>",
f"<info>Path</info>: <comment>{system_env.path}</>",
f"<info>Executable</info>: <comment>{system_env.python}</>",
])
)
10 changes: 4 additions & 6 deletions src/poetry/masonry/builders/editable.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,12 +231,10 @@ def _add_dist_info(self, added_files: list[Path]) -> None:
# write PEP 610 metadata
direct_url_json = dist_info.joinpath("direct_url.json")
direct_url_json.write_text(
json.dumps(
{
"dir_info": {"editable": True},
"url": self._poetry.file.path.parent.absolute().as_uri(),
}
)
json.dumps({
"dir_info": {"editable": True},
"url": self._poetry.file.path.parent.absolute().as_uri(),
})
)
added_files.append(direct_url_json)

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
12 changes: 5 additions & 7 deletions src/poetry/publishing/uploader.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,13 +205,11 @@ def _upload_file(
raise UploadError(f"Archive ({file}) does not exist")

data = self.post_data(file)
data.update(
{
# action
":action": "file_upload",
"protocol_version": "1",
}
)
data.update({
# action
":action": "file_upload",
"protocol_version": "1",
})

data_to_send: list[tuple[str, Any]] = self._prepare_data(data)

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 @@ -780,12 +780,10 @@ def debug(self, message: str, depth: int = 0) -> None:
if self.is_debugging():
debug_info = str(message)
debug_info = (
"\n".join(
[
f"<debug>{str(depth).rjust(4)}:</debug> {s}"
for s in debug_info.split("\n")
]
)
"\n".join([
f"<debug>{str(depth).rjust(4)}:</debug> {s}"
for s in debug_info.split("\n")
])
+ "\n"
)

Expand Down
10 changes: 4 additions & 6 deletions src/poetry/repositories/pypi_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,10 @@ def _get_release_info(

for file_info in version_info:
if file_info["packagetype"] in SUPPORTED_PACKAGE_TYPES:
data.files.append(
{
"file": file_info["filename"],
"hash": "sha256:" + file_info["digests"]["sha256"],
}
)
data.files.append({
"file": file_info["filename"],
"hash": "sha256:" + file_info["digests"]["sha256"],
})

if self._fallback and data.requires_dist is None:
self._log("No dependencies found, downloading archives", level="debug")
Expand Down
18 changes: 8 additions & 10 deletions tests/console/commands/self/test_show_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,14 @@ def plugin_distro(plugin_package: Package, tmp_path: Path) -> metadata.Distribut
class MockDistribution(metadata.Distribution):
def read_text(self, filename: str) -> str | None:
if filename == "METADATA":
return "\n".join(
[
f"Name: {plugin_package.name}",
f"Version: {plugin_package.version}",
*[
f"Requires-Dist: {dep.to_pep_508()}"
for dep in plugin_package.requires
],
]
)
return "\n".join([
f"Name: {plugin_package.name}",
f"Version: {plugin_package.version}",
*[
f"Requires-Dist: {dep.to_pep_508()}"
for dep in plugin_package.requires
],
])
return None

def locate_file(self, path: str | PathLike[str]) -> Path:
Expand Down
24 changes: 11 additions & 13 deletions tests/console/commands/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,17 @@ def tester(patches: None) -> CommandTester:

@pytest.fixture
def init_basic_inputs() -> str:
return "\n".join(
[
"my-package", # Package name
"1.2.3", # Version
"This is a description", # Description
"n", # Author
"MIT", # License
"~2.7 || ^3.6", # Python
"n", # Interactive packages
"n", # Interactive dev packages
"\n", # Generate
]
)
return "\n".join([
"my-package", # Package name
"1.2.3", # Version
"This is a description", # Description
"n", # Author
"MIT", # License
"~2.7 || ^3.6", # Python
"n", # Interactive packages
"n", # Interactive dev packages
"\n", # Generate
])


@pytest.fixture()
Expand Down
Loading

0 comments on commit dda852f

Please sign in to comment.