Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ extend-ignore =
ANN101,
# ANN102: Missing type annotation for cls in classmethod
ANN102,
# PIE781: assign-and-return
PIE781,
# PIE798 no-unnecessary-class: Consider using a module for namespacing instead
PIE798,
per-file-ignores =
# TC002: Move third-party import '...' into a type-checking block
__init__.py:TC002,
Expand Down
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ repos:
- flake8-typing-imports==1.12.0
- flake8-use-fstring==1.4
- pep8-naming==0.13.1
- flake8-pie==0.16.0

- repo: https://github.com/asottile/pyupgrade
rev: v2.37.3
Expand Down
2 changes: 1 addition & 1 deletion src/poetry/console/logging/io_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ def emit(self, record: LogRecord) -> None:
self._io.write_error_line(msg)
else:
self._io.write_line(msg)
except Exception:
except Exception: # noqa: PIE786
self.handleError(record)
6 changes: 4 additions & 2 deletions src/poetry/inspection/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,10 @@ def to_package(
except ValueError:
# Likely unable to parse constraint so we skip it
logger.debug(
f"Invalid constraint ({req}) found in"
f" {package.name}-{package.version} dependencies, skipping",
"Invalid constraint (%s) found in %s-%s dependencies, skipping",
req,
package.name,
package.version,
)
continue

Expand Down
2 changes: 1 addition & 1 deletion src/poetry/installation/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ def _execute_operation(self, operation: Operation) -> None:
# error to be picked up by the error handler.
if result == -2:
raise KeyboardInterrupt
except Exception as e:
except Exception as e: # noqa: PIE786
try:
from cleo.ui.exception_trace import ExceptionTrace

Expand Down
2 changes: 1 addition & 1 deletion src/poetry/plugins/plugin_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def activate(self, *args: Any, **kwargs: Any) -> None:
plugin.activate(*args, **kwargs)

def _load_plugin_entry_point(self, ep: metadata.EntryPoint) -> None:
logger.debug(f"Loading the {ep.name} plugin") # type: ignore[attr-defined]
logger.debug("Loading the %s plugin", ep.name) # type: ignore[attr-defined]

plugin = ep.load() # type: ignore[no-untyped-call]

Expand Down
4 changes: 2 additions & 2 deletions src/poetry/publishing/publisher.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ def publish(
# Check if we have a token first
token = self._authenticator.get_pypi_token(repository_name)
if token:
logger.debug(f"Found an API token for {repository_name}.")
logger.debug("Found an API token for %s.", repository_name)
username = "__token__"
password = token
else:
auth = self._authenticator.get_http_auth(repository_name)
if auth:
logger.debug(
f"Found authentication information for {repository_name}."
"Found authentication information for %s.", repository_name
)
username = auth.username
password = auth.password
Expand Down
11 changes: 7 additions & 4 deletions src/poetry/puzzle/solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,13 @@ def solve(self, use_latest: list[str] | None = None) -> Transaction:

if len(self._overrides) > 1:
self._provider.debug(
f"Complete version solving took {end - start:.3f} seconds with"
f" {len(self._overrides)} overrides"
# ignore the warning as provider does not do interpolation
f"Complete version solving took {end - start:.3f}" # noqa: PIE803
f" seconds with {len(self._overrides)} overrides"
)
self._provider.debug(
"Resolved with overrides:"
# ignore the warning as provider does not do interpolation
"Resolved with overrides:" # noqa: PIE803
f" {', '.join(f'({b})' for b in self._overrides)}"
)

Expand All @@ -99,7 +101,8 @@ def solve_in_compatibility_mode(
depths = []
for override in overrides:
self._provider.debug(
"<comment>Retrying dependency resolution "
# ignore the warning as provider does not do interpolation
"<comment>Retrying dependency resolution " # noqa: PIE803
Comment thread
neersighted marked this conversation as resolved.
Resolved
f"with the following overrides ({override}).</comment>"
)
self._provider.set_overrides(override)
Expand Down
2 changes: 1 addition & 1 deletion src/poetry/utils/authenticator.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def request(
if not is_last_attempt:
attempt += 1
delay = 0.5 * attempt
logger.debug(f"Retrying HTTP request in {delay} seconds.")
logger.debug("Retrying HTTP request in %s seconds.", delay)
time.sleep(delay)
continue

Expand Down
6 changes: 3 additions & 3 deletions src/poetry/utils/password_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ def get_entry_name(self, name: str) -> str:
def _check(self) -> None:
try:
import keyring
except Exception as e:
logger.debug(f"An error occurred while importing keyring: {e!s}")
except ImportError as e:
logger.debug("An error occurred while importing keyring: %s", e)
self._is_available = False

return
Expand All @@ -134,7 +134,7 @@ def _check(self) -> None:
and "plaintext" not in b.name.lower()
for b in backends
)
except Exception:
except ImportError:
self._is_available = False

if not self._is_available:
Expand Down