mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 04:54:47 +08:00
Continuing work towards #8988. The first five commits were created using stubdefaulter on various Python versions; the following commits were all created manually by me to fix various problems. The main things this adds that weren't present in #9501 are: - Defaults in Windows-only modules and Windows-only branches (because I'm running a Windows machine) - Defaults in non-py311 branches - Defaults for float parameters - Defaults for overloads
88 lines
2.3 KiB
Python
88 lines
2.3 KiB
Python
import sys
|
|
from _typeshed import Unused
|
|
from enum import Enum
|
|
from typing_extensions import TypeAlias
|
|
|
|
# Because UUID has properties called int and bytes we need to rename these temporarily.
|
|
_Int: TypeAlias = int
|
|
_Bytes: TypeAlias = bytes
|
|
_FieldsType: TypeAlias = tuple[int, int, int, int, int, int]
|
|
|
|
class SafeUUID(Enum):
|
|
safe: int
|
|
unsafe: int
|
|
unknown: None
|
|
|
|
class UUID:
|
|
def __init__(
|
|
self,
|
|
hex: str | None = None,
|
|
bytes: _Bytes | None = None,
|
|
bytes_le: _Bytes | None = None,
|
|
fields: _FieldsType | None = None,
|
|
int: _Int | None = None,
|
|
version: _Int | None = None,
|
|
*,
|
|
is_safe: SafeUUID = ...,
|
|
) -> None: ...
|
|
@property
|
|
def is_safe(self) -> SafeUUID: ...
|
|
@property
|
|
def bytes(self) -> _Bytes: ...
|
|
@property
|
|
def bytes_le(self) -> _Bytes: ...
|
|
@property
|
|
def clock_seq(self) -> _Int: ...
|
|
@property
|
|
def clock_seq_hi_variant(self) -> _Int: ...
|
|
@property
|
|
def clock_seq_low(self) -> _Int: ...
|
|
@property
|
|
def fields(self) -> _FieldsType: ...
|
|
@property
|
|
def hex(self) -> str: ...
|
|
@property
|
|
def int(self) -> _Int: ...
|
|
@property
|
|
def node(self) -> _Int: ...
|
|
@property
|
|
def time(self) -> _Int: ...
|
|
@property
|
|
def time_hi_version(self) -> _Int: ...
|
|
@property
|
|
def time_low(self) -> _Int: ...
|
|
@property
|
|
def time_mid(self) -> _Int: ...
|
|
@property
|
|
def urn(self) -> str: ...
|
|
@property
|
|
def variant(self) -> str: ...
|
|
@property
|
|
def version(self) -> _Int | None: ...
|
|
def __int__(self) -> _Int: ...
|
|
def __eq__(self, other: object) -> bool: ...
|
|
def __lt__(self, other: UUID) -> bool: ...
|
|
def __le__(self, other: UUID) -> bool: ...
|
|
def __gt__(self, other: UUID) -> bool: ...
|
|
def __ge__(self, other: UUID) -> bool: ...
|
|
|
|
if sys.version_info >= (3, 9):
|
|
def getnode() -> int: ...
|
|
|
|
else:
|
|
def getnode(*, getters: Unused = None) -> int: ... # undocumented
|
|
|
|
def uuid1(node: _Int | None = None, clock_seq: _Int | None = None) -> UUID: ...
|
|
def uuid3(namespace: UUID, name: str) -> UUID: ...
|
|
def uuid4() -> UUID: ...
|
|
def uuid5(namespace: UUID, name: str) -> UUID: ...
|
|
|
|
NAMESPACE_DNS: UUID
|
|
NAMESPACE_URL: UUID
|
|
NAMESPACE_OID: UUID
|
|
NAMESPACE_X500: UUID
|
|
RESERVED_NCS: str
|
|
RFC_4122: str
|
|
RESERVED_MICROSOFT: str
|
|
RESERVED_FUTURE: str
|