Skip to content

Commit de1e5ff

Browse files
committed
Improve type annotations for SonyFlake/MachineIDLCG
1 parent 83f0963 commit de1e5ff

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/sonyflake_turbo/_sonyflake.pyi

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from collections.abc import Iterator
12
from typing import overload
23

34
try:
@@ -13,7 +14,7 @@ SONYFLAKE_MACHINE_ID_MAX: int
1314
SONYFLAKE_MACHINE_ID_OFFSET: int
1415
SONYFLAKE_TIME_OFFSET: int
1516

16-
class SonyFlake:
17+
class SonyFlake(Iterator[int]):
1718
def __init__(self, *machine_id: int, start_time: int | None = None):
1819
"""Initialize SonyFlake ID generator.
1920
@@ -63,7 +64,7 @@ class SonyFlake:
6364
@overload
6465
def _raw(self, n: None) -> tuple[int, float]: ...
6566

66-
class MachineIDLCG:
67+
class MachineIDLCG(Iterator[int]):
6768
"""A simple LCG producing ints suitable to be used as ``machine_id``.
6869
6970
Intended to be used in examples, tests, or when concurrency is not an issue.

0 commit comments

Comments
 (0)