MCPcopy Index your code
hub / github.com/RustPython/RustPython / __hash__

Method __hash__

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

Source from the content-addressed store, hash-verified

2329 return base + otoff - myoff
2330
2331 def __hash__(self):
2332 if self._hashcode == -1:
2333 if self.fold:
2334 t = self.replace(fold=0)
2335 else:
2336 t = self
2337 tzoff = t.utcoffset()
2338 if tzoff is None:
2339 self._hashcode = hash(t._getstate()[0])
2340 else:
2341 days = _ymd2ord(self.year, self.month, self.day)
2342 seconds = self.hour * 3600 + self.minute * 60 + self.second
2343 self._hashcode = hash(timedelta(days, seconds, self.microsecond) - tzoff)
2344 return self._hashcode
2345
2346 # Pickle support.
2347

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected