mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-01-02 09:33:25 +08:00
uuid: add is_safe, Safe UUID (#3715)
* uuid: add is_safe, SafeUUID * uuid: add useless parameter
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
# Stubs for uuid
|
||||
|
||||
import sys
|
||||
from enum import Enum
|
||||
from typing import Tuple, Optional, Any, Text
|
||||
|
||||
# Because UUID has properties called int and bytes we need to rename these temporarily.
|
||||
@@ -8,13 +9,32 @@ _Int = int
|
||||
_Bytes = bytes
|
||||
_FieldsType = Tuple[int, int, int, int, int, int]
|
||||
|
||||
if sys.version_info >= (3, 7):
|
||||
class SafeUUID(Enum):
|
||||
safe: int
|
||||
unsafe: int
|
||||
unknown: None
|
||||
|
||||
|
||||
class UUID:
|
||||
def __init__(self, hex: Optional[Text] = ...,
|
||||
bytes: Optional[_Bytes] = ...,
|
||||
bytes_le: Optional[_Bytes] = ...,
|
||||
fields: Optional[_FieldsType] = ...,
|
||||
int: Optional[_Int] = ...,
|
||||
version: Optional[_Int] = ...) -> None: ...
|
||||
if sys.version_info >= (3, 7):
|
||||
def __init__(self, hex: Optional[Text] = ...,
|
||||
bytes: Optional[_Bytes] = ...,
|
||||
bytes_le: Optional[_Bytes] = ...,
|
||||
fields: Optional[_FieldsType] = ...,
|
||||
int: Optional[_Int] = ...,
|
||||
version: Optional[_Int] = ...,
|
||||
*,
|
||||
is_safe: SafeUUID = ...) -> None: ...
|
||||
@property
|
||||
def is_safe(self) -> SafeUUID: ...
|
||||
else:
|
||||
def __init__(self, hex: Optional[Text] = ...,
|
||||
bytes: Optional[_Bytes] = ...,
|
||||
bytes_le: Optional[_Bytes] = ...,
|
||||
fields: Optional[_FieldsType] = ...,
|
||||
int: Optional[_Int] = ...,
|
||||
version: Optional[_Int] = ...) -> None: ...
|
||||
@property
|
||||
def bytes(self) -> _Bytes: ...
|
||||
@property
|
||||
@@ -74,7 +94,7 @@ class UUID:
|
||||
def get_version(self) -> Optional[_Int]: ...
|
||||
def __cmp__(self, other: Any) -> _Int: ...
|
||||
|
||||
def getnode() -> int: ...
|
||||
def getnode(*, getters: None = ...) -> int: ... # getters is undocumented (and unused)
|
||||
def uuid1(node: Optional[_Int] = ..., clock_seq: Optional[_Int] = ...) -> UUID: ...
|
||||
def uuid3(namespace: UUID, name: str) -> UUID: ...
|
||||
def uuid4() -> UUID: ...
|
||||
|
||||
Reference in New Issue
Block a user