MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / __contains__

Method __contains__

other/lru_cache.py:231–244  ·  view source on GitHub ↗

>>> cache = LRUCache(1) >>> 1 in cache False >>> cache.put(1, 1) >>> 1 in cache True

(self, key: T)

Source from the content-addressed store, hash-verified

229 )
230
231 def __contains__(self, key: T) -> bool:
232 """
233 >>> cache = LRUCache(1)
234
235 >>> 1 in cache
236 False
237
238 >>> cache.put(1, 1)
239
240 >>> 1 in cache
241 True
242 """
243
244 return key in self.cache
245
246 def get(self, key: T) -> U | None:
247 """

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected