Method
__init__
(self, arg, typecode, shape=None)
Source from the content-addressed store, hash-verified
| 168 | backend = "array" |
| 169 | |
| 170 | def __init__(self, arg, typecode, shape=None): |
| 171 | if isinstance(arg, (int, float)): |
| 172 | if shape is None: |
| 173 | shape = () |
| 174 | else: |
| 175 | try: |
| 176 | shape = mkshape(shape) |
| 177 | except TypeError: |
| 178 | shape = (int(shape),) |
| 179 | size = product(shape) |
| 180 | arg = [arg] * size |
| 181 | else: |
| 182 | size = len(arg) |
| 183 | if shape is None: |
| 184 | shape = (size,) |
| 185 | else: |
| 186 | shape = mkshape(shape) |
| 187 | assert size == product(shape) |
| 188 | self.array = array.array(typecode, arg) |
| 189 | |
| 190 | @property |
| 191 | def address(self): |
Tested by
no test coverage detected