MCPcopy Index your code
hub / github.com/python/cpython / __hash__

Method __hash__

Lib/_pydatetime.py:2374–2387  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2372 return base + otoff - myoff
2373
2374 def __hash__(self):
2375 if self._hashcode == -1:
2376 if self.fold:
2377 t = self.replace(fold=0)
2378 else:
2379 t = self
2380 tzoff = t.utcoffset()
2381 if tzoff is None:
2382 self._hashcode = hash(t._getstate()[0])
2383 else:
2384 days = _ymd2ord(self.year, self.month, self.day)
2385 seconds = self.hour * 3600 + self.minute * 60 + self.second
2386 self._hashcode = hash(timedelta(days, seconds, self.microsecond) - tzoff)
2387 return self._hashcode
2388
2389 # Pickle support.
2390

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected