Skip to content

Commit 07b69ab

Browse files
authored
[uuid] Replace properties with Final fields (#14968)
1 parent 83a39d1 commit 07b69ab

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

stdlib/uuid.pyi

Lines changed: 6 additions & 5 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,9 @@ class SafeUUID(Enum):
1314

1415
class UUID:
1516
__slots__ = ("int", "is_safe", "__weakref__")
17+
is_safe: Final[SafeUUID]
18+
int: Final[builtins.int]
19+
1620
def __init__(
1721
self,
1822
hex: str | None = None,
@@ -25,8 +29,6 @@ class UUID:
2529
is_safe: SafeUUID = SafeUUID.unknown,
2630
) -> None: ...
2731
@property
28-
def is_safe(self) -> SafeUUID: ...
29-
@property
3032
def bytes(self) -> builtins.bytes: ...
3133
@property
3234
def bytes_le(self) -> builtins.bytes: ...
@@ -41,8 +43,6 @@ class UUID:
4143
@property
4244
def hex(self) -> str: ...
4345
@property
44-
def int(self) -> builtins.int: ...
45-
@property
4646
def node(self) -> builtins.int: ...
4747
@property
4848
def time(self) -> builtins.int: ...
@@ -65,6 +65,7 @@ class UUID:
6565
def __gt__(self, other: UUID) -> bool: ...
6666
def __ge__(self, other: UUID) -> bool: ...
6767
def __hash__(self) -> builtins.int: ...
68+
def __setattr__(self, name: Unused, value: Unused) -> NoReturn: ...
6869

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

0 commit comments

Comments
 (0)