Skip to content

Commit

Permalink
Refactor Disk class to use DiskPartition constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
timmo001 committed Jan 3, 2024
1 parent 9701a52 commit b283af9
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions systembridgemodels/modules/disks.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,18 +61,7 @@ def __post_init__(self) -> None:
new_partitions: list[DiskPartition] = []
for p in self.partitions:
partition: dict = cast(dict, p)
usage = partition.get("usage")
new_partitions.append(
DiskPartition(
device=partition["device"],
mount_point=partition["mount_point"],
filesystem_type=partition["filesystem_type"],
options=partition["options"],
max_file_size=partition["max_file_size"],
max_path_length=partition["max_path_length"],
usage=(DiskUsage(**usage) if usage else None),
)
)
new_partitions.append(DiskPartition(**partition))
self.partitions = new_partitions

if isinstance(self.io_counters, dict):
Expand Down

0 comments on commit b283af9

Please sign in to comment.