Back to the room

Pass 3 of 3 · Deep dive of PHAROSPass 1 · OverviewPass 2 · How it works

Code Observatory / class

_FileCache

codeintel.source._FileCache

PINNED SOURCE Source and edges from the index at this commit. An execution appears only where one was recorded.

PHAROS at 975a38dMIT license

Around this symbol

Search all symbols

Loading

Called by (1)
SymbolFileResolved by
sourcesource.pysame file
Contains (3)
SymbolFileResolved by
__init__source.pysame file
getsource.pysame file
putsource.pysame file
Inside (1)
SymbolFileResolved by
sourcesource.pysame file
codeintel.source._FileCachebackend/app/codeintel/source.py, lines 61–79Open source
class _FileCache:    def __init__(self, capacity: int) -> None:        self.capacity = capacity        self._data: OrderedDict[str, bytes] = OrderedDict()        self._lock = threading.Lock()    def get(self, key: str) -> bytes | None:        with self._lock:            if key in self._data:                self._data.move_to_end(key)                return self._data[key]            return None    def put(self, key: str, value: bytes) -> None:        with self._lock:            self._data[key] = value            self._data.move_to_end(key)            while len(self._data) > self.capacity:                self._data.popitem(last=False)

What the index recorded

Signature
class _FileCache:
File
backend/app/codeintel/source.py
Lines
61–79
Parser
python-ast
Git blob
c9f05cf7bf871b09919d64e9fdaf8380ecc3df2c

Read it on GitHub at this commit