Skip to content

Commit

Permalink
Dependency version bump
Browse files Browse the repository at this point in the history
  • Loading branch information
thorbjoernl committed Apr 13, 2024
1 parent f7a58d6 commit 93a9db1
Show file tree
Hide file tree
Showing 3 changed files with 216 additions and 99 deletions.
29 changes: 28 additions & 1 deletion app/config/podcast_config_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,35 @@ class PodcastConfigParser:

@staticmethod
def weekdaystr_as_int(weekday: str | int) -> int:
""" """
"""
Converts a weekday name or int into a weekday int as
understood by datetime (https://docs.python.org/3/library/datetime.html#datetime.date.weekday)
Weekday strings are matched based on the first three
characters of the english name (ie. 'mon', 'monday'
both evaluate to 1).
Parameters:
-----------
weekday : str | int
The weekday to be converted.
Returns:
--------
int
The sanitized weekday.
Raises:
-------
PodcastConfigurationError
If weekday can't be sanitized.
"""

if isinstance(weekday, int):
if weekday < 1 or weekday > 7:
raise PodcastConfigurationError(
f"Unexpected weekday value, {weekday}. Weekday int should be between 1 and 7."
)
return weekday

for i, s in enumerate(WEEKDAY_PREFIXES):
Expand Down
Loading

0 comments on commit 93a9db1

Please sign in to comment.