MCPcopy Create free account
hub / github.com/SourceCode-AI/aura / AsyncQueue

Class AsyncQueue

aura/worker_executor.py:89–131  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87
88
89class AsyncQueue:
90 def __init__(self, maxsize=0, *, loop=None, desc=None):
91 self.q = asyncio.Queue(maxsize=maxsize, loop=loop)
92 self.total = 0
93 self.completed = 0
94 self.progressbar = tqdm.tqdm(
95 desc=desc,
96 bar_format="{desc}: {percentage:3.0f}%|{bar}| {n_fmt}/{total_fmt}",
97 leave=False,
98 disable=config.PROGRESSBAR_DISABLED
99 )
100
101 def _update_progress(self):
102 if config.PROGRESSBAR_DISABLED:
103 return
104
105 self.progressbar.total = self.total
106 self.progressbar.n = self.completed
107 self.progressbar.update(0)
108
109 async def put(self, item):
110 await self.q.put(item)
111 self.total += 1
112 self._update_progress()
113
114 def put_nowait(self, item):
115 self.q.put_nowait(item)
116 self.total += 1
117 self._update_progress()
118
119 async def get(self):
120 return await self.q.get()
121
122 def get_nowait(self):
123 return self.get_nowait()
124
125 def task_done(self):
126 self.completed += 1
127 self.q.task_done()
128 self._update_progress()
129
130 async def join(self):
131 return await self.q.join()
132
133
134

Callers 2

prefetch_mirrorFunction · 0.85
__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected