INNER CODE UNIT · Python
format_size
autokitteh/autokitteh · runtimes/pythonrt/runner/main.py:247
def format_size(size):
if size < 1024:
return f"{size} B"
elif size < 1024 * 1024:
return f"{size // 1024} KB"
else:
return f"{size // (1024 * 1024)} MB"
def pickleable_exception(err):
"""Convert Exception to be pickleable by making un-pickled attribute None."""
# Make Err subclass to exception handling will work
class Err(err.__class__):
def __init__(self):
pass # Override super __init__ with no arguments
perr = Err()