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

Function _worker

botasaurus/request_decorator.py:265–299  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

263 orginal_data = []
264
265 def _worker():
266 while True:
267 task = task_queue.get()
268
269 if task is None:
270 # Thread Finished
271 write_output(
272 output,
273 output_formats,
274 orginal_data,
275 flatten(result_list),
276 func.__name__,
277 )
278 task_queue.task_done()
279 break
280
281 args, kwargs = task
282 merged_kwargs = {
283 **wrapper_kwargs,
284 **kwargs,
285 } # Merge wrapper_kwargs with kwargs
286
287 if isinstance(args[0], list):
288 orginal_data.extend(args[0])
289 else:
290 orginal_data.append(args[0])
291
292 result = wrapper_requests(*args, **merged_kwargs)
293
294 if isinstance(args[0], list):
295 result_list.extend(result)
296 else:
297 result_list.append(result)
298
299 task_queue.task_done()
300
301 worker_thread = Thread(target=_worker, daemon=True)
302

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