multiCMD 1.65__tar.gz → 1.66__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {multicmd-1.65 → multicmd-1.66}/PKG-INFO +20 -1
- {multicmd-1.65 → multicmd-1.66}/README.md +19 -0
- {multicmd-1.65 → multicmd-1.66}/multiCMD.egg-info/PKG-INFO +20 -1
- {multicmd-1.65 → multicmd-1.66}/multiCMD.py +87 -37
- multicmd-1.66/tests/test_helpers.py +888 -0
- {multicmd-1.65 → multicmd-1.66}/tests/test_windows.py +37 -5
- multicmd-1.65/tests/test_helpers.py +0 -423
- {multicmd-1.65 → multicmd-1.66}/LICENSE +0 -0
- {multicmd-1.65 → multicmd-1.66}/multiCMD.egg-info/SOURCES.txt +0 -0
- {multicmd-1.65 → multicmd-1.66}/multiCMD.egg-info/dependency_links.txt +0 -0
- {multicmd-1.65 → multicmd-1.66}/multiCMD.egg-info/entry_points.txt +0 -0
- {multicmd-1.65 → multicmd-1.66}/multiCMD.egg-info/top_level.txt +0 -0
- {multicmd-1.65 → multicmd-1.66}/scripts/multiCMD +0 -0
- {multicmd-1.65 → multicmd-1.66}/setup.cfg +0 -0
- {multicmd-1.65 → multicmd-1.66}/setup.py +0 -0
- {multicmd-1.65 → multicmd-1.66}/tests/test_api.py +0 -0
- {multicmd-1.65 → multicmd-1.66}/tests/test_async_executor.py +0 -0
- {multicmd-1.65 → multicmd-1.66}/tests/test_cli.py +0 -0
- {multicmd-1.65 → multicmd-1.66}/tests/test_cli_closed_stdout.py +0 -0
- {multicmd-1.65 → multicmd-1.66}/tests/test_cli_failed_stdout.py +0 -0
- {multicmd-1.65 → multicmd-1.66}/tests/test_cli_input.py +0 -0
- {multicmd-1.65 → multicmd-1.66}/tests/test_cli_summary.py +0 -0
- {multicmd-1.65 → multicmd-1.66}/tests/test_display.py +0 -0
- {multicmd-1.65 → multicmd-1.66}/tests/test_embed.py +0 -0
- {multicmd-1.65 → multicmd-1.66}/tests/test_env.py +0 -0
- {multicmd-1.65 → multicmd-1.66}/tests/test_expand_ranges.py +0 -0
- {multicmd-1.65 → multicmd-1.66}/tests/test_handover.py +0 -0
- {multicmd-1.65 → multicmd-1.66}/tests/test_interrupts.py +0 -0
- {multicmd-1.65 → multicmd-1.66}/tests/test_packaging.py +0 -0
- {multicmd-1.65 → multicmd-1.66}/tests/test_parsing.py +0 -0
- {multicmd-1.65 → multicmd-1.66}/tests/test_pass_fds.py +0 -0
- {multicmd-1.65 → multicmd-1.66}/tests/test_ping.py +0 -0
- {multicmd-1.65 → multicmd-1.66}/tests/test_pool.py +0 -0
- {multicmd-1.65 → multicmd-1.66}/tests/test_process_groups.py +0 -0
- {multicmd-1.65 → multicmd-1.66}/tests/test_pty.py +0 -0
- {multicmd-1.65 → multicmd-1.66}/tests/test_reader.py +0 -0
- {multicmd-1.65 → multicmd-1.66}/tests/test_reader_quit.py +0 -0
- {multicmd-1.65 → multicmd-1.66}/tests/test_regressions.py +0 -0
- {multicmd-1.65 → multicmd-1.66}/tests/test_run_command.py +0 -0
- {multicmd-1.65 → multicmd-1.66}/tests/test_run_commands.py +0 -0
- {multicmd-1.65 → multicmd-1.66}/tests/test_sudo.py +0 -0
- {multicmd-1.65 → multicmd-1.66}/tests/test_supervision.py +0 -0
- {multicmd-1.65 → multicmd-1.66}/tests/test_task.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: multiCMD
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.66
|
|
4
4
|
Summary: Run commands simultaneously
|
|
5
5
|
Home-page: https://github.com/yufei-pan/multiCMD
|
|
6
6
|
Author: Yufei Pan
|
|
@@ -559,6 +559,25 @@ pytest -m "not slow" # skip intentional sleep-heavy cases
|
|
|
559
559
|
|
|
560
560
|
`test_expand_ranges_perf.py` is a manual performance microbenchmark and is not collected by pytest.
|
|
561
561
|
|
|
562
|
+
## Upgrading to 1.66 from 1.65
|
|
563
|
+
|
|
564
|
+
- Nothing needs doing for `mcmd`, which is unchanged, nor for hpcp 9.92, which checks its sizes itself. hpcp up to 9.91
|
|
565
|
+
hands `-L`, `-F`, `-dis` and `-ddr` to `format_bytes()` as typed and takes its `0` as the size: with 1.66 a value
|
|
566
|
+
with text after the size is `0`, so `-L 10MB/s` there is no limit and `-ddr 100G,50G` a 0-byte partition (1.65
|
|
567
|
+
read 100 G). Upgrade hpcp to 9.92 before or with 1.66, as for 1.65.
|
|
568
|
+
- Changed, library: at a terminal `input_with_timeout_and_countdown()` returns when its timeout runs out, whatever was
|
|
569
|
+
typed: text with no Enter (typed, then one Ctrl-D) is no answer, and a program that loaded `readline` waits no longer
|
|
570
|
+
(1.65: it waited for the line to end). With `readline` loaded, only the terminal's own editing works at this prompt
|
|
571
|
+
([docs/limitations.md](docs/limitations.md)). A line ended before then, by Enter or by the end of the input, is the
|
|
572
|
+
answer. `timeout` may be a float (1.65: `TypeError`). A stdin that is not a terminal is read as in 1.65: a pipe that
|
|
573
|
+
sent part of a line still holds the call ([docs/limitations.md](docs/limitations.md)). On Windows a key pressed with
|
|
574
|
+
no Enter still holds it ([docs/limitations.md](docs/limitations.md)). A program that read part of a line at a
|
|
575
|
+
terminal itself keeps the rest of it ([docs/limitations.md](docs/limitations.md)).
|
|
576
|
+
- Changed, library: `format_bytes()` takes a string only when all of it is a size: text after the unit (`'5Gb/s'`, `'1e9'`,
|
|
577
|
+
`'5 kB extra'`) or an `i` with no prefix (`'5 iB'`) gives `0` and the "Invalid size format" line, as an unknown unit does
|
|
578
|
+
(1.65: it read the start). Blanks around the size are fine, now before it too. A unit after a number that ends in a point
|
|
579
|
+
is read (`'5.G'`: 5 G; 1.65: 5). With `to_str` such a string comes back as given.
|
|
580
|
+
|
|
562
581
|
## Upgrading to 1.65 from 1.64
|
|
563
582
|
|
|
564
583
|
- Nothing needs doing for `mcmd`, which is unchanged. hpcp users upgrade hpcp to 9.92 before or with multiCMD 1.65: hpcp up
|
|
@@ -533,6 +533,25 @@ pytest -m "not slow" # skip intentional sleep-heavy cases
|
|
|
533
533
|
|
|
534
534
|
`test_expand_ranges_perf.py` is a manual performance microbenchmark and is not collected by pytest.
|
|
535
535
|
|
|
536
|
+
## Upgrading to 1.66 from 1.65
|
|
537
|
+
|
|
538
|
+
- Nothing needs doing for `mcmd`, which is unchanged, nor for hpcp 9.92, which checks its sizes itself. hpcp up to 9.91
|
|
539
|
+
hands `-L`, `-F`, `-dis` and `-ddr` to `format_bytes()` as typed and takes its `0` as the size: with 1.66 a value
|
|
540
|
+
with text after the size is `0`, so `-L 10MB/s` there is no limit and `-ddr 100G,50G` a 0-byte partition (1.65
|
|
541
|
+
read 100 G). Upgrade hpcp to 9.92 before or with 1.66, as for 1.65.
|
|
542
|
+
- Changed, library: at a terminal `input_with_timeout_and_countdown()` returns when its timeout runs out, whatever was
|
|
543
|
+
typed: text with no Enter (typed, then one Ctrl-D) is no answer, and a program that loaded `readline` waits no longer
|
|
544
|
+
(1.65: it waited for the line to end). With `readline` loaded, only the terminal's own editing works at this prompt
|
|
545
|
+
([docs/limitations.md](docs/limitations.md)). A line ended before then, by Enter or by the end of the input, is the
|
|
546
|
+
answer. `timeout` may be a float (1.65: `TypeError`). A stdin that is not a terminal is read as in 1.65: a pipe that
|
|
547
|
+
sent part of a line still holds the call ([docs/limitations.md](docs/limitations.md)). On Windows a key pressed with
|
|
548
|
+
no Enter still holds it ([docs/limitations.md](docs/limitations.md)). A program that read part of a line at a
|
|
549
|
+
terminal itself keeps the rest of it ([docs/limitations.md](docs/limitations.md)).
|
|
550
|
+
- Changed, library: `format_bytes()` takes a string only when all of it is a size: text after the unit (`'5Gb/s'`, `'1e9'`,
|
|
551
|
+
`'5 kB extra'`) or an `i` with no prefix (`'5 iB'`) gives `0` and the "Invalid size format" line, as an unknown unit does
|
|
552
|
+
(1.65: it read the start). Blanks around the size are fine, now before it too. A unit after a number that ends in a point
|
|
553
|
+
is read (`'5.G'`: 5 G; 1.65: 5). With `to_str` such a string comes back as given.
|
|
554
|
+
|
|
536
555
|
## Upgrading to 1.65 from 1.64
|
|
537
556
|
|
|
538
557
|
- Nothing needs doing for `mcmd`, which is unchanged. hpcp users upgrade hpcp to 9.92 before or with multiCMD 1.65: hpcp up
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: multiCMD
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.66
|
|
4
4
|
Summary: Run commands simultaneously
|
|
5
5
|
Home-page: https://github.com/yufei-pan/multiCMD
|
|
6
6
|
Author: Yufei Pan
|
|
@@ -559,6 +559,25 @@ pytest -m "not slow" # skip intentional sleep-heavy cases
|
|
|
559
559
|
|
|
560
560
|
`test_expand_ranges_perf.py` is a manual performance microbenchmark and is not collected by pytest.
|
|
561
561
|
|
|
562
|
+
## Upgrading to 1.66 from 1.65
|
|
563
|
+
|
|
564
|
+
- Nothing needs doing for `mcmd`, which is unchanged, nor for hpcp 9.92, which checks its sizes itself. hpcp up to 9.91
|
|
565
|
+
hands `-L`, `-F`, `-dis` and `-ddr` to `format_bytes()` as typed and takes its `0` as the size: with 1.66 a value
|
|
566
|
+
with text after the size is `0`, so `-L 10MB/s` there is no limit and `-ddr 100G,50G` a 0-byte partition (1.65
|
|
567
|
+
read 100 G). Upgrade hpcp to 9.92 before or with 1.66, as for 1.65.
|
|
568
|
+
- Changed, library: at a terminal `input_with_timeout_and_countdown()` returns when its timeout runs out, whatever was
|
|
569
|
+
typed: text with no Enter (typed, then one Ctrl-D) is no answer, and a program that loaded `readline` waits no longer
|
|
570
|
+
(1.65: it waited for the line to end). With `readline` loaded, only the terminal's own editing works at this prompt
|
|
571
|
+
([docs/limitations.md](docs/limitations.md)). A line ended before then, by Enter or by the end of the input, is the
|
|
572
|
+
answer. `timeout` may be a float (1.65: `TypeError`). A stdin that is not a terminal is read as in 1.65: a pipe that
|
|
573
|
+
sent part of a line still holds the call ([docs/limitations.md](docs/limitations.md)). On Windows a key pressed with
|
|
574
|
+
no Enter still holds it ([docs/limitations.md](docs/limitations.md)). A program that read part of a line at a
|
|
575
|
+
terminal itself keeps the rest of it ([docs/limitations.md](docs/limitations.md)).
|
|
576
|
+
- Changed, library: `format_bytes()` takes a string only when all of it is a size: text after the unit (`'5Gb/s'`, `'1e9'`,
|
|
577
|
+
`'5 kB extra'`) or an `i` with no prefix (`'5 iB'`) gives `0` and the "Invalid size format" line, as an unknown unit does
|
|
578
|
+
(1.65: it read the start). Blanks around the size are fine, now before it too. A unit after a number that ends in a point
|
|
579
|
+
is read (`'5.G'`: 5 G; 1.65: 5). With `to_str` such a string comes back as given.
|
|
580
|
+
|
|
562
581
|
## Upgrading to 1.65 from 1.64
|
|
563
582
|
|
|
564
583
|
- Nothing needs doing for `mcmd`, which is unchanged. hpcp users upgrade hpcp to 9.92 before or with multiCMD 1.65: hpcp up
|
|
@@ -29,9 +29,9 @@ import traceback
|
|
|
29
29
|
from pprint import pformat
|
|
30
30
|
|
|
31
31
|
#%% global vars
|
|
32
|
-
version = '1.
|
|
32
|
+
version = '1.66'
|
|
33
33
|
__version__ = version
|
|
34
|
-
COMMIT_DATE = '2026-11-
|
|
34
|
+
COMMIT_DATE = '2026-11-14'
|
|
35
35
|
# fire-and-forget threads (run_commands with wait_for_return=False) that join_threads() waits on. multiCMD takes no
|
|
36
36
|
# lock for it: each update is one set operation and each snapshot one set.copy(), as for _live_procs below
|
|
37
37
|
__running_threads = set()
|
|
@@ -3250,55 +3250,102 @@ def _run_cli():
|
|
|
3250
3250
|
#%% misc functions
|
|
3251
3251
|
def input_with_timeout_and_countdown(timeout, prompt='Please enter your selection'):
|
|
3252
3252
|
"""
|
|
3253
|
-
Read
|
|
3253
|
+
Read a line from the user, counting down timeout seconds. The prompt and its countdown go to stderr, after what is
|
|
3254
3254
|
waiting in stdout's buffer ( the caller's question ); one that cannot be written is dropped, and the timeout still applies.
|
|
3255
3255
|
|
|
3256
3256
|
@params:
|
|
3257
|
-
timeout: The timeout in seconds
|
|
3257
|
+
timeout: The timeout in seconds, an int or a float ( the countdown shows the seconds left, rounded up )
|
|
3258
3258
|
prompt: The prompt to display to the user
|
|
3259
3259
|
|
|
3260
3260
|
@returns:
|
|
3261
|
-
str: The
|
|
3262
|
-
or
|
|
3261
|
+
str: The line typed before the timeout ran out, stripped ( Enter ends it, and so does the end of the input after text );
|
|
3262
|
+
or None if no input was received by then: text not ended, and a stdin that has ended, is closed or is missing
|
|
3263
|
+
( Ctrl-D, /dev/null ), count as no answer, and the call returns when the timeout runs out, never sooner, and at a
|
|
3264
|
+
terminal never later ( a stdin that is not a terminal, and Windows: docs/limitations.md )
|
|
3263
3265
|
|
|
3264
3266
|
"""
|
|
3265
3267
|
# the question the caller printed goes out first; the prompt and its countdown are for the person at the terminal, not for
|
|
3266
3268
|
# stdout's reader: they go to stderr, as read -p's and rm -i's do, and one that cannot be written is dropped
|
|
3267
3269
|
_display.flush()
|
|
3268
|
-
_write_error(f"{prompt} [{timeout}s]: ", end='')
|
|
3270
|
+
_write_error(f"{prompt} [{math.ceil(timeout)}s]: ", end='')
|
|
3269
3271
|
# select() cannot watch stdin on Windows; msvcrt can tell whether a key is waiting
|
|
3270
3272
|
try:
|
|
3271
3273
|
import msvcrt
|
|
3272
3274
|
except ImportError:
|
|
3273
3275
|
msvcrt = None
|
|
3274
|
-
# a stdin
|
|
3275
|
-
# countdown early: the default applies when it ends, and a Ctrl-C still aborts. It is asked again every second, as the
|
|
3276
|
-
# countdown is still asking: a terminal can answer after a Ctrl-D ( one select() and one input() a second: no busy loop )
|
|
3276
|
+
# a stdin that is missing or closed is not asked: the countdown runs out
|
|
3277
3277
|
no_stdin = sys.stdin is None or getattr(sys.stdin, 'closed', False)
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
#
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3278
|
+
fd = None
|
|
3279
|
+
if msvcrt is None and not no_stdin:
|
|
3280
|
+
# a stdin select() cannot watch ( no descriptor: a StringIO ) raises here: it was not asked, so it is not "no answer"
|
|
3281
|
+
fd = sys.stdin.fileno()
|
|
3282
|
+
# the count is by the clock. A terminal is read by its descriptor, and only as far as select() says there is something:
|
|
3283
|
+
# input() would wait for a whole line with no timeout ( text typed and then Ctrl-D, a program that loaded readline ). In
|
|
3284
|
+
# its line mode it gives at most a line per read, and must be read in whole reads: macOS tells text that a Ctrl-D handed
|
|
3285
|
+
# over from the end of the input only so; out of its line mode ( cbreak, raw ) one read gives all that was typed, the
|
|
3286
|
+
# next line with it, so it is read a byte at a time. Anything else ( a pipe, a file ) is read by Python itself, as in
|
|
3287
|
+
# 1.65: nobody is typing there, and only Python knows what the program's own reading already holds
|
|
3288
|
+
tty = canon = False
|
|
3289
|
+
if fd is not None:
|
|
3290
|
+
try:
|
|
3291
|
+
import termios
|
|
3292
|
+
canon = bool(termios.tcgetattr(fd)[3] & termios.ICANON)
|
|
3293
|
+
tty = True
|
|
3294
|
+
except Exception:
|
|
3295
|
+
# not a terminal, one that is gone, or no termios
|
|
3296
|
+
pass
|
|
3297
|
+
deadline = time.monotonic() + timeout
|
|
3298
|
+
typed = bytearray()
|
|
3299
|
+
shown = None
|
|
3300
|
+
while True:
|
|
3301
|
+
remaining = deadline - time.monotonic()
|
|
3302
|
+
seconds = max(math.ceil(remaining), 0)
|
|
3303
|
+
if seconds and seconds != shown:
|
|
3304
|
+
shown = seconds
|
|
3305
|
+
_write_error(f"\r{prompt} [{seconds}s]: ", end='')
|
|
3306
|
+
# stdin is watched until the next whole second, and asked once more when the countdown ends
|
|
3307
|
+
wait = remaining - (seconds - 1) if seconds else 0
|
|
3308
|
+
# ended: nothing waited for stdin this second ( none to watch, the console, or its end ), so time.sleep() waits
|
|
3309
|
+
ended = fd is None
|
|
3310
|
+
try:
|
|
3311
|
+
if msvcrt is not None:
|
|
3312
|
+
# the console is asked once a second
|
|
3313
|
+
if not no_stdin and msvcrt.kbhit():
|
|
3287
3314
|
return input().strip()
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3315
|
+
elif fd is not None and select.select([fd], [], [], wait)[0]:
|
|
3316
|
+
if not tty:
|
|
3317
|
+
return input().strip()
|
|
3318
|
+
data = os.read(fd, 4096 if canon else 1)
|
|
3319
|
+
typed += data
|
|
3320
|
+
if data and b'\n' not in data:
|
|
3321
|
+
# read on at once: the rest of the line is there, or comes. Once the countdown has ended, up to 4096 bytes: the longest
|
|
3322
|
+
# line a terminal's line mode takes in one piece ( Linux 4095 bytes and the newline, macOS 1023; measured ). So a line of
|
|
3323
|
+
# up to that length typed before the end is read to its end, also when that takes many reads ( out of the line mode a
|
|
3324
|
+
# read is a byte; a Ctrl-D splits a line ), and text that keeps coming stops within 4097 reads: more than 4096 bytes with
|
|
3325
|
+
# no end of the line is no answer
|
|
3326
|
+
if remaining <= 0 and len(typed) > 4096:
|
|
3327
|
+
return None
|
|
3328
|
+
continue
|
|
3329
|
+
if typed:
|
|
3330
|
+
# Enter, or the end of the input after text ( Ctrl-D twice )
|
|
3331
|
+
line = bytes(typed).split(b'\n', 1)[0]
|
|
3332
|
+
# decoded as stdin itself decodes: bytes that are not text are kept under the C locale ( surrogateescape ), and a
|
|
3333
|
+
# strict stdin raises, as in 1.65 and as input() does for any other stdin
|
|
3334
|
+
return line.decode(getattr(sys.stdin, 'encoding', None) or 'utf-8', getattr(sys.stdin, 'errors', None) or 'strict').strip()
|
|
3335
|
+
# a Ctrl-D: no answer this second
|
|
3336
|
+
ended = True
|
|
3337
|
+
except io.UnsupportedOperation:
|
|
3338
|
+
# a stdin that cannot be read ( one the program opened for writing ) was not asked: not "no answer", as in 1.65
|
|
3339
|
+
raise
|
|
3340
|
+
except (EOFError, OSError):
|
|
3341
|
+
# no answer this second, as in 1.65. EOFError: input() at the end of the input ( msvcrt's Ctrl-Z too ); OSError: the
|
|
3342
|
+
# descriptor closed, or its terminal gone
|
|
3343
|
+
ended = True
|
|
3344
|
+
if remaining <= 0:
|
|
3345
|
+
return None
|
|
3346
|
+
# an ended stdin is asked again at the next second, not in a busy loop: a terminal can answer after a Ctrl-D
|
|
3347
|
+
if ended:
|
|
3348
|
+
time.sleep(max(deadline - (seconds - 1) - time.monotonic(), 0))
|
|
3302
3349
|
|
|
3303
3350
|
def pretty_format_table(data, delimiter=None, header=None, full=False, remove_empty_columns=False):
|
|
3304
3351
|
import re
|
|
@@ -3626,7 +3673,10 @@ def format_bytes(size, use_1024_bytes=None, to_int=False, to_str=False, str_form
|
|
|
3626
3673
|
if isinstance(size, int):
|
|
3627
3674
|
return size
|
|
3628
3675
|
elif isinstance(size, str):
|
|
3629
|
-
|
|
3676
|
+
# the whole string is a size: a number, then a unit or none ( K to Y, an i after it for 1024s, a B at the end ), with
|
|
3677
|
+
# blanks around them; anything else, text after the unit too ( '5Gb/s', '1e9' ), is not one ( 1.65 read its start ).
|
|
3678
|
+
# The blanks around go by strip(): a \s* at each end of the pattern would retry every split of a long run of them
|
|
3679
|
+
match = re.fullmatch(r"(\d+(\.\d*)?)\s*((?:[kmgtpezyKMGTPEZY][iI]?)?[bB]?)", size.strip())
|
|
3630
3680
|
unit_labels = {
|
|
3631
3681
|
"": 0,
|
|
3632
3682
|
"k": 1,
|
|
@@ -3641,14 +3691,14 @@ def format_bytes(size, use_1024_bytes=None, to_int=False, to_str=False, str_form
|
|
|
3641
3691
|
if match:
|
|
3642
3692
|
number, _, unit = match.groups()
|
|
3643
3693
|
number = float(number)
|
|
3644
|
-
unit = unit.
|
|
3694
|
+
unit = unit.lower().rstrip("b")
|
|
3645
3695
|
if unit.endswith("i"):
|
|
3646
3696
|
use_1024_bytes = True
|
|
3647
3697
|
elif use_1024_bytes is None:
|
|
3648
3698
|
use_1024_bytes = False
|
|
3649
3699
|
unit = unit.rstrip("i")
|
|
3650
|
-
# no number,
|
|
3651
|
-
if not match
|
|
3700
|
+
# not a size: no number, a unit it does not know ( 1.64 returned None ), or text after it
|
|
3701
|
+
if not match:
|
|
3652
3702
|
if to_str:
|
|
3653
3703
|
return size
|
|
3654
3704
|
_write_error("Invalid size format. Expected format: 'number [unit]', e.g., '1.5 GiB' or '1.5GiB'\n" f"Got: {size}")
|