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

Method __rsub__

src/pendulum/datetime.py:1217–1235  ·  view source on GitHub ↗
(self, other: datetime.datetime)

Source from the content-addressed store, hash-verified

1215 return other.diff(self, False)
1216
1217 def __rsub__(self, other: datetime.datetime) -> Interval[datetime.datetime]:
1218 if not isinstance(other, datetime.datetime):
1219 return NotImplemented
1220
1221 if not isinstance(other, self.__class__):
1222 if other.tzinfo is None:
1223 other = pendulum.naive(
1224 other.year,
1225 other.month,
1226 other.day,
1227 other.hour,
1228 other.minute,
1229 other.second,
1230 other.microsecond,
1231 )
1232 else:
1233 other = self.instance(other)
1234
1235 return self.diff(other, False)
1236
1237 def __add__(self, other: datetime.timedelta) -> Self:
1238 if not isinstance(other, datetime.timedelta):

Callers

nothing calls this directly

Calls 3

instanceMethod · 0.95
diffMethod · 0.95
naiveMethod · 0.80

Tested by

no test coverage detected