@@ -86,7 +86,7 @@ def parse_arg(
8686 cls ,
8787 disk_config : _DiskLayoutConfigurationSerialization ,
8888 enc_password : Password | None = None ,
89- ) -> DiskLayoutConfiguration | None :
89+ ) -> Self | None :
9090 from archinstall .lib .disk .device_handler import device_handler
9191
9292 device_modifications : list [DeviceModification ] = []
@@ -223,7 +223,7 @@ def is_mbr(self) -> bool:
223223 return self == PartitionTable .MBR
224224
225225 @classmethod
226- def default (cls ) -> PartitionTable :
226+ def default (cls ) -> Self :
227227 return cls .GPT if SysInfo .has_uefi () else cls .MBR
228228
229229
@@ -293,7 +293,7 @@ def json(self) -> _SectorSizeSerialization:
293293 }
294294
295295 @classmethod
296- def parse_args (cls , arg : _SectorSizeSerialization ) -> SectorSize :
296+ def parse_args (cls , arg : _SectorSizeSerialization ) -> Self :
297297 return cls (
298298 arg ['value' ],
299299 Unit [arg ['unit' ]],
@@ -330,7 +330,7 @@ def json(self) -> _SizeSerialization:
330330 }
331331
332332 @classmethod
333- def parse_args (cls , size_arg : _SizeSerialization ) -> Size :
333+ def parse_args (cls , size_arg : _SizeSerialization ) -> Self :
334334 sector_size = size_arg ['sector_size' ]
335335
336336 return cls (
@@ -537,7 +537,7 @@ def from_partition(
537537 lsblk_info : LsblkInfo ,
538538 fs_type : FilesystemType | None ,
539539 btrfs_subvol_infos : list [_BtrfsSubvolumeInfo ] = [],
540- ) -> _PartitionInfo :
540+ ) -> Self :
541541 partition_type = PartitionType .get_type_from_code (partition .type )
542542 flags = [f for f in PartitionFlag if partition .getFlag (f .flag_id )]
543543
@@ -595,7 +595,7 @@ def table_data(self) -> dict[str, str | int | bool]:
595595 }
596596
597597 @classmethod
598- def from_disk (cls , disk : Disk ) -> _DeviceInfo :
598+ def from_disk (cls , disk : Disk ) -> Self :
599599 device = disk .device
600600 if device .type == 18 :
601601 device_type = 'loop'
@@ -631,11 +631,11 @@ class SubvolumeModification:
631631 mountpoint : Path | None = None
632632
633633 @classmethod
634- def from_existing_subvol_info (cls , info : _BtrfsSubvolumeInfo ) -> SubvolumeModification :
634+ def from_existing_subvol_info (cls , info : _BtrfsSubvolumeInfo ) -> Self :
635635 return cls (info .name , mountpoint = info .mountpoint )
636636
637637 @classmethod
638- def parse_args (cls , subvol_args : list [_SubvolumeModificationSerialization ]) -> list [SubvolumeModification ]:
638+ def parse_args (cls , subvol_args : list [_SubvolumeModificationSerialization ]) -> list [Self ]:
639639 mods = []
640640 for entry in subvol_args :
641641 if not entry .get ('name' , None ) or not entry .get ('mountpoint' , None ):
@@ -721,7 +721,7 @@ class PartitionType(Enum):
721721 _Unknown = 'unknown'
722722
723723 @classmethod
724- def get_type_from_code (cls , code : int ) -> PartitionType :
724+ def get_type_from_code (cls , code : int ) -> Self :
725725 if code == parted .PARTITION_NORMAL :
726726 return cls .Primary
727727 else :
@@ -754,7 +754,7 @@ def description(self) -> str:
754754 return self .alias or self .name .lower ()
755755
756756 @classmethod
757- def from_string (cls , s : str ) -> PartitionFlag | None :
757+ def from_string (cls , s : str ) -> Self | None :
758758 s = s .lower ()
759759
760760 for partition_flag in cls :
@@ -911,7 +911,7 @@ def safe_fs_type(self) -> FilesystemType:
911911 return self .fs_type
912912
913913 @classmethod
914- def from_existing_partition (cls , partition_info : _PartitionInfo ) -> PartitionModification :
914+ def from_existing_partition (cls , partition_info : _PartitionInfo ) -> Self :
915915 if partition_info .btrfs_subvol_infos :
916916 mountpoint = None
917917 subvol_mods = []
@@ -1431,7 +1431,7 @@ class EncryptionType(Enum):
14311431 LuksOnLvm = 'luks_on_lvm'
14321432
14331433 @classmethod
1434- def _encryption_type_mapper (cls ) -> dict [str , 'EncryptionType' ]:
1434+ def _encryption_type_mapper (cls ) -> dict [str , Self ]:
14351435 return {
14361436 tr ('No Encryption' ): cls .NoEncryption ,
14371437 tr ('LUKS' ): cls .Luks ,
@@ -1440,7 +1440,7 @@ def _encryption_type_mapper(cls) -> dict[str, 'EncryptionType']:
14401440 }
14411441
14421442 @classmethod
1443- def text_to_type (cls , text : str ) -> 'EncryptionType' :
1443+ def text_to_type (cls , text : str ) -> Self :
14441444 mapping = cls ._encryption_type_mapper ()
14451445 return mapping [text ]
14461446
@@ -1518,7 +1518,7 @@ def parse_arg(
15181518 disk_config : DiskLayoutConfiguration ,
15191519 disk_encryption : _DiskEncryptionSerialization ,
15201520 password : Password | None = None ,
1521- ) -> 'DiskEncryption | None' :
1521+ ) -> Self | None :
15221522 if not cls .validate_enc (disk_config .device_modifications , disk_config .lvm_config ):
15231523 return None
15241524
@@ -1580,7 +1580,7 @@ def table_data(self) -> dict[str, str]:
15801580 }
15811581
15821582 @classmethod
1583- def parse_arg (cls , arg : _Fido2DeviceSerialization ) -> 'Fido2Device' :
1583+ def parse_arg (cls , arg : _Fido2DeviceSerialization ) -> Self :
15841584 return cls (
15851585 Path (arg ['path' ]),
15861586 arg ['manufacturer' ],
0 commit comments