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

Class _HashedSeq

tools/python-3.11.9-amd64/Lib/functools.py:432–446  ·  view source on GitHub ↗

This class guarantees that hash() will be called no more than once per element. This is important because the lru_cache() will hash the key multiple times on a cache miss.

Source from the content-addressed store, hash-verified

430_CacheInfo = namedtuple("CacheInfo", ["hits", "misses", "maxsize", "currsize"])
431
432class _HashedSeq(list):
433 """ This class guarantees that hash() will be called no more than once
434 per element. This is important because the lru_cache() will hash
435 the key multiple times on a cache miss.
436
437 """
438
439 __slots__ = 'hashvalue'
440
441 def __init__(self, tup, hash=hash):
442 self[:] = tup
443 self.hashvalue = hash(tup)
444
445 def __hash__(self):
446 return self.hashvalue
447
448def _make_key(args, kwds, typed,
449 kwd_mark = (object(),),

Callers 1

_make_keyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected