Exemple #1
0
 def __init__(self, name, event):
     if not (isinstance(event, SparkEvent)): raise AssertionError
     ConstructibleValue.__init__(self)
     self._name = name
     self._event = event
     self._completed = None
     #self._monitors = []
     if USE_WEAKDICT_NAME_TABLES:
         self._weakdict[name] = self
     self._parent = self.tf_is_sync()
 def __init__(self, name, event):
     if not (isinstance(event, SparkEvent)):
         raise AssertionError
     ConstructibleValue.__init__(self)
     self._name = name
     self._event = event
     self._completed = None
     # self._monitors = []
     if USE_WEAKDICT_NAME_TABLES:
         self._weakdict[name] = self
     self._parent = self.tf_is_sync()
Exemple #3
0
 def __init__(self, name):
     #self.time = time.time()
     ConstructibleValue.__init__(self)
     if name is None:
         SparkEvent.idCounter += 1
         name = "%s%d" % (self.name_base, SparkEvent.idCounter)
     else:
         if not (isinstance(name, basestring)): raise AssertionError
     self._name = name
     if USE_WEAKDICT_NAME_TABLES:
         self._weakdict[name] = self
Exemple #4
0
 def __init__(self, name):
     #self.time = time.time()
     ConstructibleValue.__init__(self)
     if name is None:
         SparkEvent.idCounter += 1
         name = "%s%d"%(self.name_base, SparkEvent.idCounter)
     else:
         if not (isinstance(name, basestring)): raise AssertionError
     self._name = name
     if USE_WEAKDICT_NAME_TABLES:        
         self._weakdict[name] = self
Exemple #5
0
 def __init__(self, mode, fun):
     ConstructibleValue.__init__(self)
     # Mode string is of the form [A]?[+?-]+[*]?
     #print "New Basic:", mode, fun
     self._modeString = mode
     if mode.startswith("A"):
         # fun takes the agent as an argument
         self._input_agent_p = True
         io = mode[1:]
     else:
         self._input_agent_p = False
         io = mode
     self._input_indices = []
     self._both_indices = []
     self._output_indices = []
     if io.endswith("*"):
         if not (io[-2:] in ("+*","-*","?*")): raise AssertionError, \
                "Repeated mode must be one of +, ?, or -: %s" % mode
         self._rest_mode = io[-2]
         io = io[:-2]
     elif len(io) > 1 and io[-2] == "*": # allow *+ stlye rest mode declaration
         if not (io[-2:] in ("*+", "*-", "*?")): raise AssertionError, \
                "Repeated mode must be one of +, ?, or -: %s" % mode
         self._rest_mode = io[-1]
         io = io[:-2]
     else:
         self._rest_mode = None
     self._nrequired = len(io)
     for i in range(len(io)):
         char = io[i]
         if char == "+":
             # This is an input parameter
             self._input_indices.append(i)
         elif char == "-":
             # This is an output parameter
             self._output_indices.append(i)
         elif char == "?":
             # Acts as both an input and an output
             self._input_indices.append(i)
             self._output_indices.append(i)
             self._both_indices.append(i)
         else:
             raise LowError("The mode string %r is not valid", mode)
     self._function = make_callable(fun)
     self._output_range = range(len(self._output_indices))
     self._sym = None
Exemple #6
0
class ZB(BindingsInt, ConstructibleValue):
    """This is an object that simultaneously performs the role of
    bindings and zexpr."""
    # This doesn't really need to be a ConstructibleValue - it is
    # really an immutable pair - but making it a
    # ConstructibleValue means that persistence is simple.
    __slots__ = (
        "bindings",
        "zexpr",
    )

    def __init__(self, (bindings, zexpr)):
        ConstructibleValue.__init__(self)
        self.bindings = bindings
        self.zexpr = zexpr
Exemple #7
0
 def __init__(self, initSeq=None):
     ConstructibleValue.__init__(self)
     if initSeq is None:
         self._contents = []
     else:
         self._contents = list(initSeq)
Exemple #8
0
 def __init__(self, vars, solutions):
     ConstructibleValue.__init__(self)
     self.vars = tuple(vars)
     self.solutions = list(solutions)
 def __init__(self, seq=()):
     ConstructibleValue.__init__(self)
     self._contents = list(seq)
Exemple #10
0
 def __init__(self, seq=()):
     ConstructibleValue.__init__(self)
     self._contents = list(seq)
Exemple #11
0
 def __init__(self, captured, closed_zexpr):
     ConstructibleValue.__init__(self)
     self.closed_zexpr = closed_zexpr
     self.captured_dict = dict(captured)
Exemple #12
0
 def __init__(self, vars, solutions):
     ConstructibleValue.__init__(self)
     self.vars = tuple(vars)
     self.solutions = list(solutions)
Exemple #13
0
 def __init__(self, captured, closed_zexpr):
     ConstructibleValue.__init__(self)
     self.closed_zexpr = closed_zexpr
     self.captured_dict = dict(captured)