MCPcopy Index your code
hub / github.com/archlinux/archinstall / PartitionModification

Class PartitionModification

archinstall/lib/models/device.py:880–1076  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

878
879@dataclass
880class PartitionModification:
881 status: ModificationStatus
882 type: PartitionType
883 start: Size
884 length: Size
885 fs_type: FilesystemType | None = None
886 mountpoint: Path | None = None
887 mount_options: list[str] = field(default_factory=list)
888 flags: list[PartitionFlag] = field(default_factory=list)
889 btrfs_subvols: list[SubvolumeModification] = field(default_factory=list)
890
891 # only set if the device was created or exists
892 dev_path: Path | None = None
893 partn: int | None = None
894 partuuid: str | None = None
895 uuid: str | None = None
896
897 _obj_id: UUID | str = field(init=False)
898
899 def __post_init__(self) -> None:
900 # needed to use the object as a dictionary key due to hash func
901 if not hasattr(self, '_obj_id'):
902 self._obj_id = uuid.uuid4()
903
904 if self.is_exists_or_modify() and not self.dev_path:
905 raise ValueError('If partition marked as existing a path must be set')
906
907 if self.fs_type is None and self.status == ModificationStatus.MODIFY:
908 raise ValueError('FS type must not be empty on modifications with status type modify')
909
910 @override
911 def __hash__(self) -> int:
912 return hash(self._obj_id)
913
914 @property
915 def end(self) -> Size:
916 return self.start + self.length
917
918 @property
919 def obj_id(self) -> str:
920 if hasattr(self, '_obj_id'):
921 return str(self._obj_id)
922 return ''
923
924 @property
925 def safe_dev_path(self) -> Path:
926 if self.dev_path is None:
927 raise ValueError('Device path was not set')
928 return self.dev_path
929
930 @property
931 def safe_fs_type(self) -> FilesystemType:
932 if self.fs_type is None:
933 raise ValueError('File system type is not set')
934 return self.fs_type
935
936 @classmethod
937 def from_existing_partition(cls, partition_info: _PartitionInfo) -> Self:

Callers 7

table_dataMethod · 0.90
_create_new_partitionMethod · 0.90
_boot_partitionFunction · 0.90
parse_argMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected