Skip to content

Commit 0095f25

Browse files
committed
Use uniform list annotation for alert codes
It's improved over the legacy List which should be dropped anyway. In particular, it seems to be able to handle variance in the types of the elements in ths list a bit better. Signed-off-by: mulhern <amulhern@redhat.com>
1 parent 4fe1b47 commit 0095f25

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

src/stratis_cli/_actions/_list_pool.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
Any,
2424
Callable,
2525
Iterable,
26-
List,
2726
Mapping,
2827
)
2928
from uuid import UUID
@@ -158,7 +157,7 @@ def __init__(
158157

159158
(self.increased, self.decreased) = (increased, decreased)
160159

161-
def alert_codes(self, pool_object_path: str) -> List[PoolDeviceSizeChangeAlert]:
160+
def alert_codes(self, pool_object_path: str) -> list[PoolDeviceSizeChangeAlert]:
162161
"""
163162
Get the code from sets and one pool object path.
164163
@@ -267,7 +266,7 @@ def _volume_key_loaded(mopool: Any) -> tuple[bool, bool] | tuple[bool, str]:
267266
@staticmethod
268267
def alert_codes(
269268
mopool: Any,
270-
) -> List[PoolEncryptionAlert | PoolAllocSpaceAlert | PoolMaintenanceAlert]:
269+
) -> list[PoolEncryptionAlert | PoolAllocSpaceAlert | PoolMaintenanceAlert]:
271270
"""
272271
Return alert code objects for a pool.
273272
@@ -286,7 +285,7 @@ def alert_codes(
286285

287286
(vkl_is_bool, volume_key_loaded) = Default._volume_key_loaded(mopool)
288287

289-
pool_encryption_alerts = (
288+
pool_encryption_alerts: list[PoolEncryptionAlert] = (
290289
[PoolEncryptionAlert.VOLUME_KEY_NOT_LOADED]
291290
if metadata_version is MetadataVersion.V2
292291
and mopool.Encrypted()

0 commit comments

Comments
 (0)