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

Method _subtract_timedelta

src/pendulum/date.py:237–251  ·  view source on GitHub ↗

Remove timedelta duration from the instance. :param delta: The timedelta instance

(self, delta: timedelta)

Source from the content-addressed store, hash-verified

235 return self.add(days=delta.days)
236
237 def _subtract_timedelta(self, delta: timedelta) -> Self:
238 """
239 Remove timedelta duration from the instance.
240
241 :param delta: The timedelta instance
242 """
243 if isinstance(delta, pendulum.Duration):
244 return self.subtract(
245 years=delta.years,
246 months=delta.months,
247 weeks=delta.weeks,
248 days=delta.remaining_days,
249 )
250
251 return self.subtract(days=delta.days)
252
253 def __add__(self, other: timedelta) -> Self:
254 if not isinstance(other, timedelta):

Callers 1

__sub__Method · 0.95

Calls 1

subtractMethod · 0.95

Tested by

no test coverage detected