Skip to content

Commit ceb7ccc

Browse files
committed
tidy up
1 parent ead30b9 commit ceb7ccc

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

numcodecs/delta.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def __init__(self, dtype, astype=None):
5757
def encode(self, buf):
5858

5959
# view input data as 1D array
60-
arr = ensure_ndarray_from_memory(buf).reshape(-1, order='A').view(self.dtype)
60+
arr = ensure_ndarray_from_memory(buf).view(self.dtype)
6161

6262
# setup encoded output
6363
enc = np.empty_like(arr, dtype=self.astype)
@@ -73,7 +73,7 @@ def encode(self, buf):
7373
def decode(self, buf, out=None):
7474

7575
# view encoded data as 1D array
76-
enc = ensure_ndarray_from_memory(buf).reshape(-1, order='A').view(self.astype)
76+
enc = ensure_ndarray_from_memory(buf).view(self.astype)
7777

7878
# setup decoded output
7979
if isinstance(out, np.ndarray):

numcodecs/packbits.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def __init__(self):
4040
def encode(self, buf):
4141

4242
# view input as ndarray
43-
arr = ensure_ndarray_from_memory(buf).reshape(-1, order='A').view(bool)
43+
arr = ensure_ndarray_from_memory(buf).view(bool)
4444

4545
# determine size of packed data
4646
n = arr.size
@@ -67,7 +67,7 @@ def encode(self, buf):
6767
def decode(self, buf, out=None):
6868

6969
# view encoded data as ndarray
70-
enc = ensure_ndarray_from_memory(buf).reshape(-1, order='A').view('u1')
70+
enc = ensure_ndarray_from_memory(buf).view('u1')
7171

7272
# find out how many bits were padded
7373
n_bits_padded = int(enc[0])

numcodecs/zlib.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ def encode(self, buf):
2828

2929
# normalise inputs
3030
if PY2: # pragma: py3 no cover
31+
# zlib does not like memoryviews on PY2, use old-style buffer instead
3132
buf = ensure_buffer(buf)
3233
else: # pragma: py2 no cover
3334
buf = ensure_memoryview(buf)
@@ -40,6 +41,7 @@ def decode(self, buf, out=None):
4041

4142
# normalise inputs
4243
if PY2: # pragma: py3 no cover
44+
# zlib does not like memoryviews on PY2, use old-style buffer instead
4345
buf = ensure_buffer(buf)
4446
else: # pragma: py2 no cover
4547
buf = ensure_memoryview(buf)

0 commit comments

Comments
 (0)