Hash.
(self)
| 1545 | (othhmm, other._second, other._microsecond)) |
| 1546 | |
| 1547 | def __hash__(self): |
| 1548 | """Hash.""" |
| 1549 | if self._hashcode == -1: |
| 1550 | if self.fold: |
| 1551 | t = self.replace(fold=0) |
| 1552 | else: |
| 1553 | t = self |
| 1554 | tzoff = t.utcoffset() |
| 1555 | if not tzoff: # zero or None |
| 1556 | self._hashcode = hash(t._getstate()[0]) |
| 1557 | else: |
| 1558 | h, m = divmod(timedelta(hours=self.hour, minutes=self.minute) - tzoff, |
| 1559 | timedelta(hours=1)) |
| 1560 | assert not m % timedelta(minutes=1), "whole minute" |
| 1561 | m //= timedelta(minutes=1) |
| 1562 | if 0 <= h < 24: |
| 1563 | self._hashcode = hash(time(h, m, self.second, self.microsecond)) |
| 1564 | else: |
| 1565 | self._hashcode = hash((h, m, self.second, self.microsecond)) |
| 1566 | return self._hashcode |
| 1567 | |
| 1568 | # Conversion to string |
| 1569 |