Hash.
(self)
| 1565 | (othhmm, other._second, other._microsecond)) |
| 1566 | |
| 1567 | def __hash__(self): |
| 1568 | """Hash.""" |
| 1569 | if self._hashcode == -1: |
| 1570 | if self.fold: |
| 1571 | t = self.replace(fold=0) |
| 1572 | else: |
| 1573 | t = self |
| 1574 | tzoff = t.utcoffset() |
| 1575 | if not tzoff: # zero or None |
| 1576 | self._hashcode = hash(t._getstate()[0]) |
| 1577 | else: |
| 1578 | h, m = divmod(timedelta(hours=self.hour, minutes=self.minute) - tzoff, |
| 1579 | timedelta(hours=1)) |
| 1580 | assert not m % timedelta(minutes=1), "whole minute" |
| 1581 | m //= timedelta(minutes=1) |
| 1582 | if 0 <= h < 24: |
| 1583 | self._hashcode = hash(time(h, m, self.second, self.microsecond)) |
| 1584 | else: |
| 1585 | self._hashcode = hash((h, m, self.second, self.microsecond)) |
| 1586 | return self._hashcode |
| 1587 | |
| 1588 | # Conversion to string |
| 1589 |