Back to the room

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

Code Observatory / class

_Bucket

codeintel.edge_server._Bucket

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
make_handleredge_server.pysame file
Contains (2)
SymbolFileResolved by
__init__edge_server.pysame file
takeedge_server.pysame file
Inside (1)
SymbolFileResolved by
edge_serveredge_server.pysame file
codeintel.edge_server._Bucketbackend/app/codeintel/edge_server.py, lines 42–55Open source
class _Bucket:    def __init__(self, rate: float, burst: int):        self.rate, self.burst, self.tokens, self.at = rate, burst, float(burst), time.monotonic()        self.lock = threading.Lock()    def take(self) -> bool:        with self.lock:            now = time.monotonic()            self.tokens = min(self.burst, self.tokens + (now - self.at) * self.rate)            self.at = now            if self.tokens >= 1:                self.tokens -= 1                return True            return False

What the index recorded

Signature
class _Bucket:
File
backend/app/codeintel/edge_server.py
Lines
42–55
Parser
python-ast
Git blob
909dfc0fcf1334828a534248afdadb1c50262110
Outside this subset
2 more edges reach code outside the graph shown here

Read it on GitHub at this commit