diff --git a/dcicutils/misc_utils.py b/dcicutils/misc_utils.py index 249524d6c..1ffab1607 100644 --- a/dcicutils/misc_utils.py +++ b/dcicutils/misc_utils.py @@ -2714,7 +2714,20 @@ def get_cpu_architecture_name() -> str: return "" -def short_uuid(length: Optional[int] = None): +def create_uuid(nodash: bool = False, upper: bool = False) -> str: + value = str(uuid.uuid4()) + if nodash is True: + value = value.replace("-", "") + if upper is True: + value = value.upper() + return value + + +def create_short_uuid(length: Optional[int] = None, upper: bool = False): + # Not really techincally a uuid of course. if (length is None) or (not isinstance(length, int)) or (length < 1): length = 16 - return shortuuid.ShortUUID().random(length=length) + value = shortuuid.ShortUUID().random(length=length) + if upper is True: + value = value.upper() + return value diff --git a/pyproject.toml b/pyproject.toml index 56622d8fc..a9e289f9b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "dcicutils" -version = "8.8.4.1b21" # TODO: To become 8.8.5 +version = "8.8.4.1b22" # TODO: To become 8.8.5 description = "Utility package for interacting with the 4DN Data Portal and other 4DN resources" authors = ["4DN-DCIC Team "] license = "MIT"