Skip to content

Commit a7f87bb

Browse files
eurestiJelleZijlstra
authored andcommitted
Merge uuid module into 2and3 (#1148)
* Merge and improve uuid module * Move uuid into 2and3 * Fix mistyped things, add compare operators
1 parent 761ee6a commit a7f87bb

File tree

3 files changed

+87
-130
lines changed

3 files changed

+87
-130
lines changed

stdlib/2/uuid.pyi

Lines changed: 0 additions & 57 deletions
This file was deleted.

stdlib/2and3/uuid.pyi

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# Stubs for uuid
2+
3+
import sys
4+
from typing import Tuple, Optional, Any
5+
6+
# Because UUID has properties called int and bytes we need to rename these temporarily.
7+
_Int = int
8+
_Bytes = bytes
9+
_FieldsType = Tuple[int, int, int, int, int, int]
10+
11+
class UUID:
12+
def __init__(self, hex: Optional[str] = ..., bytes: Optional[_Bytes] = ...,
13+
bytes_le: Optional[_Bytes] = ...,
14+
fields: Optional[_FieldsType] = ...,
15+
int: Optional[_Int] = ...,
16+
version: Optional[_Int] = ...) -> None: ...
17+
@property
18+
def bytes(self) -> _Bytes: ...
19+
@property
20+
def bytes_le(self) -> _Bytes: ...
21+
@property
22+
def clock_seq(self) -> _Int: ...
23+
@property
24+
def clock_seq_hi_variant(self) -> _Int: ...
25+
@property
26+
def clock_seq_low(self) -> _Int: ...
27+
@property
28+
def fields(self) -> _FieldsType: ...
29+
@property
30+
def hex(self) -> str: ...
31+
@property
32+
def int(self) -> _Int: ...
33+
@property
34+
def node(self) -> _Int: ...
35+
@property
36+
def time(self) -> _Int: ...
37+
@property
38+
def time_hi_version(self) -> _Int: ...
39+
@property
40+
def time_low(self) -> _Int: ...
41+
@property
42+
def time_mid(self) -> _Int: ...
43+
@property
44+
def urn(self) -> str: ...
45+
@property
46+
def variant(self) -> str: ...
47+
@property
48+
def version(self) -> Optional[_Int]: ...
49+
50+
if sys.version_info >= (3,):
51+
def __eq__(self, other: Any) -> bool: ...
52+
def __lt__(self, other: Any) -> bool: ...
53+
def __le__(self, other: Any) -> bool: ...
54+
def __gt__(self, other: Any) -> bool: ...
55+
def __ge__(self, other: Any) -> bool: ...
56+
else:
57+
def get_bytes(self) -> _Bytes: ...
58+
def get_bytes_le(self) -> _Bytes: ...
59+
def get_clock_seq(self) -> _Int: ...
60+
def get_clock_seq_hi_variant(self) -> _Int: ...
61+
def get_clock_seq_low(self) -> _Int: ...
62+
def get_fields(self) -> _FieldsType: ...
63+
def get_hex(self) -> str: ...
64+
def get_node(self) -> _Int: ...
65+
def get_time(self) -> _Int: ...
66+
def get_time_hi_version(self) -> _Int: ...
67+
def get_time_low(self) -> _Int: ...
68+
def get_time_mid(self) -> _Int: ...
69+
def get_urn(self) -> str: ...
70+
def get_variant(self) -> str: ...
71+
def get_version(self) -> Optional[_Int]: ...
72+
def __cmp__(self, other: Any) -> int: ...
73+
74+
def getnode() -> int: ...
75+
def uuid1(node: Optional[int] = ..., clock_seq: Optional[int] = ...) -> UUID: ...
76+
def uuid3(namespace: UUID, name: str) -> UUID: ...
77+
def uuid4() -> UUID: ...
78+
def uuid5(namespace: UUID, name: str) -> UUID: ...
79+
80+
NAMESPACE_DNS = ... # type: UUID
81+
NAMESPACE_URL = ... # type: UUID
82+
NAMESPACE_OID = ... # type: UUID
83+
NAMESPACE_X500 = ... # type: UUID
84+
RESERVED_NCS = ... # type: str
85+
RFC_4122 = ... # type: str
86+
RESERVED_MICROSOFT = ... # type: str
87+
RESERVED_FUTURE = ... # type: str

stdlib/3/uuid.pyi

Lines changed: 0 additions & 73 deletions
This file was deleted.

0 commit comments

Comments
 (0)