Skip to content

Commit e2bd7b3

Browse files
authored
Remove is_subpath() and use Path.is_relative_to() (#4372)
1 parent 56bec01 commit e2bd7b3

File tree

2 files changed

+1
-13
lines changed

2 files changed

+1
-13
lines changed

archinstall/lib/disk/device_handler.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
)
3737
from archinstall.lib.models.users import Password
3838
from archinstall.lib.output import debug, error, info, log
39-
from archinstall.lib.utils.util import is_subpath
4039

4140

4241
class DeviceHandler:
@@ -563,7 +562,7 @@ def detect_pre_mounted_mods(self, base_mountpoint: Path) -> list[DeviceModificat
563562
for device in self.devices:
564563
for part_info in device.partition_infos:
565564
for mountpoint in part_info.mountpoints:
566-
if is_subpath(mountpoint, base_mountpoint):
565+
if mountpoint.is_relative_to(base_mountpoint):
567566
path = Path(part_info.disk.device.path)
568567
part_mods.setdefault(path, [])
569568
part_mod = PartitionModification.from_existing_partition(part_info)

archinstall/lib/utils/util.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,6 @@ def generate_password(length: int = 64) -> str:
2020
return ''.join(secrets.choice(haystack) for _ in range(length))
2121

2222

23-
def is_subpath(first: Path, second: Path) -> bool:
24-
"""
25-
Check if _first_ a subpath of _second_
26-
"""
27-
try:
28-
first.relative_to(second)
29-
return True
30-
except ValueError:
31-
return False
32-
33-
3423
def format_cols(items: list[str], header: str | None = None) -> str:
3524
if header:
3625
text = f'{header}:\n'

0 commit comments

Comments
 (0)