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
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ target-version = "py312"
line-length = 88

[tool.ruff.lint]
select = ["F", "PL"]
select = ["B", "F", "PL"]

[tool.ruff.lint.isort]
known-first-party = ["dbus_client_gen", "dbus_python_client_gen"]
Expand Down
2 changes: 1 addition & 1 deletion src/stratis_cli/_actions/_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def _add_abs_path_assertion(klass, method_name, key):
:param str method_name: the name of the method
:param str key: the key at which the paths can be found in the arguments
"""
method_class = getattr(klass, "Methods")
method_class = klass.Methods
orig_method = getattr(method_class, method_name)

def new_method(proxy, args):
Expand Down
2 changes: 1 addition & 1 deletion src/stratis_cli/_actions/_formatting.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def print_table(
)
cell_widths.append(row_widths)

for row, row_widths in zip(row_entries, cell_widths):
for row, row_widths in zip(row_entries, cell_widths, strict=True):
_print_row(file, row, row_widths, column_widths, alignment)
print(file=file)

Expand Down
20 changes: 10 additions & 10 deletions src/stratis_cli/_alerts.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"""

from enum import Enum, IntEnum
from typing import Dict, List, Optional, Union
from typing import Dict, List, Optional, Union, assert_never


class Level(Enum):
Expand Down Expand Up @@ -62,7 +62,7 @@ def explain(self) -> str:
"any maintenance operations."
)

assert False, "impossible code reached" # pragma: no cover
assert_never(self) # pragma: no cover

def summarize(self) -> str:
"""
Expand All @@ -74,7 +74,7 @@ def summarize(self) -> str:
if self is PoolMaintenanceAlert.NO_POOL_CHANGES:
return "Pool maintenance operations not possible"

assert False, "impossible code reached" # pragma: no cover
assert_never(self) # pragma: no cover


class PoolAllocSpaceAlert(IntEnum):
Expand All @@ -98,7 +98,7 @@ def explain(self) -> str:
"to the pool."
)

assert False, "impossible code reached" # pragma: no cover
assert_never(self) # pragma: no cover

def summarize(self) -> str:
"""
Expand All @@ -107,7 +107,7 @@ def summarize(self) -> str:
if self is PoolAllocSpaceAlert.NO_ALLOC_SPACE:
return "All devices fully allocated"

assert False, "impossible code reached" # pragma: no cover
assert_never(self) # pragma: no cover


class PoolDeviceSizeChangeAlert(IntEnum):
Expand All @@ -126,7 +126,7 @@ def __str__(self) -> str:
if self is PoolDeviceSizeChangeAlert.DEVICE_SIZE_DECREASED:
return f"{Level.WARNING}DS{str(self.value).zfill(3)}"

assert False, "impossible code reached" # pragma: no cover
assert_never(self) # pragma: no cover

def explain(self) -> str:
"""
Expand All @@ -144,7 +144,7 @@ def explain(self) -> str:
"decreased in size."
)

assert False, "impossible code reached" # pragma: no cover
assert_never(self) # pragma: no cover

def summarize(self) -> str:
"""
Expand All @@ -156,7 +156,7 @@ def summarize(self) -> str:
if self is PoolDeviceSizeChangeAlert.DEVICE_SIZE_DECREASED:
return "A device in this pool has decreased in size."

assert False, "impossible code reached" # pragma: no cover
assert_never(self) # pragma: no cover


class PoolEncryptionAlert(IntEnum):
Expand Down Expand Up @@ -188,7 +188,7 @@ def explain(self) -> str:
"encryption layer needs to be modified."
)

assert False, "impossible code reached" # pragma: no cover
assert_never(self) # pragma: no cover

def summarize(self) -> str:
"""
Expand All @@ -199,7 +199,7 @@ def summarize(self) -> str:
if self is PoolEncryptionAlert.VOLUME_KEY_STATUS_UNKNOWN:
return "Volume key status unknown"

assert False, "impossible code reached" # pragma: no cover
assert_never(self) # pragma: no cover


CLASSES = [
Expand Down
3 changes: 2 additions & 1 deletion src/stratis_cli/_parser/_shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import argparse
import copy
import re
from typing import assert_never
from uuid import UUID

from justbytes import B, GiB, KiB, MiB, PiB, Range, TiB
Expand Down Expand Up @@ -62,7 +63,7 @@ def _unit_map(unit_specifier):
return TiB
if unit_specifier == "PiB":
return PiB
assert False, f'Unknown unit specifier "{unit_specifier}"'
assert_never(unit_specifier)


def parse_range(values):
Expand Down
Loading