1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-06-17 00:07:37 +02:00

formatting

This commit is contained in:
Kelly Brazil
2023-12-10 10:41:09 -08:00
parent e835227027
commit c8fb56c601
2 changed files with 38 additions and 36 deletions

View File

@ -196,29 +196,30 @@ Parameters:
(base-2) for ambiguous unit symbols and names, (base-2) for ambiguous unit symbols and names,
`False` to use decimal multiples of bytes (base-10). `False` to use decimal multiples of bytes (base-10).
Returns: Returns:
integer/None Integer if successful conversion, otherwise None integer/None Integer if successful conversion, otherwise None
This function knows how to parse sizes in bytes, kilobytes, megabytes, This function knows how to parse sizes in bytes, kilobytes, megabytes,
gigabytes, terabytes and petabytes. Some examples: gigabytes, terabytes and petabytes. Some examples:
>>> convert_size_to_int('42') >>> convert_size_to_int('42')
42 42
>>> convert_size_to_int('13b') >>> convert_size_to_int('13b')
13 13
>>> convert_size_to_int('5 bytes') >>> convert_size_to_int('5 bytes')
5 5
>>> convert_size_to_int('1 KB') >>> convert_size_to_int('1 KB')
1000 1000
>>> convert_size_to_int('1 kilobyte') >>> convert_size_to_int('1 kilobyte')
1000 1000
>>> convert_size_to_int('1 KiB') >>> convert_size_to_int('1 KiB')
1024 1024
>>> convert_size_to_int('1 KB', binary=True) >>> convert_size_to_int('1 KB', binary=True)
1024 1024
>>> convert_size_to_int('1.5 GB') >>> convert_size_to_int('1.5 GB')
1500000000 1500000000
>>> convert_size_to_int('1.5 GB', binary=True) >>> convert_size_to_int('1.5 GB', binary=True)
1610612736 1610612736
<a id="jc.utils.input_type_check"></a> <a id="jc.utils.input_type_check"></a>

View File

@ -309,29 +309,30 @@ def convert_size_to_int(size: str, binary: bool = False) -> Optional[int]:
(base-2) for ambiguous unit symbols and names, (base-2) for ambiguous unit symbols and names,
`False` to use decimal multiples of bytes (base-10). `False` to use decimal multiples of bytes (base-10).
Returns: Returns:
integer/None Integer if successful conversion, otherwise None integer/None Integer if successful conversion, otherwise None
This function knows how to parse sizes in bytes, kilobytes, megabytes, This function knows how to parse sizes in bytes, kilobytes, megabytes,
gigabytes, terabytes and petabytes. Some examples: gigabytes, terabytes and petabytes. Some examples:
>>> convert_size_to_int('42') >>> convert_size_to_int('42')
42 42
>>> convert_size_to_int('13b') >>> convert_size_to_int('13b')
13 13
>>> convert_size_to_int('5 bytes') >>> convert_size_to_int('5 bytes')
5 5
>>> convert_size_to_int('1 KB') >>> convert_size_to_int('1 KB')
1000 1000
>>> convert_size_to_int('1 kilobyte') >>> convert_size_to_int('1 kilobyte')
1000 1000
>>> convert_size_to_int('1 KiB') >>> convert_size_to_int('1 KiB')
1024 1024
>>> convert_size_to_int('1 KB', binary=True) >>> convert_size_to_int('1 KB', binary=True)
1024 1024
>>> convert_size_to_int('1.5 GB') >>> convert_size_to_int('1.5 GB')
1500000000 1500000000
>>> convert_size_to_int('1.5 GB', binary=True) >>> convert_size_to_int('1.5 GB', binary=True)
1610612736 1610612736
""" """
def tokenize(text: str) -> List[str]: def tokenize(text: str) -> List[str]:
tokenized_input: List = [] tokenized_input: List = []