Spaces:
Sleeping
Sleeping
Download dify_client_python/dify_client/utils/_common.py from Underground-Digital/cc-api: direct link, hf CLI and curl.
- Browser
- Download file 333 Bytes
-
https://huggingface.co/spaces/Underground-Digital/cc-api/resolve/main/dify_client_python/dify_client/utils/_common.py
- Command line
-
hf download hf://spaces/Underground-Digital/cc-api/dify_client_python/dify_client/utils/_common.py
-
curl -L -o _common.py https://huggingface.co/spaces/Underground-Digital/cc-api/resolve/main/dify_client_python/dify_client/utils/_common.py
333 Bytes
| def str_to_enum(str_enum_class, str_value: str, ignore_not_found: bool = False, enum_default=None): | |
| for key, member in str_enum_class.__members__.items(): | |
| if str_value == member.value: | |
| return member | |
| if ignore_not_found: | |
| return enum_default | |
| raise ValueError(f"Invalid enum value: {str_value}") | |