Skip to content

Commit

Permalink
Allow Chapter Timestamp to be float, fix typing
Browse files Browse the repository at this point in the history
  • Loading branch information
rlaphoenix committed Feb 10, 2024
1 parent a544b1e commit 66edf57
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions devine/core/tracks/chapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@


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.
Expand All @@ -25,8 +25,8 @@ def __init__(self, timestamp: Union[str, int], name: Optional[str] = None):
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)}")

Expand Down

0 comments on commit 66edf57

Please sign in to comment.