Add sector unit (#1668)
This commit is contained in:
parent
114e3626e2
commit
6c87996201
|
|
@ -7,10 +7,12 @@ def valid_parted_position(pos :str) -> bool:
|
||||||
if pos.isdigit():
|
if pos.isdigit():
|
||||||
return True
|
return True
|
||||||
|
|
||||||
if pos.lower().endswith('b') and pos[:-1].isdigit():
|
pos_lower = pos.lower()
|
||||||
|
|
||||||
|
if (pos_lower.endswith('b') or pos_lower.endswith('s')) and pos[:-1].isdigit():
|
||||||
return True
|
return True
|
||||||
|
|
||||||
if any(pos.lower().endswith(size) and pos[:-len(size)].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']):
|
for size in ['%', 'kb', 'mb', 'gb', 'tb', 'kib', 'mib', 'gib', 'tib']):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue