Get the time in seconds from `other` for arithmetic operations.
(self, other: "TimecodeLike")
| 755 | return self.frame_num |
| 756 | |
| 757 | def _get_other_as_seconds(self, other: "TimecodeLike") -> float: |
| 758 | """Get the time in seconds from `other` for arithmetic operations.""" |
| 759 | if isinstance(other, int): |
| 760 | # Convert frame number to seconds using framerate. |
| 761 | if self._rate is None: |
| 762 | raise NotImplementedError( |
| 763 | "Cannot convert frame number to seconds without framerate" |
| 764 | ) |
| 765 | return float(other) / float(self._rate) |
| 766 | if isinstance(other, float): |
| 767 | return other |
| 768 | if isinstance(other, str): |
| 769 | return self._timecode_to_seconds(other) |
| 770 | if isinstance(other, Timecode): |
| 771 | return other.seconds |
| 772 | if isinstance(other, FrameTimecode): |
| 773 | return other.seconds |
| 774 | raise TypeError("Unsupported type for performing arithmetic with FrameTimecode.") |
| 775 | |
| 776 | |
| 777 | def _compare_as_fixed(other: ty.Any, base: FrameTimecode) -> ty.TypeGuard[FrameTimecode]: |