MCPcopy
hub / github.com/celery/celery / _FastLocalStack

Class _FastLocalStack

celery/utils/threads.py:305–321  ·  celery/utils/threads.py::_FastLocalStack

Source from the content-addressed store, hash-verified

303
304
305class _FastLocalStack(threading.local):
306
307 def __init__(self):
308 self.stack = []
309 self.push = self.stack.append
310 self.pop = self.stack.pop
311 super().__init__()
312
313 @property
314 def top(self):
315 try:
316 return self.stack[-1]
317 except (AttributeError, IndexError):
318 return None
319
320 def __len__(self):
321 return len(self.stack)
322
323
324if USE_FAST_LOCALS: class="cm"># pragma: no cover

Callers 1

test_stackMethod · 0.90

Calls

no outgoing calls

Tested by 1

test_stackMethod · 0.72