~christopher-hunt08/maus/maus_integrated_kalman

« back to all changes in this revision

Viewing changes to src/map/MapPyGroup/MapPyGroup.py

  • Committer: Durga Rajaram
  • Date: 2014-07-16 15:13:05 UTC
  • mfrom: (659.1.92 cand)
  • Revision ID: durga@fnal.gov-20140716151305-q27rv1y9p03v9lks
Tags: MAUS-v0.9, MAUS-v0.9.0
MAUS-v0.9.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
#  along with MAUS.  If not, see <http://www.gnu.org/licenses/>.
18
18
 
19
19
from types import ListType
20
 
import inspect
21
20
import sys
22
21
 
23
22
import ErrorHandler
89
88
        """
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')
97
 
 
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')
106
 
 
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')
111
 
 
112
95
        self._workers.append(worker)
113
96
 
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)
177
159
        return nu_spill
178
160
 
179
161
    def death(self):