Skip to content

Commit

Permalink
Merge pull request #5 from openclimatefix/issue/tidy-up
Browse files Browse the repository at this point in the history
fix release
  • Loading branch information
peterdudfield authored Jul 18, 2024
2 parents bde8534 + 076b974 commit 6965f70
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
- main
jobs:
call-run-python-release:
uses: openclimatefix/.github/.github/workflows/python-release.yml@main
uses: openclimatefix/.github/.github/workflows/python-release.yml@v1.8.1
secrets:
token: ${{ secrets.PYPI_API_TOKEN }}
PAT_TOKEN: ${{ secrets.PAT_TOKEN }}
4 changes: 3 additions & 1 deletion .github/workflows/workflows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ on:
- cron: "0 12 * * 1"
jobs:
call-run-python-tests:
uses: openclimatefix/.github/.github/workflows/python-test.yml@main
uses: openclimatefix/.github/.github/workflows/python-test.yml@v1.8.1
with:
# 0 means don't use pytest-xdist
pytest_numcpus: "1"
# pytest-cov looks at this folder
pytest_cov_dir: "ocf_blosc2"
os_list: '["ubuntu-latest"]'
python-version: "['3.10','3.11']"
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 6965f70

Please sign in to comment.