mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-25 21:31:09 +08:00
Use better types for time.get_clock_info (#7040)
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
import sys
|
||||
from _typeshed import structseq
|
||||
from types import SimpleNamespace
|
||||
from typing import Any, Union
|
||||
from typing_extensions import final
|
||||
from typing import Any, Protocol, Union
|
||||
from typing_extensions import Literal, final
|
||||
|
||||
_TimeTuple = tuple[int, int, int, int, int, int, int, int, int]
|
||||
|
||||
@@ -80,7 +79,13 @@ def time() -> float: ...
|
||||
if sys.platform != "win32":
|
||||
def tzset() -> None: ... # Unix only
|
||||
|
||||
def get_clock_info(name: str) -> SimpleNamespace: ...
|
||||
class _ClockInfo(Protocol):
|
||||
adjustable: bool
|
||||
implementation: str
|
||||
monotonic: bool
|
||||
resolution: float
|
||||
|
||||
def get_clock_info(name: Literal["monotonic", "perf_counter", "process_time", "time", "thread_time"]) -> _ClockInfo: ...
|
||||
def monotonic() -> float: ...
|
||||
def perf_counter() -> float: ...
|
||||
def process_time() -> float: ...
|
||||
|
||||
Reference in New Issue
Block a user