Skip to content

Commit 2e8c37e

Browse files
committed
moving python array
1 parent 2559871 commit 2e8c37e

2 files changed

Lines changed: 30 additions & 15 deletions

File tree

wolframclient/language/array.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
from __future__ import absolute_import, print_function, unicode_literals
2+
3+
from wolframclient.serializers.wxfencoder import constants
4+
from wolframclient.utils import six
5+
6+
try:
7+
from collections.abc import Sequence
8+
except ImportError:
9+
from collections import Sequence
10+
11+
12+
class PythonArray(Sequence):
13+
def __init__(self, array, type, shape=None):
14+
15+
self.array = array
16+
self.shape = shape or (len(array),)
17+
18+
if isinstance(type, six.string_types):
19+
self.type = constants.ARRAY_TYPES[type]
20+
else:
21+
self.type = type
22+
23+
def tobytes(self):
24+
raise NotImplementedError("aaa")
25+
26+
def __getitem__(self, k):
27+
return self.array[k]
28+
29+
def __len__(self):
30+
return len(self.array)

wolframclient/utils/pythonarray.py

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)