MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / __hash__

Method __hash__

tools/python-3.11.9-amd64/Lib/datetime.py:1467–1486  ·  view source on GitHub ↗

Hash.

(self)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 6

replaceMethod · 0.95
timedeltaClass · 0.85
timeClass · 0.85
hashClass · 0.50
utcoffsetMethod · 0.45
_getstateMethod · 0.45

Tested by

no test coverage detected