예제 #1
0
def untake(x, idx, template):
    result = list(zeros_like(template))
    result[idx] = x
    return tuple(result)
예제 #2
0
 def iadd_any(other, self):
     array = zeros_like(self.template) if other is 0 else other
     array[self.idx] += self.val
     return array
예제 #3
0
 def zeros_like(self):
     return {k : zeros_like(v) for k, v in six.iteritems(getval(self))}
예제 #4
0
 def zeros_like(value):
     return tuple([zeros_like(item) for item in getval(value)])
예제 #5
0
def dict_untake(x, idx, template):
    result = dict(zeros_like(template))
    result[idx] = x
    return result
예제 #6
0
def list_untake(x, idx, template):
    result = list(zeros_like(template))
    result[idx] = x
    return result
예제 #7
0
 def zeros_like(value):
     return [zeros_like(item) for item in getval(value)]
예제 #8
0
def tuple_untake(x, idx, template):
    result = list(zeros_like(template))
    result[idx] = x
    return tuple(result)
예제 #9
0
def dict_untake(x, idx, template):
    result = dict(zeros_like(template))
    result[idx] = x
    return result
예제 #10
0
 def zeros_like(self):
     return {k: zeros_like(v) for k, v in six.iteritems(getval(self))}
예제 #11
0
def list_untake(x, idx, template):
    result = list(zeros_like(template))
    result[idx] = x
    return result