Hash.
(self)
| 1465 | (othhmm, other._second, other._microsecond)) |
| 1466 | |
| 1467 | def __hash__(self): |
| 1468 | """Hash.""" |
| 1469 | if self._hashcode == -1: |
| 1470 | if self.fold: |
| 1471 | t = self.replace(fold=0) |
| 1472 | else: |
| 1473 | t = self |
| 1474 | tzoff = t.utcoffset() |
| 1475 | if not tzoff: # zero or None |
| 1476 | self._hashcode = hash(t._getstate()[0]) |
| 1477 | else: |
| 1478 | h, m = divmod(timedelta(hours=self.hour, minutes=self.minute) - tzoff, |
| 1479 | timedelta(hours=1)) |
| 1480 | assert not m % timedelta(minutes=1), "whole minute" |
| 1481 | m //= timedelta(minutes=1) |
| 1482 | if 0 <= h < 24: |
| 1483 | self._hashcode = hash(time(h, m, self.second, self.microsecond)) |
| 1484 | else: |
| 1485 | self._hashcode = hash((h, m, self.second, self.microsecond)) |
| 1486 | return self._hashcode |
| 1487 | |
| 1488 | # Conversion to string |
| 1489 |