From b98cd0c3b0cc6ac25596c204930f2c69cd528540 Mon Sep 17 00:00:00 2001 From: Huw Jones Date: Thu, 28 Oct 2021 15:16:54 +0100 Subject: [PATCH] Annotate humanfriendly.__init__.pyi (#6209) --- .../humanfriendly/humanfriendly/__init__.pyi | 43 ++++++++++--------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/stubs/humanfriendly/humanfriendly/__init__.pyi b/stubs/humanfriendly/humanfriendly/__init__.pyi index 1e6877718..6630b1a4a 100644 --- a/stubs/humanfriendly/humanfriendly/__init__.pyi +++ b/stubs/humanfriendly/humanfriendly/__init__.pyi @@ -1,32 +1,33 @@ -from typing import Any, NamedTuple +import datetime +from typing import Any, NamedTuple, Pattern class SizeUnit(NamedTuple): - divider: Any - symbol: Any - name: Any + divider: int + symbol: str + name: str class CombinedUnit(NamedTuple): - decimal: Any - binary: Any + decimal: SizeUnit + binary: SizeUnit disk_size_units: Any length_size_units: Any time_units: Any -def coerce_boolean(value): ... -def coerce_pattern(value, flags: int = ...): ... -def coerce_seconds(value): ... -def format_size(num_bytes, keep_width: bool = ..., binary: bool = ...): ... -def parse_size(size, binary: bool = ...): ... -def format_length(num_metres, keep_width: bool = ...): ... -def parse_length(length): ... -def format_number(number, num_decimals: int = ...): ... -def round_number(count, keep_width: bool = ...): ... -def format_timespan(num_seconds, detailed: bool = ..., max_units: int = ...): ... -def parse_timespan(timespan): ... -def parse_date(datestring): ... -def format_path(pathname): ... -def parse_path(pathname): ... +def coerce_boolean(value: object) -> bool: ... +def coerce_pattern(value: str | Pattern[str], flags: int = ...) -> Pattern[str]: ... +def coerce_seconds(value: float | datetime.timedelta) -> float: ... +def format_size(num_bytes: float, keep_width: bool = ..., binary: bool = ...) -> str: ... +def parse_size(size: str, binary: bool = ...) -> int: ... +def format_length(num_metres: float, keep_width: bool = ...) -> str: ... +def parse_length(length: str) -> float: ... +def format_number(number: float, num_decimals: int = ...) -> str: ... +def round_number(count: float, keep_width: bool = ...) -> str: ... +def format_timespan(num_seconds: float | datetime.timedelta, detailed: bool = ..., max_units: int = ...) -> str: ... +def parse_timespan(timespan: str) -> float: ... +def parse_date(datestring: str) -> tuple[int, int, int, int, int, int]: ... +def format_path(pathname: str) -> str: ... +def parse_path(pathname: str) -> str: ... class Timer: monotonic: bool @@ -36,7 +37,7 @@ class Timer: def __init__(self, start_time: Any | None = ..., resumable: bool = ...) -> None: ... def __enter__(self): ... def __exit__(self, exc_type: Any | None = ..., exc_value: Any | None = ..., traceback: Any | None = ...) -> None: ... - def sleep(self, seconds) -> None: ... + def sleep(self, seconds: float) -> None: ... @property def elapsed_time(self): ... @property