Skip to content

Commit d44eddb

Browse files
hannes-ucscachave11-ucsc
authored andcommitted
Replace PyCharm typing hack with PEP-681 construct
1 parent 0753dd1 commit d44eddb

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

src/azul/uuids.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from typing import (
66
ClassVar,
77
Self,
8+
dataclass_transform,
89
)
910
from uuid import (
1011
UUID,
@@ -136,6 +137,7 @@ def change_version(uuid: str, old_version: int, new_version: int) -> str:
136137
return uuid
137138

138139

140+
@dataclass_transform(frozen_default=True, kw_only_default=True)
139141
class UUIDPartitionMeta(type):
140142

141143
def __init__(cls, *args, **kwargs):
@@ -166,15 +168,6 @@ class UUIDPartition(metaclass=UUIDPartitionMeta):
166168
#:
167169
root: ClassVar[Self]
168170

169-
# This stub is only needed to aid PyCharm's type inference. Without this,
170-
# a constructor invocation that doesn't refer to the class explicitly, but
171-
# through a variable will cause a warning. I suspect a bug in PyCharm:
172-
#
173-
# https://youtrack.jetbrains.com/issue/PY-44728
174-
#
175-
# noinspection PyDataclass
176-
def __init__(self, *, prefix_length: int, prefix: int) -> None: ...
177-
178171
def __attrs_post_init__(self):
179172
"""
180173
>>> UUIDPartition(prefix_length=0, prefix=1)

0 commit comments

Comments
 (0)