-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Generate JobId as UUIDv7 (#58)
- Loading branch information
1 parent
4da82bb
commit 7c6ea76
Showing
7 changed files
with
126 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[mypy] | ||
mypy_path = stubs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
__version__ = "0.1.0" | ||
|
||
from .uuid7 import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
__all__ = ( | ||
"uuid7", | ||
"uuid7str", | ||
"time_ns", | ||
"check_timing_precision", | ||
"uuid_to_datetime", | ||
) | ||
|
||
import datetime | ||
import time | ||
import uuid | ||
from typing import Callable, Optional, Union | ||
|
||
time_ns = time.time_ns | ||
|
||
def uuid7( | ||
ns: Optional[int] = None, | ||
as_type: Optional[str] = None, | ||
time_func: Callable[[], int] = time_ns, | ||
_last=[0, 0, 0, 0], | ||
_last_as_of=[0, 0, 0, 0], | ||
) -> Union[uuid.UUID, str, int, bytes]: ... | ||
def uuid7str(ns: Optional[int] = None) -> str: ... | ||
def check_timing_precision( | ||
timing_func: Optional[Callable[[], int]] = None, | ||
) -> str: ... | ||
def uuid_to_datetime( | ||
s: Union[str, uuid.UUID, int], | ||
suppress_error=True, | ||
) -> Optional[datetime.datetime]: ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters