Skip to content

Commit 9d397e2

Browse files
committed
Restore UUID properties
1 parent 88bce28 commit 9d397e2

File tree

2 files changed

+30
-33
lines changed

2 files changed

+30
-33
lines changed

stdlib/@tests/stubtest_allowlists/common.txt

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -527,23 +527,6 @@ urllib.response.addbase.write # Methods that come from __getattr__() at runtime
527527
urllib.response.addbase.writelines # Methods that come from __getattr__() at runtime
528528
unittest.mock.patch # function with attributes, which we approximate with a callable class
529529

530-
# stubtest doesn't understand that Final class attributes are also read-only.
531-
uuid.UUID.bytes
532-
uuid.UUID.bytes_le
533-
uuid.UUID.clock_seq
534-
uuid.UUID.clock_seq_hi_variant
535-
uuid.UUID.clock_seq_low
536-
uuid.UUID.fields
537-
uuid.UUID.hex
538-
uuid.UUID.node
539-
uuid.UUID.time
540-
uuid.UUID.time_hi_version
541-
uuid.UUID.time_low
542-
uuid.UUID.time_mid
543-
uuid.UUID.urn
544-
uuid.UUID.variant
545-
uuid.UUID.version
546-
547530
_?weakref\.CallableProxyType\.__getattr__ # Should have all attributes of proxy
548531
_?weakref\.(ref|ReferenceType)\.__init__ # C implementation has incorrect signature
549532
_?weakref\.(ref|ReferenceType)\.__call__ # C function default annotation is wrong

stdlib/uuid.pyi

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,8 @@ class SafeUUID(Enum):
1414

1515
class UUID:
1616
__slots__ = ("int", "is_safe", "__weakref__")
17-
1817
is_safe: Final[SafeUUID]
19-
bytes: Final[builtins.bytes]
20-
bytes_le: Final[builtins.bytes]
21-
clock_seq: Final[builtins.int]
22-
clock_seq_hi_variant: Final[builtins.int]
23-
clock_seq_low: Final[builtins.int]
24-
fields: Final[_FieldsType]
25-
hex: Final[str]
2618
int: Final[builtins.int]
27-
node: Final[builtins.int]
28-
time: Final[builtins.int]
29-
time_hi_version: Final[builtins.int]
30-
time_low: Final[builtins.int]
31-
time_mid: Final[builtins.int]
32-
urn: Final[str]
33-
variant: Final[str]
34-
version: Final[builtins.int | None]
3519

3620
def __init__(
3721
self,
@@ -44,6 +28,36 @@ class UUID:
4428
*,
4529
is_safe: SafeUUID = SafeUUID.unknown,
4630
) -> None: ...
31+
@property
32+
def bytes(self) -> builtins.bytes: ...
33+
@property
34+
def bytes_le(self) -> builtins.bytes: ...
35+
@property
36+
def clock_seq(self) -> builtins.int: ...
37+
@property
38+
def clock_seq_hi_variant(self) -> builtins.int: ...
39+
@property
40+
def clock_seq_low(self) -> builtins.int: ...
41+
@property
42+
def fields(self) -> _FieldsType: ...
43+
@property
44+
def hex(self) -> str: ...
45+
@property
46+
def node(self) -> builtins.int: ...
47+
@property
48+
def time(self) -> builtins.int: ...
49+
@property
50+
def time_hi_version(self) -> builtins.int: ...
51+
@property
52+
def time_low(self) -> builtins.int: ...
53+
@property
54+
def time_mid(self) -> builtins.int: ...
55+
@property
56+
def urn(self) -> str: ...
57+
@property
58+
def variant(self) -> str: ...
59+
@property
60+
def version(self) -> builtins.int | None: ...
4761
def __int__(self) -> builtins.int: ...
4862
def __eq__(self, other: object) -> bool: ...
4963
def __lt__(self, other: UUID) -> bool: ...

0 commit comments

Comments
 (0)