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

Method __hash__

tools/python-3.11.9-amd64/Lib/datetime.py:2222–2235  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2220 return base + otoff - myoff
2221
2222 def __hash__(self):
2223 if self._hashcode == -1:
2224 if self.fold:
2225 t = self.replace(fold=0)
2226 else:
2227 t = self
2228 tzoff = t.utcoffset()
2229 if tzoff is None:
2230 self._hashcode = hash(t._getstate()[0])
2231 else:
2232 days = _ymd2ord(self.year, self.month, self.day)
2233 seconds = self.hour * 3600 + self.minute * 60 + self.second
2234 self._hashcode = hash(timedelta(days, seconds, self.microsecond) - tzoff)
2235 return self._hashcode
2236
2237 # Pickle support.
2238

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected