Spaces:
Sleeping
Sleeping
Download utils/utils.py from semmyk/parserPDF: direct link, hf CLI and curl.
- Browser
- Download file 447 Bytes
-
https://huggingface.co/spaces/semmyk/parserPDF/resolve/refs%2Fpr%2F1/utils/utils.py
- Command line
-
hf download hf://spaces/semmyk/parserPDF@refs/pr/1/utils/utils.py
-
curl -L -o utils.py https://huggingface.co/spaces/semmyk/parserPDF/resolve/refs%2Fpr%2F1/utils/utils.py
447 Bytes
| def is_dict(variable): | |
| """Checks if a variable is a dict.""" | |
| if isinstance(variable, dict): | |
| return True | |
| return False | |
| def is_list_of_dicts(variable): | |
| """Checks if a variable is a list containing only dicts.""" | |
| if isinstance(variable, list): | |
| # Return True only if the list is empty or all elements are dicts. | |
| return all(isinstance(item, dict) for item in variable) | |
| return False |