Spaces:
Paused
Paused
Download app/modules/utils.py from elopezlopez/socialboost: direct link, hf CLI and curl.
- Browser
- Download file 997 Bytes
-
https://huggingface.co/spaces/elopezlopez/socialboost/resolve/main/app/modules/utils.py
- Command line
-
hf download hf://spaces/elopezlopez/socialboost/app/modules/utils.py
-
curl -L -o utils.py https://huggingface.co/spaces/elopezlopez/socialboost/resolve/main/app/modules/utils.py
997 Bytes
| import csv | |
| from datetime import datetime | |
| def load_csv_to_dict(filename): | |
| """Loads a CSV file into a list of dictionaries.""" | |
| with open(filename, mode='r', newline='', encoding='utf-8') as file: | |
| # Create a DictReader object | |
| dict_reader = csv.DictReader(file) | |
| # Convert DictReader to a list of dictionaries | |
| data_list = list(dict_reader) | |
| return data_list | |
| #def get_stringified_date(date): | |
| # """ | |
| # Gets a date like 2024-04-09T19:29:38.072017Z and returns the day | |
| # """ | |
| # return str(datetime.strptime(date, "%Y-%m-%dT%H:%M:%S.%fZ").date()) | |
| def compare_date_with_today(input_date:datetime): | |
| # Parse the input date string | |
| #input_date = datetime.strptime(date_str, "%Y-%m-%dT%H:%M:%S.%fZ") | |
| # Get today's date (without time component) | |
| today_date = datetime.now().date() | |
| # Compare the input date's date component with today's date | |
| if input_date.date() == today_date: | |
| return True | |
| else: | |
| return False | |