@@ -187,9 +187,9 @@ def PopenPiped(self, args):
187
187
188
188
189
189
class Reply (object ):
190
- """ reply instances provide access to the result
191
- of a function execution that got dispatched
192
- through WorkerPool.spawn()
190
+ """reply instances provide access to the result
191
+ of a function execution that got dispatched
192
+ through WorkerPool.spawn()
193
193
"""
194
194
195
195
def __init__ (self , task , threadmodel ):
@@ -198,10 +198,10 @@ def __init__(self, task, threadmodel):
198
198
self .running = True
199
199
200
200
def get (self , timeout = None ):
201
- """ get the result object from an asynchronous function execution.
202
- if the function execution raised an exception,
203
- then calling get() will reraise that exception
204
- including its traceback.
201
+ """get the result object from an asynchronous function execution.
202
+ if the function execution raised an exception,
203
+ then calling get() will reraise that exception
204
+ including its traceback.
205
205
"""
206
206
self .waitfinish (timeout )
207
207
try :
@@ -228,14 +228,14 @@ def run(self):
228
228
229
229
230
230
class WorkerPool (object ):
231
- """ A WorkerPool allows to spawn function executions
232
- to threads, returning a reply object on which you
233
- can ask for the result (and get exceptions reraised).
234
-
235
- This implementation allows the main thread to integrate
236
- itself into performing function execution through
237
- calling integrate_as_primary_thread() which will return
238
- when the pool received a trigger_shutdown().
231
+ """A WorkerPool allows to spawn function executions
232
+ to threads, returning a reply object on which you
233
+ can ask for the result (and get exceptions reraised).
234
+
235
+ This implementation allows the main thread to integrate
236
+ itself into performing function execution through
237
+ calling integrate_as_primary_thread() which will return
238
+ when the pool received a trigger_shutdown().
239
239
"""
240
240
241
241
def __init__ (self , execmodel , hasprimary = False ):
@@ -253,7 +253,7 @@ def __init__(self, execmodel, hasprimary=False):
253
253
self ._primary_thread_task_ready = None
254
254
255
255
def integrate_as_primary_thread (self ):
256
- """ integrate the thread with which we are called as a primary
256
+ """integrate the thread with which we are called as a primary
257
257
thread for executing functions triggered with spawn().
258
258
"""
259
259
assert self .execmodel .backend == "thread" , self .execmodel
@@ -303,8 +303,8 @@ def _try_send_to_primary_thread(self, reply):
303
303
return False
304
304
305
305
def spawn (self , func , * args , ** kwargs ):
306
- """ return Reply object for the asynchronous dispatch
307
- of the given func(*args, **kwargs).
306
+ """return Reply object for the asynchronous dispatch
307
+ of the given func(*args, **kwargs).
308
308
"""
309
309
reply = Reply ((func , args , kwargs ), self .execmodel )
310
310
with self ._running_lock :
@@ -572,14 +572,14 @@ def _trace(self, *msg):
572
572
self .gateway ._trace (self .id , * msg )
573
573
574
574
def setcallback (self , callback , endmarker = NO_ENDMARKER_WANTED ):
575
- """ set a callback function for receiving items.
576
-
577
- All already queued items will immediately trigger the callback.
578
- Afterwards the callback will execute in the receiver thread
579
- for each received data item and calls to ``receive()`` will
580
- raise an error.
581
- If an endmarker is specified the callback will eventually
582
- be called with the endmarker when the channel closes.
575
+ """set a callback function for receiving items.
576
+
577
+ All already queued items will immediately trigger the callback.
578
+ Afterwards the callback will execute in the receiver thread
579
+ for each received data item and calls to ``receive()`` will
580
+ raise an error.
581
+ If an endmarker is specified the callback will eventually
582
+ be called with the endmarker when the channel closes.
583
583
"""
584
584
_callbacks = self .gateway ._channelfactory ._callbacks
585
585
with self .gateway ._receivelock :
@@ -650,15 +650,15 @@ def _getremoteerror(self):
650
650
# public API for channel objects
651
651
#
652
652
def isclosed (self ):
653
- """ return True if the channel is closed. A closed
654
- channel may still hold items.
653
+ """return True if the channel is closed. A closed
654
+ channel may still hold items.
655
655
"""
656
656
return self ._closed
657
657
658
658
def makefile (self , mode = "w" , proxyclose = False ):
659
- """ return a file-like object.
660
- mode can be 'w' or 'r' for writeable/readable files.
661
- if proxyclose is true file.close() will also close the channel.
659
+ """return a file-like object.
660
+ mode can be 'w' or 'r' for writeable/readable files.
661
+ if proxyclose is true file.close() will also close the channel.
662
662
"""
663
663
if mode == "w" :
664
664
return ChannelFileWrite (channel = self , proxyclose = proxyclose )
@@ -667,10 +667,10 @@ def makefile(self, mode="w", proxyclose=False):
667
667
raise ValueError ("mode {!r} not availabe" .format (mode ))
668
668
669
669
def close (self , error = None ):
670
- """ close down this channel with an optional error message.
671
- Note that closing of a channel tied to remote_exec happens
672
- automatically at the end of execution and cannot
673
- be done explicitely.
670
+ """close down this channel with an optional error message.
671
+ Note that closing of a channel tied to remote_exec happens
672
+ automatically at the end of execution and cannot
673
+ be done explicitely.
674
674
"""
675
675
if self ._executing :
676
676
raise IOError ("cannot explicitly close channel within remote_exec" )
@@ -699,7 +699,7 @@ def close(self, error=None):
699
699
self .gateway ._channelfactory ._no_longer_opened (self .id )
700
700
701
701
def waitclose (self , timeout = None ):
702
- """ wait until this channel is closed (or the remote side
702
+ """wait until this channel is closed (or the remote side
703
703
otherwise signalled that no more data was being sent).
704
704
The channel may still hold receiveable items, but not receive
705
705
any more after waitclose() has returned. Exceptions from executing
@@ -1319,7 +1319,7 @@ def _buildopcodes():
1319
1319
1320
1320
1321
1321
def dumps (obj ):
1322
- """ return a serialized bytestring of the given obj.
1322
+ """return a serialized bytestring of the given obj.
1323
1323
1324
1324
The obj and all contained objects must be of a builtin
1325
1325
python type (so nested dicts, sets, etc. are all ok but
@@ -1334,7 +1334,7 @@ def dump(byteio, obj):
1334
1334
1335
1335
1336
1336
def loads (bytestring , py2str_as_py3str = False , py3str_as_py2str = False ):
1337
- """ return the object as deserialized from the given bytestring.
1337
+ """return the object as deserialized from the given bytestring.
1338
1338
1339
1339
py2str_as_py3str: if true then string (str) objects previously
1340
1340
dumped on Python2 will be loaded as Python3
@@ -1354,7 +1354,7 @@ def loads(bytestring, py2str_as_py3str=False, py3str_as_py2str=False):
1354
1354
1355
1355
1356
1356
def load (io , py2str_as_py3str = False , py3str_as_py2str = False ):
1357
- """ derserialize an object form the specified stream.
1357
+ """derserialize an object form the specified stream.
1358
1358
1359
1359
Behaviour and parameters are otherwise the same as with ``loads``
1360
1360
"""
0 commit comments