MCPcopy
hub / github.com/omkarcloud/botasaurus / _worker

Function _worker

botasaurus/task_decorator.py:239–272  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

237 orginal_data = []
238
239 def _worker():
240 while True:
241 task = task_queue.get()
242
243 if task is None:
244 write_output(
245 output,
246 output_formats,
247 orginal_data,
248 flatten(result_list),
249 func.__name__,
250 )
251 task_queue.task_done()
252 break
253
254 args, kwargs = task
255 merged_kwargs = {
256 **wrapper_kwargs,
257 **kwargs,
258 } # Merge wrapper_kwargs with kwargs
259
260 if isinstance(args[0], list):
261 orginal_data.extend(args[0])
262 else:
263 orginal_data.append(args[0])
264
265 result = wrapper_requests(*args, **merged_kwargs)
266
267 if isinstance(args[0], list):
268 result_list.extend(result)
269 else:
270 result_list.append(result)
271
272 task_queue.task_done()
273
274 worker_thread = Thread(target=_worker, daemon=True)
275

Callers

nothing calls this directly

Calls 4

write_outputFunction · 0.90
flattenFunction · 0.70
wrapper_requestsFunction · 0.70
getMethod · 0.45

Tested by

no test coverage detected