Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoSign in
Socket

binpickle

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

binpickle - pypi Package Compare versions

Comparing version
0.4.0a3
to
0.4.0a4
+1
-1
.copier-answers.yml
# Changes here will be overwritten by Copier
_commit: 00050f1
_commit: '8259712'
_src_path: https://github.com/lenskit/lk-project-template

@@ -4,0 +4,0 @@ package_name: binpickle

@@ -5,3 +5,3 @@ {

"editor.codeActionsOnSave": {
"source.organizeImports": "explicit"
"source.organizeImports.ruff": "explicit"
},

@@ -21,2 +21,2 @@ "editor.formatOnSave": true,

},
}
}
Metadata-Version: 2.1
Name: binpickle
Version: 0.4.0a3
Version: 0.4.0a4
Summary: Optimized format for pickling binary data.

@@ -5,0 +5,0 @@ Author-email: Michael Ekstrand <mdekstrand@drexel.edu>

@@ -69,2 +69,3 @@ import hashlib

entries: List[IndexEntry]
header: FileHeader | None
_file: io.BufferedWriter

@@ -140,9 +141,9 @@

warnings.warn("BinPickler not at beginning of file")
h = FileHeader()
self.header = FileHeader()
if sys.byteorder == "big":
h.flags |= Flags.BIG_ENDIAN
self.header.flags |= Flags.BIG_ENDIAN
if self.align and not self.codecs:
h.flags |= Flags.MAPPABLE
_log.debug("initializing header for %s: %s", self.filename, h)
self._file.write(h.encode())
self.header.flags |= Flags.MAPPABLE
_log.debug("initializing header for %s: %s", self.filename, self.header)
self._file.write(self.header.encode())
assert self._file.tell() == pos + FileHeader.SIZE

@@ -222,5 +223,6 @@

_log.debug("finalizing file with length %d", pos)
h = FileHeader(length=pos)
assert self.header is not None
self.header.length = pos
self._file.seek(0)
self._file.write(h.encode())
self._file.write(self.header.encode())
self._file.flush()

@@ -227,0 +229,0 @@

Metadata-Version: 2.1
Name: binpickle
Version: 0.4.0a3
Version: 0.4.0a4
Summary: Optimized format for pickling binary data.

@@ -5,0 +5,0 @@ Author-email: Michael Ekstrand <mdekstrand@drexel.edu>

@@ -0,21 +1,22 @@

import gc
import itertools as it
from pathlib import Path
from tempfile import TemporaryDirectory
from pathlib import Path
import gc
import numcodecs as nc
import numpy as np
import pandas as pd
import numcodecs as nc
from numcodecs.abc import Codec
from numcodecs.registry import codec_registry
from numcodecs.abc import Codec
import hypothesis.strategies as st
import pytest
from hypothesis import given, assume, settings
import hypothesis.strategies as st
from hypothesis import assume, given, settings
from hypothesis.extra.numpy import arrays, scalar_dtypes
from binpickle.errors import FormatWarning
from binpickle.format import Flags
from binpickle.read import BinPickleFile, load
from binpickle.write import BinPickler, dump
RW_CTORS = [

@@ -201,2 +202,18 @@ BinPickler,

def test_mappable_flag(tmp_path: Path, rng: np.random.Generator):
file = tmp_path / "matrix.bpk"
mat = rng.uniform(size=10_000)
with BinPickler.mappable(file) as w:
w.dump(mat)
with BinPickleFile(file, direct=True) as bpf:
assert bpf.is_mappable
assert Flags.MAPPABLE in bpf.header.flags
m2 = bpf.load()
assert np.all(m2 == mat)
del m2
@settings(deadline=None)

@@ -242,2 +259,3 @@ @given(arrays(scalar_dtypes(), st.integers(500, 10000)))

assert bpf.is_mappable
assert Flags.MAPPABLE in bpf.header.flags
assert len(bpf.entries) in (1, 2)

@@ -244,0 +262,0 @@ a2 = bpf.load()