Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (#8136)
Browse files Browse the repository at this point in the history
Co-authored-by: Bartek Sokorski <[email protected]>
  • Loading branch information
pre-commit-ci[bot] and Secrus authored Jul 19, 2023
1 parent fd717ca commit c71deb4
Show file tree
Hide file tree
Showing 33 changed files with 136 additions and 206 deletions.
6 changes: 3 additions & 3 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
rev: 23.3.0
rev: 23.7.0
hooks:
- id: black

Expand All @@ -30,7 +30,7 @@ repos:
hooks:
- id: validate_manifest

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.272
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.278
hooks:
- id: ruff
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@ known-first-party = ["poetry"]
known-third-party = ["poetry.core"]
required-imports = ["from __future__ import annotations"]

[tool.ruff.per-file-ignores]
"src/poetry/console/*" = ["RUF012"] # Can't annotate properly until new version of Cleo

[tool.black]
target-version = ['py38']
preview = true
Expand Down
3 changes: 2 additions & 1 deletion src/poetry/config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from pathlib import Path
from typing import TYPE_CHECKING
from typing import Any
from typing import ClassVar

from packaging.utils import canonicalize_name

Expand Down Expand Up @@ -104,7 +105,7 @@ def validator(cls, policy: str) -> bool:


class Config:
default_config: dict[str, Any] = {
default_config: ClassVar[dict[str, Any]] = {
"cache-dir": str(DEFAULT_CACHE_DIR),
"virtualenvs": {
"create": True,
Expand Down
8 changes: 3 additions & 5 deletions src/poetry/config/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,9 @@ def __post_init__(self, default: bool, secondary: bool) -> None:
self.priority = Priority[self.priority.upper()]
if default or secondary:
warnings.warn(
(
"Parameters 'default' and 'secondary' to"
" 'Source' are deprecated. Please provide"
" 'priority' instead."
),
"Parameters 'default' and 'secondary' to"
" 'Source' are deprecated. Please provide"
" 'priority' instead.",
DeprecationWarning,
stacklevel=2,
)
Expand Down
12 changes: 4 additions & 8 deletions src/poetry/console/commands/add.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,8 @@ class AddCommand(InstallerCommand, InitCommand):
option(
"dev",
"D",
(
"Add as a development dependency. (<warning>Deprecated</warning>) Use"
" --group=dev instead."
),
"Add as a development dependency. (<warning>Deprecated</warning>) Use"
" --group=dev instead.",
),
option("editable", "e", "Add vcs/path dependencies as editable."),
option(
Expand Down Expand Up @@ -66,10 +64,8 @@ class AddCommand(InstallerCommand, InitCommand):
option(
"dry-run",
None,
(
"Output the operations but do not execute anything (implicitly enables"
" --verbose)."
),
"Output the operations but do not execute anything (implicitly enables"
" --verbose).",
),
option("lock", None, "Do not perform operations (only update the lockfile)."),
]
Expand Down
6 changes: 2 additions & 4 deletions src/poetry/console/commands/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,8 @@ class CheckCommand(Command):
option(
"lock",
None,
(
"Checks that <comment>poetry.lock</> exists for the current"
" version of <comment>pyproject.toml</>."
),
"Checks that <comment>poetry.lock</> exists for the current"
" version of <comment>pyproject.toml</>.",
),
]

Expand Down
6 changes: 2 additions & 4 deletions src/poetry/console/commands/env/remove.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@ class EnvRemoveCommand(Command):
arguments = [
argument(
"python",
(
"The python executables associated with, or names of the virtual"
" environments which are to be removed."
),
"The python executables associated with, or names of the virtual"
" environments which are to be removed.",
optional=True,
multiple=True,
)
Expand Down
18 changes: 6 additions & 12 deletions src/poetry/console/commands/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,16 @@ class InitCommand(Command):
option(
"dependency",
None,
(
"Package to require, with an optional version constraint, "
"e.g. requests:^2.10.0 or requests=2.11.1."
),
"Package to require, with an optional version constraint, "
"e.g. requests:^2.10.0 or requests=2.11.1.",
flag=False,
multiple=True,
),
option(
"dev-dependency",
None,
(
"Package to require for development, with an optional version"
" constraint, e.g. requests:^2.10.0 or requests=2.11.1."
),
"Package to require for development, with an optional version"
" constraint, e.g. requests:^2.10.0 or requests=2.11.1.",
flag=False,
multiple=True,
),
Expand Down Expand Up @@ -330,10 +326,8 @@ def _determine_requirements(
choices.append("")

package = self.choice(
(
"\nEnter package # to add, or the complete package name if"
" it is not listed"
),
"\nEnter package # to add, or the complete package name if"
" it is not listed",
choices,
attempts=3,
default=len(choices) - 1,
Expand Down
38 changes: 13 additions & 25 deletions src/poetry/console/commands/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,47 +14,37 @@ class InstallCommand(InstallerCommand):
option(
"no-dev",
None,
(
"Do not install the development dependencies."
" (<warning>Deprecated</warning>)"
),
"Do not install the development dependencies."
" (<warning>Deprecated</warning>)",
),
option(
"sync",
None,
(
"Synchronize the environment with the locked packages and the specified"
" groups."
),
"Synchronize the environment with the locked packages and the specified"
" groups.",
),
option(
"no-root", None, "Do not install the root package (the current project)."
),
option(
"no-directory",
None,
(
"Do not install any directory path dependencies; useful to install"
" dependencies without source code, e.g. for caching of Docker layers)"
),
"Do not install any directory path dependencies; useful to install"
" dependencies without source code, e.g. for caching of Docker layers)",
flag=True,
multiple=False,
),
option(
"dry-run",
None,
(
"Output the operations but do not execute anything "
"(implicitly enables --verbose)."
),
"Output the operations but do not execute anything "
"(implicitly enables --verbose).",
),
option(
"remove-untracked",
None,
(
"Removes packages not present in the lock file."
" (<warning>Deprecated</warning>)"
),
"Removes packages not present in the lock file."
" (<warning>Deprecated</warning>)",
),
option(
"extras",
Expand All @@ -68,11 +58,9 @@ class InstallCommand(InstallerCommand):
option(
"compile",
None,
(
"Compile Python source files to bytecode."
" (This option has no effect if modern-installation is disabled"
" because the old installer always compiles.)"
),
"Compile Python source files to bytecode."
" (This option has no effect if modern-installation is disabled"
" because the old installer always compiles.)",
),
]

Expand Down
8 changes: 3 additions & 5 deletions src/poetry/console/commands/lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@ class LockCommand(InstallerCommand):
option(
"check",
None,
(
"Check that the <comment>poetry.lock</> file corresponds to the current"
" version of <comment>pyproject.toml</>. (<warning>Deprecated</>) Use"
" <comment>poetry check --lock</> instead."
),
"Check that the <comment>poetry.lock</> file corresponds to the current"
" version of <comment>pyproject.toml</>. (<warning>Deprecated</>) Use"
" <comment>poetry check --lock</> instead.",
),
]

Expand Down
14 changes: 5 additions & 9 deletions src/poetry/console/commands/remove.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,15 @@ class RemoveCommand(InstallerCommand):
option(
"dev",
"D",
(
"Remove a package from the development dependencies."
" (<warning>Deprecated</warning>)"
" Use --group=dev instead."
),
"Remove a package from the development dependencies."
" (<warning>Deprecated</warning>)"
" Use --group=dev instead.",
),
option(
"dry-run",
None,
(
"Output the operations but do not execute anything "
"(implicitly enables --verbose)."
),
"Output the operations but do not execute anything "
"(implicitly enables --verbose).",
),
option("lock", None, "Do not perform operations (only update the lockfile)."),
]
Expand Down
6 changes: 2 additions & 4 deletions src/poetry/console/commands/self/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@ class SelfUpdateCommand(SelfCommand):
option(
"dry-run",
None,
(
"Output the operations but do not execute anything "
"(implicitly enables --verbose)."
),
"Output the operations but do not execute anything "
"(implicitly enables --verbose).",
),
]
help = """\
Expand Down
6 changes: 2 additions & 4 deletions src/poetry/console/commands/show.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,8 @@ class ShowCommand(GroupCommand, EnvCommand):
option(
"why",
None,
(
"When showing the full list, or a <info>--tree</info> for a single"
" package, also display why it's included."
),
"When showing the full list, or a <info>--tree</info> for a single"
" package, also display why it's included.",
),
option("latest", "l", "Show the latest version."),
option(
Expand Down
28 changes: 10 additions & 18 deletions src/poetry/console/commands/source/add.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@ class SourceAddCommand(Command):
),
argument(
"url",
(
"Source repository URL."
" Required, except for PyPI, for which it is not allowed."
),
"Source repository URL."
" Required, except for PyPI, for which it is not allowed.",
optional=True,
),
]
Expand All @@ -33,28 +31,22 @@ class SourceAddCommand(Command):
option(
"default",
"d",
(
"Set this source as the default (disable PyPI). A "
"default source will also be the fallback source if "
"you add other sources. (<warning>Deprecated</warning>, use --priority)"
),
"Set this source as the default (disable PyPI). A "
"default source will also be the fallback source if "
"you add other sources. (<warning>Deprecated</warning>, use --priority)",
),
option(
"secondary",
"s",
(
"Set this source as secondary. (<warning>Deprecated</warning>, use"
" --priority)"
),
"Set this source as secondary. (<warning>Deprecated</warning>, use"
" --priority)",
),
option(
"priority",
"p",
(
"Set the priority of this source. One of:"
f" {', '.join(p.name.lower() for p in Priority)}. Defaults to"
f" {Priority.PRIMARY.name.lower()}."
),
"Set the priority of this source. One of:"
f" {', '.join(p.name.lower() for p in Priority)}. Defaults to"
f" {Priority.PRIMARY.name.lower()}.",
flag=False,
),
]
Expand Down
12 changes: 4 additions & 8 deletions src/poetry/console/commands/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,14 @@ class UpdateCommand(InstallerCommand):
option(
"no-dev",
None,
(
"Do not update the development dependencies."
" (<warning>Deprecated</warning>)"
),
"Do not update the development dependencies."
" (<warning>Deprecated</warning>)",
),
option(
"dry-run",
None,
(
"Output the operations but do not execute anything "
"(implicitly enables --verbose)."
),
"Output the operations but do not execute anything "
"(implicitly enables --verbose).",
),
option("lock", None, "Do not perform operations (only update the lockfile)."),
]
Expand Down
12 changes: 4 additions & 8 deletions src/poetry/installation/chooser.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,17 @@ def choose_for(self, package: Package) -> Link:
if link.is_wheel:
if not self._no_binary_policy.allows(package.name):
logger.debug(
(
"Skipping wheel for %s as requested in no binary policy for"
" package (%s)"
),
"Skipping wheel for %s as requested in no binary policy for"
" package (%s)",
link.filename,
package.name,
)
continue

if not Wheel(link.filename).is_supported_by_environment(self._env):
logger.debug(
(
"Skipping wheel %s as this is not supported by the current"
" environment"
),
"Skipping wheel %s as this is not supported by the current"
" environment",
link.filename,
)
continue
Expand Down
Loading

0 comments on commit c71deb4

Please sign in to comment.