Skip to content

Commit 8e01f63

Browse files
committed
Remove unused, add docstrings
1 parent 4366b5b commit 8e01f63

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

numcodecs/fletcher32.pyx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
# cython: boundscheck=False
2-
# cython: wraparound=False
3-
# cython: overflowcheck=False
4-
# cython: cdivision=True
5-
61
import struct
7-
import numpy as np
82

93
from numcodecs.abc import Codec
104
from numcodecs.compat import ensure_contiguous_ndarray
@@ -14,6 +8,7 @@ from libc.stdint cimport uint8_t, uint16_t, uint32_t
148
cdef extern from "_fletcher.c":
159
uint32_t H5_checksum_fletcher32(const void *_data, size_t _len)
1610

11+
1712
class Fletcher32(Codec):
1813
"""The fletcher checksum with 16-bit words and 32-bit output
1914
@@ -26,12 +21,14 @@ class Fletcher32(Codec):
2621
codec_id = "fletcher32"
2722

2823
def encode(self, buf):
24+
"""Return buffer plus 4-byte fletcher checksum"""
2925
buf = ensure_contiguous_ndarray(buf).ravel().view('uint8')
3026
cdef const uint8_t[::1] b_ptr = buf
3127
val = H5_checksum_fletcher32(&b_ptr[0], buf.nbytes)
3228
return buf.tobytes() + struct.pack("<I", val)
3329

3430
def decode(self, buf, out=None):
31+
"""Check fletcher checksum, and return buffer without it"""
3532
b = ensure_contiguous_ndarray(buf).view('uint8')
3633
cdef const uint8_t[::1] b_ptr = b
3734
val = H5_checksum_fletcher32(&b_ptr[0], b.nbytes - 4)

0 commit comments

Comments
 (0)