Enable the set-attr-with-constant ruff rule and fix warnings (#3114)
This commit is contained in:
parent
fd77b5d4ce
commit
c0a2de4330
|
|
@ -142,8 +142,8 @@ class DiskLayoutConfiguration:
|
||||||
flags=flags,
|
flags=flags,
|
||||||
btrfs_subvols=SubvolumeModification.parse_args(partition.get('btrfs', [])),
|
btrfs_subvols=SubvolumeModification.parse_args(partition.get('btrfs', [])),
|
||||||
)
|
)
|
||||||
# special 'invisible attr to internally identify the part mod
|
# special 'invisible' attr to internally identify the part mod
|
||||||
setattr(device_partition, '_obj_id', partition['obj_id'])
|
device_partition._obj_id = partition['obj_id']
|
||||||
device_partitions.append(device_partition)
|
device_partitions.append(device_partition)
|
||||||
|
|
||||||
device_modification.partitions = device_partitions
|
device_modification.partitions = device_partitions
|
||||||
|
|
@ -867,7 +867,7 @@ class PartitionModification:
|
||||||
def __post_init__(self) -> None:
|
def __post_init__(self) -> None:
|
||||||
# needed to use the object as a dictionary key due to hash func
|
# needed to use the object as a dictionary key due to hash func
|
||||||
if not hasattr(self, '_obj_id'):
|
if not hasattr(self, '_obj_id'):
|
||||||
self._obj_id = uuid.uuid4()
|
self._obj_id: uuid.UUID | str = uuid.uuid4()
|
||||||
|
|
||||||
if self.is_exists_or_modify() and not self.dev_path:
|
if self.is_exists_or_modify() and not self.dev_path:
|
||||||
raise ValueError('If partition marked as existing a path must be set')
|
raise ValueError('If partition marked as existing a path must be set')
|
||||||
|
|
@ -1133,7 +1133,7 @@ class LvmVolume:
|
||||||
def __post_init__(self) -> None:
|
def __post_init__(self) -> None:
|
||||||
# needed to use the object as a dictionary key due to hash func
|
# needed to use the object as a dictionary key due to hash func
|
||||||
if not hasattr(self, '_obj_id'):
|
if not hasattr(self, '_obj_id'):
|
||||||
self._obj_id = uuid.uuid4()
|
self._obj_id: uuid.UUID | str = uuid.uuid4()
|
||||||
|
|
||||||
@override
|
@override
|
||||||
def __hash__(self) -> int:
|
def __hash__(self) -> int:
|
||||||
|
|
@ -1193,7 +1193,7 @@ class LvmVolume:
|
||||||
btrfs_subvols=SubvolumeModification.parse_args(arg.get('btrfs', []))
|
btrfs_subvols=SubvolumeModification.parse_args(arg.get('btrfs', []))
|
||||||
)
|
)
|
||||||
|
|
||||||
setattr(volume, '_obj_id', arg['obj_id'])
|
volume._obj_id = arg['obj_id']
|
||||||
|
|
||||||
return volume
|
return volume
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -209,7 +209,6 @@ select = [
|
||||||
ignore = [
|
ignore = [
|
||||||
"B006", # mutable-argument-default
|
"B006", # mutable-argument-default
|
||||||
"B008", # function-call-in-default-argument
|
"B008", # function-call-in-default-argument
|
||||||
"B010", # set-attr-with-constant
|
|
||||||
"B904", # raise-without-from-inside-except
|
"B904", # raise-without-from-inside-except
|
||||||
"B905", # zip-without-explicit-strict
|
"B905", # zip-without-explicit-strict
|
||||||
"PLC0415", # import-outside-top-level
|
"PLC0415", # import-outside-top-level
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue