Skip to content

Commit

Permalink
Reformat code with new version of Black
Browse files Browse the repository at this point in the history
  • Loading branch information
Secrus committed Jul 19, 2023
1 parent 07af33c commit a509ea7
Show file tree
Hide file tree
Showing 24 changed files with 108 additions and 194 deletions.
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
10 changes: 4 additions & 6 deletions src/poetry/installation/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,12 +370,10 @@ def _do_execute_operation(self, operation: Operation) -> int:
if self.supports_fancy_output():
self._write(
operation,
(
f" <fg=default;options=bold,dark>•</> {operation_message}: "
"<fg=default;options=bold,dark>Skipped</> "
"<fg=default;options=dark>for the following reason:</> "
f"<fg=default;options=bold,dark>{operation.skip_reason}</>"
),
f" <fg=default;options=bold,dark>•</> {operation_message}: "
"<fg=default;options=bold,dark>Skipped</> "
"<fg=default;options=dark>for the following reason:</> "
f"<fg=default;options=bold,dark>{operation.skip_reason}</>",
)

self._skipped[operation.job_type] += 1
Expand Down
10 changes: 4 additions & 6 deletions src/poetry/locations.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,10 @@

if any(file.exists() for file in (auth_toml, config_toml)):
logger.warning(
(
"Configuration file exists at %s, reusing this"
" directory.\n\nConsider moving TOML configuration files to %s, as"
" support for the legacy directory will be removed in an upcoming"
" release."
),
"Configuration file exists at %s, reusing this"
" directory.\n\nConsider moving TOML configuration files to %s, as"
" support for the legacy directory will be removed in an upcoming"
" release.",
_LEGACY_CONFIG_DIR,
CONFIG_DIR,
)
Expand Down
Loading

0 comments on commit a509ea7

Please sign in to comment.