mirror of
https://github.com/Textualize/rich.git
synced 2025-08-19 01:40:37 +00:00
Added optional type hinting
This commit is contained in:
parent
9564ac5462
commit
74ae964858
1 changed files with 4 additions and 4 deletions
|
@ -13,15 +13,15 @@ See Also:
|
|||
|
||||
__all__ = ["decimal"]
|
||||
|
||||
from typing import Iterable, List, Tuple
|
||||
from typing import Iterable, List, Tuple, Optional
|
||||
|
||||
|
||||
def _to_str(
|
||||
size: int,
|
||||
suffixes: Iterable[str],
|
||||
base: int,
|
||||
precision: int = 1,
|
||||
separator: str = " ",
|
||||
precision: Optional[int] = 1,
|
||||
separator: Optional[str] = " ",
|
||||
) -> str:
|
||||
if size == 1:
|
||||
return "1 byte"
|
||||
|
@ -49,7 +49,7 @@ def pick_unit_and_suffix(size: int, suffixes: List[str], base: int) -> Tuple[int
|
|||
return unit, suffix
|
||||
|
||||
|
||||
def decimal(size: int, precision: int = 1, separator: str = " ") -> str:
|
||||
def decimal(size: int, precision: Optional[int] = 1, separator: Optional[str] = " ") -> str:
|
||||
"""Convert a filesize in to a string (powers of 1000, SI prefixes).
|
||||
|
||||
In this convention, ``1000 B = 1 kB``.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue