Skip to content

Commit

Permalink
Remove devcontainer
Browse files Browse the repository at this point in the history
  • Loading branch information
tschm committed Jul 25, 2023
1 parent 325e135 commit e72911e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion cvx/bson/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def build_bson(file):
Returns:
_BsonFile object.
"""
return _BsonFile(file, read_bson(file))
return _BsonFile(file, dict(read_bson(file)))


@dataclass(frozen=True)
Expand Down
5 changes: 2 additions & 3 deletions cvx/bson/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@ def read_bson(file: Path):
bson_document = openfile.read()
data = bson.loads(bson_document)

return {
name: pd.read_feather(io.BytesIO(value)) for name, value in data.items()
}
for name, value in data.items():
yield name, pd.read_feather(io.BytesIO(value))


def write_bson(file: Path, dic, compression="zstd"):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_bson.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def test_write(prices, tmp_path):
write_bson(tmp_path / "maffay.bson", dic)
assert (tmp_path / "maffay.bson").exists()

x = read_bson(tmp_path / "maffay.bson")
x = dict(read_bson(tmp_path / "maffay.bson"))

assert set(x.keys()) == {"A", "B"}
pd.testing.assert_frame_equal(x["A"], prices)
Expand Down

0 comments on commit e72911e

Please sign in to comment.