Beispiel #1
0
 def recordIdUsed(self, id, obj):
     """Called when object is used"""
     if not self._info.has_key(id):
         # make sure that we don't loop when getting state info
         self._info[id] = None
         # get exists and state info
         # this will call recordIdUsed for anything obj references
         cl_name = obj.__class__.__name__
         if not (CONSTRUCTOR_NAME_CLASS.has_key(cl_name)):
             print "ERROR: No constructor has been installed for %s"%cl_name
         try:
             existIEArgs = [inverse_eval(x) for x in obj.constructor_args()]
             existIEArgs.insert(0, cl_name)
             self._existsIEFacts.append((id, List(existIEArgs)))
         except:
             errid = NEWPM.displayError()
             print
             print "ERROR finding constructor_args() for instance %d of %s" \
                   % (id, cl_name)
             print
         try:
             state_args = obj.state_args()
             if state_args:
                 stateIEArgs = [inverse_eval(x) for x in state_args]
                 self._stateIEFacts.append((id, List(stateIEArgs)))
         except:
             errid = NEWPM.displayError()
             print
             print "ERROR finding state_args() for instance %d of %s" \
                   % (id, cl_name)
             print
         self._info[id] = obj
Beispiel #2
0
 def recordIdUsed(self, id, obj):
     """Called when object is used"""
     if not self._info.has_key(id):
         # make sure that we don't loop when getting state info
         self._info[id] = None
         # get exists and state info
         # this will call recordIdUsed for anything obj references
         cl_name = obj.__class__.__name__
         if not (CONSTRUCTOR_NAME_CLASS.has_key(cl_name)):
             print "ERROR: No constructor has been installed for %s" % cl_name
         try:
             existIEArgs = [inverse_eval(x) for x in obj.constructor_args()]
             existIEArgs.insert(0, cl_name)
             self._existsIEFacts.append((id, List(existIEArgs)))
         except:
             errid = NEWPM.displayError()
             print
             print "ERROR finding constructor_args() for instance %d of %s" \
                   % (id, cl_name)
             print
         try:
             state_args = obj.state_args()
             if state_args:
                 stateIEArgs = [inverse_eval(x) for x in state_args]
                 self._stateIEFacts.append((id, List(stateIEArgs)))
         except:
             errid = NEWPM.displayError()
             print
             print "ERROR finding state_args() for instance %d of %s" \
                   % (id, cl_name)
             print
         self._info[id] = obj
Beispiel #3
0
def failure_inverse_eval(failure):
    return Structure(Symbol("failure"), [inverse_eval(x) for x in deconstructFailure(failure)])
Beispiel #4
0
def failure_inverse_eval(failure):
    return Structure(Symbol("failure"),
                     [inverse_eval(x) for x in deconstructFailure(failure)])