Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
peterdudfield committed Jul 18, 2024
1 parent a5b412a commit 8de490d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions ocf_blosc2/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
""" Main init file """
from .ocf_blosc2 import Blosc2
5 changes: 4 additions & 1 deletion ocf_blosc2/ocf_blosc2.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
""" Main code file """
import blosc2
from numcodecs.abc import Codec
from numcodecs.compat import ensure_contiguous_ndarray
Expand All @@ -22,7 +23,7 @@ class Blosc2(Codec):
codec_id = "blosc2"
max_buffer_size = 2**31 - 1

def __init__(self, cname="blosc2", clevel=5):
def __init__(self, cname="blosc2", clevel=5): # noqa
self.cname = cname
if cname == "zstd":
self._codec = blosc2.Codec.ZSTD
Expand All @@ -31,10 +32,12 @@ def __init__(self, cname="blosc2", clevel=5):
self.clevel = clevel

def encode(self, buf):
""" Encode method """
buf = ensure_contiguous_ndarray(buf, self.max_buffer_size)
return blosc2.compress(buf, codec=self._codec, clevel=self.clevel)

def decode(self, buf, out=None):
""" Decode method """
buf = ensure_contiguous_ndarray(buf, self.max_buffer_size)
return blosc2.decompress(buf, out)

Expand Down

0 comments on commit 8de490d

Please sign in to comment.