MCPcopy Index your code
hub / github.com/python/cpython / __truediv__

Method __truediv__

Lib/_pydatetime.py:875–885  ·  view source on GitHub ↗
(self, other)

Source from the content-addressed store, hash-verified

873 return timedelta(0, 0, usec // other)
874
875 def __truediv__(self, other):
876 if not isinstance(other, (int, float, timedelta)):
877 return NotImplemented
878 usec = self._to_microseconds()
879 if isinstance(other, timedelta):
880 return usec / other._to_microseconds()
881 if isinstance(other, int):
882 return timedelta(0, 0, _divide_and_round(usec, other))
883 if isinstance(other, float):
884 a, b = other.as_integer_ratio()
885 return timedelta(0, 0, _divide_and_round(b * usec, a))
886
887 def __mod__(self, other):
888 if isinstance(other, timedelta):

Callers

nothing calls this directly

Calls 4

_to_microsecondsMethod · 0.95
timedeltaClass · 0.85
_divide_and_roundFunction · 0.85
as_integer_ratioMethod · 0.45

Tested by

no test coverage detected