Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self, main, *args, **kwargs):
self.inbox = Queue()
self.outbox = Queue()
self._result = None
self._exception = None
self._done = False
comm = QComm(self.inbox, self.outbox)
self.process = Process(target=QCommProcess._qcomm_main,
args=(comm, main) + args, kwargs=kwargs)
def __init__(self, main, *args, **kwargs):
self.inbox = Queue()
self.outbox = Queue()
self._result = None
self._exception = None
self._done = False
comm = QComm(self.inbox, self.outbox)
self.process = Process(target=QCommProcess._qcomm_main,
args=(comm, main) + args, kwargs=kwargs)
def get_num_workers(self):
"""Return global _ncomms"""
return QComm._ncomms.value
def __init__(self, inbox, outbox, copy_msg=False):
"Set the inbox and outbox queues."
self._inbox = inbox
self._outbox = outbox
self._copy = copy_msg
self._pushback = None
with QComm.lock:
QComm._ncomms.value += 1
def __init__(self, inbox, outbox, copy_msg=False):
"Set the inbox and outbox queues."
self._inbox = inbox
self._outbox = outbox
self._copy = copy_msg
self.recv_buffer = None
with QComm.lock:
QComm._ncomms.value += 1
def __init__(self, main, *args, **kwargs):
self.inbox = queue.Queue()
self.outbox = queue.Queue()
self.main = main
self._result = None
self._exception = None
kwargs['comm'] = QComm(self.inbox, self.outbox, True)
self.thread = Thread(target=self._qcomm_main,
args=args, kwargs=kwargs)
def await_workers(self, nworkers):
"Wait for a pool of workers to join."
sharedq = self.get_shared()
wqueues = []
for _ in range(nworkers):
workerID = sharedq.get()
inbox = self.get_outbox(workerID)
outbox = self.get_inbox(workerID)
wqueues.append(QComm(inbox, outbox))
return wqueues
def __init__(self, main, *args, **kwargs):
self.inbox = queue.Queue()
self.outbox = queue.Queue()
self.main = main
self._result = None
self._exception = None
kwargs['comm'] = QComm(self.inbox, self.outbox, True)
self.thread = Thread(target=self._qcomm_main,
args=args, kwargs=kwargs)
def __init__(self, inbox, outbox, copy_msg=False):
"Set the inbox and outbox queues."
self._inbox = inbox
self._outbox = outbox
self._copy = copy_msg
self.recv_buffer = None
with QComm.lock:
QComm._ncomms.value += 1
def __enter__(self):
"Enter the context."
return QComm(self.get_inbox(), self.get_outbox())