Spaces:
Build error
Build error
Download src/chains/chain_funcs.py from redmelonberry/presentation-search: direct link, hf CLI and curl.
- Browser
- Download file 577 Bytes
-
https://huggingface.co/spaces/redmelonberry/presentation-search/resolve/main/src/chains/chain_funcs.py
- Command line
-
hf download hf://spaces/redmelonberry/presentation-search/src/chains/chain_funcs.py
-
curl -L -o chain_funcs.py https://huggingface.co/spaces/redmelonberry/presentation-search/resolve/main/src/chains/chain_funcs.py
577 Bytes
| from typing import Any | |
| def get_param_or_default( | |
| param_dict: dict, | |
| param_name: str, | |
| default_value: Any | |
| ) -> Any: | |
| """Get parameter from dictionary with fallback to default value | |
| Args: | |
| param_dict: Dictionary containing parameters | |
| param_name: Name of the parameter to get | |
| Returns: | |
| Parameter value from dict, or default value, or None | |
| """ | |
| # Get item of a dict | |
| out = param_dict.get(param_name, default_value) | |
| # In case key is present but set to None | |
| if out is None: | |
| out = default_value | |
| return out | |