Exemplo n.º 1
0
 def _extend(self, params, vals):
     assert len(params) == len(vals)
     map = self.map
     for i, param in enumerate(params):
         cell = values.W_ThreadCell(vals[i], True)
         map = map.assoc(param.get_key(), cell)
     return W_Parameterization(self.root, map)
Exemplo n.º 2
0
    def extend(self, params, vals):
        # why doesn't it like this assert?
        # assert len(params) == len(vals)
        # FIXME this is awful
        total = len(params) + len(self.keys)
        keys = [p.get_key() for p in params]
        new_keys = [None] * total
        new_vals = [None] * total
        for i in range(total):
            if i < len(params):
                new_keys[i] = keys[i]
                new_vals[i] = values.W_ThreadCell(vals[i], True)
            else:
                new_keys[i] = self.keys[i-len(params)]
                new_vals[i] = self.vals[i-len(params)]

        return W_Parameterization(self.root, new_keys, new_vals)
Exemplo n.º 3
0
 def __init__(self, val, guard=None, name=OBJ_NAME):
     W_BaseParameter.__init__(self, guard, name)
     self.key = ParamKey()
     cell = values.W_ThreadCell(val, True)
     top_level_config.root.table[self.key] = cell
Exemplo n.º 4
0
def make_thread_cell(v, pres):
    return values.W_ThreadCell(v, False if pres is values.w_false else True)