From 66edf577f92b844a6fd5af78c594120be76e2c8a Mon Sep 17 00:00:00 2001 From: rlaphoenix Date: Sat, 10 Feb 2024 12:35:02 +0000 Subject: [PATCH] Allow Chapter Timestamp to be float, fix typing --- devine/core/tracks/chapter.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/devine/core/tracks/chapter.py b/devine/core/tracks/chapter.py index 4ceefc4..371857c 100644 --- a/devine/core/tracks/chapter.py +++ b/devine/core/tracks/chapter.py @@ -8,7 +8,7 @@ TIMESTAMP_FORMAT = re.compile(r"^(?P\d{2}):(?P\d{2}):(?P\d class Chapter: - def __init__(self, timestamp: Union[str, int], name: Optional[str] = None): + def __init__(self, timestamp: Union[str, int, float], name: Optional[str] = None): """ Create a new Chapter with a Timestamp and optional name. @@ -25,8 +25,8 @@ class Chapter: if timestamp is None: raise ValueError("The timestamp must be provided.") - if not isinstance(timestamp, (str, int)): - raise TypeError(f"Expected timestamp to be {str} or {int}, not {type(timestamp)}") + if not isinstance(timestamp, (str, int, float)): + raise TypeError(f"Expected timestamp to be {str}, {int} or {float}, not {type(timestamp)}") if not isinstance(name, (str, type(None))): raise TypeError(f"Expected name to be {str}, not {type(name)}")