(start_date, end_date, interval_level='year')
| 49 | return intervals |
| 50 | |
| 51 | def generate_dates(start_date, end_date, interval_level='year'): |
| 52 | |
| 53 | dates = [] |
| 54 | |
| 55 | if interval_level == 'year': |
| 56 | current_date = start_date |
| 57 | while current_date < end_date: |
| 58 | next_year = current_date.replace(year=current_date.year + 1) |
| 59 | if next_year > end_date: |
| 60 | next_year = end_date |
| 61 | date = current_date |
| 62 | dates.append(date) |
| 63 | current_date = next_year |
| 64 | elif interval_level == 'day': |
| 65 | current_date = start_date |
| 66 | while current_date < end_date: |
| 67 | next_day = current_date + timedelta(days=1) |
| 68 | date = current_date |
| 69 | dates.append(date) |
| 70 | current_date = next_day |
| 71 | else: |
| 72 | return None |
| 73 | |
| 74 | return dates |
| 75 | |
| 76 | def find_latest_checkpoint(path, suffix='pth'): |
| 77 | """Find the latest checkpoint from the working directory. |
nothing calls this directly
no outgoing calls
no test coverage detected