forked from M-Labs/artiq
pyon: use dtype.str
* contains endianess, makes this portable * it's shorter * it's what the numpy array interfaces uses * this is otherwise backwards and forwards compatible
This commit is contained in:
parent
3d6f55104b
commit
a9434d2e9f
|
@ -140,14 +140,14 @@ class _Encoder:
|
||||||
def encode_nparray(self, x):
|
def encode_nparray(self, x):
|
||||||
r = "nparray("
|
r = "nparray("
|
||||||
r += self.encode(x.shape) + ", "
|
r += self.encode(x.shape) + ", "
|
||||||
r += self.encode(str(x.dtype)) + ", "
|
r += self.encode(x.dtype.str) + ", "
|
||||||
r += self.encode(base64.b64encode(x).decode())
|
r += self.encode(base64.b64encode(x).decode())
|
||||||
r += ")"
|
r += ")"
|
||||||
return r
|
return r
|
||||||
|
|
||||||
def encode_npscalar(self, x):
|
def encode_npscalar(self, x):
|
||||||
r = "npscalar("
|
r = "npscalar("
|
||||||
r += "\"" + type(x).__name__ + "\", "
|
r += self.encode(x.dtype.str) + ", "
|
||||||
r += self.encode(base64.b64encode(x).decode())
|
r += self.encode(base64.b64encode(x).decode())
|
||||||
r += ")"
|
r += ")"
|
||||||
return r
|
return r
|
||||||
|
|
Loading…
Reference in New Issue