Add a datetime and a timedelta.
(self, other)
| 2284 | return diff and 1 or 0 |
| 2285 | |
| 2286 | def __add__(self, other): |
| 2287 | "Add a datetime and a timedelta." |
| 2288 | if not isinstance(other, timedelta): |
| 2289 | return NotImplemented |
| 2290 | delta = timedelta(self.toordinal(), |
| 2291 | hours=self._hour, |
| 2292 | minutes=self._minute, |
| 2293 | seconds=self._second, |
| 2294 | microseconds=self._microsecond) |
| 2295 | delta += other |
| 2296 | hour, rem = divmod(delta.seconds, 3600) |
| 2297 | minute, second = divmod(rem, 60) |
| 2298 | if 0 < delta.days <= _MAXORDINAL: |
| 2299 | return type(self).combine(date.fromordinal(delta.days), |
| 2300 | time(hour, minute, second, |
| 2301 | delta.microseconds, |
| 2302 | tzinfo=self._tzinfo)) |
| 2303 | raise OverflowError("result out of range") |
| 2304 | |
| 2305 | __radd__ = __add__ |
| 2306 |
nothing calls this directly
no test coverage detected