-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f3bc4c6
commit 9b40875
Showing
9 changed files
with
499 additions
and
277 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
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,22 @@ | ||
# Copyright (c) 2024 Airbyte, Inc., all rights reserved. | ||
"""Utility functions for working with text.""" | ||
|
||
from __future__ import annotations | ||
|
||
import ulid | ||
|
||
|
||
def generate_ulid() -> str: | ||
"""Generate a new ULID.""" | ||
return str(ulid.ULID()) | ||
|
||
|
||
def generate_random_suffix() -> str: | ||
"""Generate a random suffix for use in temporary names. | ||
By default, this function generates a ULID and returns a 9-character string | ||
which will be monotonically sortable. It is not guaranteed to be unique but | ||
is sufficient for small-scale and medium-scale use cases. | ||
""" | ||
ulid_str = generate_ulid() | ||
return ulid_str[:6] + ulid_str[-3:] |
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
Oops, something went wrong.