MCPcopy Index your code
hub / github.com/python-pendulum/pendulum / total_seconds

Method total_seconds

src/pendulum/duration.py:142–159  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

140 if PYPY:
141
142 def total_seconds(self) -> float:
143 days = 0
144
145 if hasattr(self, "_years"):
146 days += self._years * 365
147
148 if hasattr(self, "_months"):
149 days += self._months * 30
150
151 if hasattr(self, "_remaining_days"):
152 days += self._weeks * 7 + self._remaining_days
153 else:
154 days += self._days
155
156 return (
157 (days * SECONDS_PER_DAY + self._seconds) * US_PER_SECOND
158 + self._microseconds
159 ) / US_PER_SECOND
160
161 @property
162 def years(self) -> int:

Callers 15

__new__Method · 0.95
total_minutesMethod · 0.95
total_hoursMethod · 0.95
total_daysMethod · 0.95
invertMethod · 0.95
in_secondsMethod · 0.95
as_timedeltaMethod · 0.95
__add__Method · 0.95
__sub__Method · 0.95
__new__Method · 0.45
_safe_timezoneFunction · 0.45
get_offsetMethod · 0.45

Calls

no outgoing calls

Tested by 15

test_in_secondsFunction · 0.36
test_yearsFunction · 0.36
test_monthsFunction · 0.36
test_as_timedeltaFunction · 0.36
test_subtractionFunction · 0.36
test_setting_timezoneFunction · 0.36
test_subtractionFunction · 0.36
test_rfc_3339Function · 0.36
test_rfc_3339_extendedFunction · 0.36