From f53516665a805d0146543db5f7a07fd4e59d5584 Mon Sep 17 00:00:00 2001 From: DigiDuncan Date: Sat, 24 Feb 2024 12:20:00 -0500 Subject: [PATCH] fix UUID function - fix docstring - clearer exception condition --- arcade/utils.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/arcade/utils.py b/arcade/utils.py index c1968ee53..fce464242 100644 --- a/arcade/utils.py +++ b/arcade/utils.py @@ -136,11 +136,12 @@ def wrapper(*args, **kwargs): def generate_uuid_from_kwargs(**kwargs) -> str: """ - Given key/pair combos, returns a string in uuid format. - Such as `text='hi', size=32` it will return "text-hi-size-32". - Called with no parameters, id does NOT return a random unique id. + Given key/pair combos, returns a string in "UUID" format. + With inputs such as `text='hi', size=32` it will return `"text=hi|size=32"`. + This function does NOT return a random unique ID. + It must be called with parameters, and will raise an error if passed no keyword arguments. """ - if len(kwargs) == 0: + if not kwargs: raise Exception("generate_uuid_from_kwargs has to be used with kwargs, please check the doc.") return "|".join(f"{key}={str(value)}" for key, value in kwargs.items())