Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall
diff options
context:
space:
mode:
authorSamaoo <sam.verhaegen2003@gmail.com>2022-08-01 14:07:04 +0200
committerGitHub <noreply@github.com>2022-08-01 14:07:04 +0200
commit5626c109272b7d34d25facbd2b22f466bf1f4ce2 (patch)
tree094468e9b32b1eb5c0c802eb488fc54e5b660cd0 /archinstall
parent68d89a07dfbf298918dc5575bec00976f3ae5dd6 (diff)
fix `valid_parted_position()` (#1382)
* fix `valid_parted_position()` * make lines shorter * change `pos` to `pos.lower()` * revert changing `if not len(pos):` to `if not pos:` * `b` can not have decimal places * add `.lower()`
Diffstat (limited to 'archinstall')
-rw-r--r--archinstall/lib/disk/validators.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/archinstall/lib/disk/validators.py b/archinstall/lib/disk/validators.py
index fd1b7f33..54808886 100644
--- a/archinstall/lib/disk/validators.py
+++ b/archinstall/lib/disk/validators.py
@@ -7,13 +7,11 @@ def valid_parted_position(pos :str) -> bool:
if pos.isdigit():
return True
- if pos[-1] == '%' and pos[:-1].isdigit():
+ if pos.lower().endswith('b') and pos[:-1].isdigit():
return True
- if pos[-3:].lower() in ['mib', 'kib', 'b', 'tib'] and pos[:-3].replace(".", "", 1).isdigit():
- return True
-
- if pos[-2:].lower() in ['kb', 'mb', 'gb', 'tb'] and pos[:-2].replace(".", "", 1).isdigit():
+ if any(pos.lower().endswith(size) and pos[:-len(size)].replace(".", "", 1).isdigit()
+ for size in ['%', 'kb', 'mb', 'gb', 'tb', 'kib', 'mib', 'gib', 'tib']):
return True
return False