90
89
if not hasattr(worker, 'birth'):
91
90
raise TypeError(str(worker) + ' does not have a birth()')
92
# Python uses args, SWIG uses varargs.
93
py_ok = len(inspect.getargspec(worker.birth).args) == 2 # for python
94
swig_ok = inspect.getargspec(worker.birth).varargs != None # for swig
95
if not py_ok ^ swig_ok: # exclusive or
96
raise TypeError(str(worker) + ' birth() has wrong call signature')
98
91
if not hasattr(worker, 'process'):
99
92
raise TypeError(str(worker) + ' does not have a process()')
100
# Python uses args, SWIG uses varargs.
101
py_ok = len(inspect.getargspec(worker.process).args) == 2
102
swig_ok = inspect.getargspec(worker.process).varargs != None
103
if not py_ok ^ swig_ok: # exclusive or
104
raise TypeError(str(worker) +
105
' process() has wrong call signature')
107
93
if not hasattr(worker, 'death'):
108
94
raise TypeError(str(worker)+' does not have a death()')
109
if len(inspect.getargspec(worker.death).args) != 1: # self only
110
raise TypeError(str(worker) + ' death() has wrong call signature')
112
95
self._workers.append(worker)
114
97
def birth(self, json_config_doc):
173
156
if not (hasattr(worker, "can_convert") and worker.can_convert):
174
157
nu_spill = converter.string_repr(nu_spill)
175
158
nu_spill = worker.process(nu_spill)
176
nu_spill = converter.string_repr(nu_spill)