Download scripts/parsing_utils.py from sproducts/Chatbot: direct link, hf CLI and curl.
- Browser
- Download file 834 Bytes
-
https://huggingface.co/spaces/sproducts/Chatbot/resolve/main/scripts/parsing_utils.py
- Command line
-
hf download hf://spaces/sproducts/Chatbot/scripts/parsing_utils.py
-
curl -L -o parsing_utils.py https://huggingface.co/spaces/sproducts/Chatbot/resolve/main/scripts/parsing_utils.py
834 Bytes
| import yaml | |
| def load_yaml_file(filepath): | |
| """Loads and parses a YAML file.""" | |
| try: | |
| with open(filepath, 'r') as f: | |
| data = yaml.safe_load(f) | |
| return data | |
| except FileNotFoundError: | |
| print(f"Error: File not found at {filepath}") | |
| return None | |
| except yaml.YAMLError as e: | |
| print(f"Error parsing YAML file {filepath}: {e}") | |
| return None | |
| def get_roadmap_phases(roadmap_data): | |
| """Extracts phases from roadmap data.""" | |
| if roadmap_data and 'roadmap' in roadmap_data: | |
| return roadmap_data['roadmap'] | |
| return None | |
| def get_project_rules(rules_data): | |
| """Extracts project rules data.""" | |
| if rules_data and 'project_rules' in rules_data: | |
| return rules_data['project_rules'] | |
| return None | |
| # You can add more parsing utility functions as needed |