This commit is contained in:
Daniel Girtler 2025-05-25 21:25:15 +10:00 committed by GitHub
parent cdb1debe2e
commit 6d1a450440
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 0 deletions

View File

@ -6,6 +6,7 @@ from dataclasses import dataclass, field
from enum import Enum from enum import Enum
from pathlib import Path from pathlib import Path
from typing import NotRequired, TypedDict, override from typing import NotRequired, TypedDict, override
from uuid import UUID
import parted import parted
from parted import Disk, Geometry, Partition from parted import Disk, Geometry, Partition
@ -884,6 +885,8 @@ class PartitionModification:
partuuid: str | None = None partuuid: str | None = None
uuid: str | None = None uuid: str | None = None
_obj_id: UUID | str = field(init=False)
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'):
@ -1147,6 +1150,8 @@ class LvmVolume:
# mapper device path /dev/<vg>/<vol> # mapper device path /dev/<vg>/<vol>
dev_path: Path | None = None dev_path: Path | None = None
_obj_id: uuid.UUID | str = field(init=False)
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'):