[#264] Add APE related commands

Signed-off-by: a.berezin <a.berezin@yadro.com>
This commit is contained in:
Andrey Berezin 2024-07-18 00:00:48 +03:00 committed by Andrey Berezin
parent f472d7e1ce
commit 40dfd015a8
7 changed files with 257 additions and 3 deletions

View file

@ -8,7 +8,7 @@ DIGITS_AND_ASCII_LETTERS = string.ascii_letters + string.digits
NON_DIGITS_AND_LETTERS = string.punctuation
def unique_name(prefix: str = ""):
def unique_name(prefix: str = "", postfix: str = ""):
"""
Generate unique short name of anything with prefix.
This should be unique in scope of multiple runs
@ -18,7 +18,7 @@ def unique_name(prefix: str = ""):
Returns:
unique name string
"""
return f"{prefix}{hex(int(datetime.now().timestamp() * 1000000))}"
return f"{prefix}{hex(int(datetime.now().timestamp() * 1000000))}{postfix}"
def random_string(length: int = 5, source: str = ONLY_ASCII_LETTERS):