Fix: indenting
This commit is contained in:
parent
78db9902b0
commit
f74578d26a
1 changed files with 16 additions and 16 deletions
|
@ -21,22 +21,22 @@ def get_urls(string:str = None) -> list:
|
||||||
|
|
||||||
|
|
||||||
def convert_size(size_bytes: int) -> str:
|
def convert_size(size_bytes: int) -> str:
|
||||||
"""
|
"""
|
||||||
A function that converts the given size in bytes to a human-readable format.
|
A function that converts the given size in bytes to a human-readable format.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
size_bytes (int): An integer representing the size in bytes to be converted.
|
size_bytes (int): An integer representing the size in bytes to be converted.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
A string representing the converted size with the appropriate unit (B, KiB, MiB, GiB, etc.).
|
A string representing the converted size with the appropriate unit (B, KiB, MiB, GiB, etc.).
|
||||||
"""
|
"""
|
||||||
if size_bytes == 0:
|
if size_bytes == 0:
|
||||||
return "0B"
|
return "0B"
|
||||||
size_name = ("B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB")
|
size_name = ("B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB")
|
||||||
i = int(math.floor(math.log(size_bytes, 1024)))
|
i = int(math.floor(math.log(size_bytes, 1024)))
|
||||||
p = math.pow(1024, i)
|
p = math.pow(1024, i)
|
||||||
s = round(size_bytes / p, 2)
|
s = round(size_bytes / p, 2)
|
||||||
return f"{s} {size_name[i]}"
|
return f"{s} {size_name[i]}"
|
||||||
|
|
||||||
|
|
||||||
def is_string_html(string: str) -> bool:
|
def is_string_html(string: str) -> bool:
|
||||||
|
|
Loading…
Reference in a new issue