BIOSUtilities v24.10.23

New "package" flow, arguments now provided during utility call (README)
New "main" flow, using old "run_utility" method of BIOSUtility (README)
Removed "run_utility" and "show_version" methods from base BIOSUtility
Removed argparse argument parsing logic from base BIOSUtility class
Removed notion of "pause" (i.e. user action) from BIOSUtility logic
Adjusted the README with usage info for "main" and "package" flows
This commit is contained in:
Plato Mavropoulos 2024-10-23 13:24:16 +03:00
parent 35455f735c
commit d8e23f9ef3
24 changed files with 561 additions and 652 deletions

View file

@ -37,13 +37,11 @@ def to_ordinal(in_number: int) -> str:
def file_to_bytes(in_object: str | bytes | bytearray) -> bytes:
""" Get bytes from given buffer or file path """
if not isinstance(in_object, (bytes, bytearray)):
with open(to_string(in_object=in_object), 'rb') as object_data:
object_bytes: bytes = object_data.read()
else:
object_bytes = in_object
if isinstance(in_object, str):
with open(in_object, 'rb') as object_fp:
return object_fp.read()
return object_bytes
return bytes(in_object)
def bytes_to_hex(in_buffer: bytes, order: str, data_len: int, slice_len: int | None = None) -> str: