MCPcopy Create free account
hub / github.com/celery/celery / _FastLocalStack

Class _FastLocalStack

celery/utils/threads.py:362–380  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

360
361
362class _FastLocalStack(threading.local):
363
364 def __init__(self):
365 self.stack = []
366 self.push = self.stack.append
367 self.pop = self.stack.pop
368 super().__init__()
369
370 @property
371 def top(self):
372 try:
373 return self.stack[-1]
374 except (AttributeError, IndexError):
375 return None
376
377 __class_getitem__ = classmethod(types.GenericAlias)
378
379 def __len__(self):
380 return len(self.stack)
381
382
383if USE_FAST_LOCALS: # pragma: no cover

Callers 1

test_stackMethod · 0.90

Calls

no outgoing calls

Tested by 1

test_stackMethod · 0.72