Skip to content

Commit

Permalink
bump ruff to 0.0.285
Browse files Browse the repository at this point in the history
  • Loading branch information
tigarmo committed Aug 29, 2023
1 parent 7808971 commit 3e8a1ac
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 15 deletions.
3 changes: 1 addition & 2 deletions craft_cli/dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,7 @@ def _get_requested_help( # noqa: PLR0912 (too many branches)
dest = action.metavar
command_options.append((dest, help_text))

help_text = self._help_builder.get_command_help(command, command_options, output_format)
return help_text
return self._help_builder.get_command_help(command, command_options, output_format)

def _build_no_command_error(self, missing_command: str) -> str:
"""Build the error help text for missing command, providing options."""
Expand Down
4 changes: 2 additions & 2 deletions craft_cli/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"CraftError",
]

from typing import Any, Optional
from typing import Optional


class CraftError(Exception):
Expand Down Expand Up @@ -71,7 +71,7 @@ def __init__( # noqa: PLR0913 (too many arguments)
self.reportable = reportable
self.retcode = retcode

def __eq__(self, other: Any) -> bool:
def __eq__(self, other: object) -> bool:
if isinstance(other, CraftError):
return all(
[
Expand Down
6 changes: 2 additions & 4 deletions craft_cli/helptexts.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,7 @@ def get_full_help(self, global_options: list[tuple[str, str]]) -> str:
)

# join all stripped blocks, leaving ONE empty blank line between
text = "\n\n".join(block.strip() for block in textblocks) + "\n"
return text
return "\n\n".join(block.strip() for block in textblocks) + "\n"

def get_detailed_help(self, global_options: list[tuple[str, str]]) -> str:
"""Produce the text for the detailed help.
Expand Down Expand Up @@ -270,8 +269,7 @@ def get_detailed_help(self, global_options: list[tuple[str, str]]) -> str:
)

# join all stripped blocks, leaving ONE empty blank line between
text = "\n\n".join(block.strip() for block in textblocks) + "\n"
return text
return "\n\n".join(block.strip() for block in textblocks) + "\n"

def _build_plain_command_help(
self,
Expand Down
10 changes: 6 additions & 4 deletions craft_cli/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
if TYPE_CHECKING:
from types import TracebackType

from typing_extensions import Self

from craft_cli import errors


Expand Down Expand Up @@ -114,7 +116,7 @@ class _Progresser:
def __init__( # noqa: PLR0913 (too many arguments)
self,
printer: Printer,
total: int | float,
total: float,
text: str,
stream: TextIO | None,
delta: bool, # noqa: FBT001 (boolean positional arg)
Expand All @@ -133,7 +135,7 @@ def __init__( # noqa: PLR0913 (too many arguments)
# is always ephemeral
self.ephemeral_context = ephemeral_context

def __enter__(self) -> _Progresser:
def __enter__(self) -> Self:
text = f"{self.text} (--->)"
self.printer.show(
self.stream, text, ephemeral=self.ephemeral_context, use_timestamp=self.use_timestamp
Expand All @@ -152,7 +154,7 @@ def __exit__(
)
return False # do not consume any exception

def advance(self, amount: int | float) -> None:
def advance(self, amount: float) -> None:
"""Show a progress bar according to the informed advance."""
if amount < 0:
raise ValueError("The advance amount cannot be negative")
Expand Down Expand Up @@ -625,7 +627,7 @@ def progress(self, text: str, permanent: bool = False) -> None: # noqa: FBT001,

@_active_guard()
def progress_bar(
self, text: str, total: int | float, delta: bool = True # noqa: FBT001, FBT002
self, text: str, total: float, delta: bool = True # noqa: FBT001, FBT002
) -> _Progresser:
"""Progress information for a potentially long-running single step of a command.
Expand Down
4 changes: 2 additions & 2 deletions craft_cli/printer.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,8 +376,8 @@ def progress_bar( # noqa: PLR0913
stream: TextIO | None,
text: str,
*,
progress: int | float,
total: int | float,
progress: float,
total: float,
use_timestamp: bool,
) -> None:
"""Show a progress bar to the given stream."""
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ dev = [
lint = [
"black==23.7.0",
"codespell[toml]==2.2.5",
"ruff==0.0.269",
"ruff==0.0.285",
"yamllint==1.32.0"
]
types = [
Expand Down

0 comments on commit 3e8a1ac

Please sign in to comment.