Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (#3386)
Browse files Browse the repository at this point in the history
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.8.6 → v0.9.4](astral-sh/ruff-pre-commit@v0.8.6...v0.9.4)
- [github.com/codespell-project/codespell: v2.3.0 → v2.4.1](codespell-project/codespell@v2.3.0...v2.4.1)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
pre-commit-ci[bot] authored Feb 5, 2025
1 parent 9ee2209 commit c582a94
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 26 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ ci:
autoupdate_schedule: monthly
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 'v0.8.6'
rev: 'v0.9.4'
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix, --show-fixes]
- id: ruff-format

- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
rev: v2.4.1
hooks:
- id: codespell # See pyproject.toml for args
additional_dependencies:
Expand Down
2 changes: 1 addition & 1 deletion src/pdm/cli/commands/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def do_build(
if verbose == -1:
uv_build_cmd.append("-q")
elif verbose > 0:
uv_build_cmd.append(f"-{'v'*verbose}")
uv_build_cmd.append(f"-{'v' * verbose}")
subprocess.run(uv_build_cmd, check=True)

# pdm build doesn't include .gitignore, and pdm publish would fail with .gitignore
Expand Down
3 changes: 1 addition & 2 deletions src/pdm/cli/commands/completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ def add_arguments(self, parser: argparse.ArgumentParser) -> None:
parser.add_argument(
"shell",
nargs="?",
help="The shell to generate the scripts for. "
"If not given, PDM will properly guess from `SHELL` env var.",
help="The shell to generate the scripts for. If not given, PDM will properly guess from `SHELL` env var.",
)

def handle(self, project: Project, options: argparse.Namespace) -> None:
Expand Down
4 changes: 2 additions & 2 deletions src/pdm/cli/commands/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def add_arguments(self, parser: ArgumentParser) -> None:
parser.add_argument(
"--min",
action="store_true",
help="Use minimum instead of highest version " "for installation if `version` is left empty",
help="Use minimum instead of highest version for installation if `version` is left empty",
)

def handle(self, project: Project, options: Namespace) -> None:
Expand Down Expand Up @@ -143,7 +143,7 @@ def install_python(project: Project, request: str) -> PythonInfo:
arch = "x86" if arch == "32" else (arch or THIS_ARCH)

ver, python_file = get_download_link(version, implementation=implementation, arch=arch, build_dir=False)
ver_str = f'{ver}{"t" if request.endswith("t") else ""}'
ver_str = f"{ver}{'t' if request.endswith('t') else ''}"
with ui.open_spinner(f"Downloading [success]{ver_str}[/]") as spinner:
destination = root / ver_str
logger.debug("Installing %s to %s", ver_str, destination)
Expand Down
4 changes: 1 addition & 3 deletions src/pdm/cli/commands/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,7 @@ def do_update(
hooks = hooks or HookManager(project)
check_project_file(project)
if len(packages) > 0 and (top or len(selection.groups) > 1 or not selection.default):
raise PdmUsageError(
"packages argument can't be used together with multiple -G or " "--no-default or --top."
)
raise PdmUsageError("packages argument can't be used together with multiple -G or --no-default or --top.")
all_dependencies = project.all_dependencies
updated_deps: dict[str, list[Requirement]] = defaultdict(list)
locked_groups = project.lockfile.groups
Expand Down
2 changes: 1 addition & 1 deletion src/pdm/cli/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def _translated_groups(self) -> list[str]:
invalid_groups = groups_set - {normalize_name(g) for g in project.iter_groups()}
if invalid_groups:
project.core.ui.echo(
"[d]Ignoring non-existing groups: [success]" f"{', '.join(invalid_groups)}[/]",
f"[d]Ignoring non-existing groups: [success]{', '.join(invalid_groups)}[/]",
err=True,
)
groups_set -= invalid_groups
Expand Down
4 changes: 2 additions & 2 deletions src/pdm/project/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ def __setitem__(self, key: str, value: Any) -> None:
raise PdmUsageError(f"Set {parts[0]} config with [success]{parts[0]}.{{name}}.{{attr}}")
index_key = ".".join(parts[:2])
username = self._data.get(index_key, {}).get("username") # type: ignore[call-overload]
service = f'pdm-{index_key.replace(".", "-")}'
service = f"pdm-{index_key.replace('.', '-')}"
if (
parts[2] == "password"
and self.is_global
Expand Down Expand Up @@ -402,7 +402,7 @@ def __delitem__(self, key: str) -> None:
raise PdmUsageError(f"Should specify the name of {parts[0]}")
index_key = ".".join(parts[:2])
username = self._data.get(index_key, {}).get("username") # type: ignore[call-overload]
service = f'pdm-{index_key.replace(".", "-")}'
service = f"pdm-{index_key.replace('.', '-')}"
if len(parts) >= 3:
index_key, attr = key.rsplit(".", 1)
if attr == "password" and username:
Expand Down
5 changes: 2 additions & 3 deletions src/pdm/project/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,7 @@ def is_active_venv(python: PythonInfo) -> bool:
note("The saved Python interpreter does not exist or broken. Trying to find another one.")
else:
note(
"The saved Python interpreter doesn't match the project's requirement. "
"Trying to find another one."
"The saved Python interpreter doesn't match the project's requirement. Trying to find another one."
)
self._saved_python = None # Clear the saved path if it doesn't match

Expand Down Expand Up @@ -703,7 +702,7 @@ def add_dependencies(
"""Add requirements to the given group, and return the requirements of that group."""
if isinstance(requirements, Mapping): # pragma: no cover
deprecation_warning(
"Passing a requirements map to add_dependencies is deprecated, " "please pass an iterable", stacklevel=2
"Passing a requirements map to add_dependencies is deprecated, please pass an iterable", stacklevel=2
)
requirements = requirements.values()
deps, setter = self.use_pyproject_dependencies(to_group, dev)
Expand Down
3 changes: 1 addition & 2 deletions tests/cli/test_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,7 @@ def test_cache_info(project, pdm):
"http://fixtures.test/artifacts/demo-0.0.1.tar.gz#sha384=9130e5e4912bc78b"
"1ffabbf406d56bc74b9165b0adc8c627168b7b563b80d5ff6c30e269398d01144ee52aa3"
"3292682d",
"sha384:9130e5e4912bc78b1ffabbf406d56bc74b9165b0adc8c627168b7b563b80d5ff6"
"c30e269398d01144ee52aa33292682d",
"sha384:9130e5e4912bc78b1ffabbf406d56bc74b9165b0adc8c627168b7b563b80d5ff6c30e269398d01144ee52aa33292682d",
),
(
"http://fixtures.test/artifacts/demo-0.0.1.tar.gz#md5=5218509812c9fcb4646adde8fd3307e1",
Expand Down
9 changes: 1 addition & 8 deletions tests/cli/test_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -586,14 +586,7 @@ def prepare_metadata(self):
def test_list_freeze(project, pdm):
pdm(["add", "requests"], obj=project, strict=True)
result = pdm(["list", "--freeze"], obj=project)
expected = (
"certifi==2018.11.17\n"
"chardet==3.0.4\n"
"idna==2.7\n"
"requests==2.19.1\n"
"test-project==0.0.0\n"
"urllib3==1.22\n"
)
expected = "certifi==2018.11.17\nchardet==3.0.4\nidna==2.7\nrequests==2.19.1\ntest-project==0.0.0\nurllib3==1.22\n"
assert expected == result.output


Expand Down

0 comments on commit c582a94

Please sign in to comment.