Skip to content

Commit 53188f9

Browse files
committed
[uuid] Replace properties with Final fields
Add UUID.__setattr__ Closes: #14964
1 parent 5dd1959 commit 53188f9

File tree

1 file changed

+22
-35
lines changed

1 file changed

+22
-35
lines changed

stdlib/uuid.pyi

Lines changed: 22 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import builtins
22
import sys
3+
from _typeshed import Unused
34
from enum import Enum
4-
from typing import Final
5+
from typing import Final, NoReturn
56
from typing_extensions import LiteralString, TypeAlias
67

78
_FieldsType: TypeAlias = tuple[int, int, int, int, int, int]
@@ -13,6 +14,25 @@ class SafeUUID(Enum):
1314

1415
class UUID:
1516
__slots__ = ("int", "is_safe", "__weakref__")
17+
18+
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]
26+
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]
35+
1636
def __init__(
1737
self,
1838
hex: str | None = None,
@@ -24,47 +44,14 @@ class UUID:
2444
*,
2545
is_safe: SafeUUID = SafeUUID.unknown,
2646
) -> None: ...
27-
@property
28-
def is_safe(self) -> SafeUUID: ...
29-
@property
30-
def bytes(self) -> builtins.bytes: ...
31-
@property
32-
def bytes_le(self) -> builtins.bytes: ...
33-
@property
34-
def clock_seq(self) -> builtins.int: ...
35-
@property
36-
def clock_seq_hi_variant(self) -> builtins.int: ...
37-
@property
38-
def clock_seq_low(self) -> builtins.int: ...
39-
@property
40-
def fields(self) -> _FieldsType: ...
41-
@property
42-
def hex(self) -> str: ...
43-
@property
44-
def int(self) -> builtins.int: ...
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: ...
6147
def __int__(self) -> builtins.int: ...
6248
def __eq__(self, other: object) -> bool: ...
6349
def __lt__(self, other: UUID) -> bool: ...
6450
def __le__(self, other: UUID) -> bool: ...
6551
def __gt__(self, other: UUID) -> bool: ...
6652
def __ge__(self, other: UUID) -> bool: ...
6753
def __hash__(self) -> builtins.int: ...
54+
def __setattr__(self, name: Unused, value: Unused) -> NoReturn: ...
6855

6956
def getnode() -> int: ...
7057
def uuid1(node: int | None = None, clock_seq: int | None = None) -> UUID: ...

0 commit comments

Comments
 (0)