-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from zkurtz/add-pickle
support dill/pickle
- Loading branch information
Showing
7 changed files
with
78 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
"""IO for dill.""" | ||
|
||
from typing import Any | ||
|
||
import dill | ||
|
||
from dummio.constants import PathType | ||
|
||
|
||
def save(data: Any, *, filepath: PathType) -> None: | ||
"""Save a dill file.""" | ||
with open(filepath, "wb") as file: | ||
dill.dump(data, file) | ||
|
||
|
||
def load(filepath: PathType) -> Any: | ||
"""Read a dill file.""" | ||
with open(filepath, "rb") as file: | ||
return dill.load(file) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
"""IO for pickle.""" | ||
|
||
import pickle | ||
from typing import Any | ||
|
||
from dummio.constants import PathType | ||
|
||
|
||
def save(data: Any, *, filepath: PathType) -> None: | ||
"""Save a pickle file.""" | ||
with open(filepath, "wb") as file: | ||
pickle.dump(data, file) | ||
|
||
|
||
def load(filepath: PathType) -> Any: | ||
"""Read a pickle file.""" | ||
with open(filepath, "rb") as file: | ||
return pickle.load(file) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[project] | ||
name = "dummio" | ||
version = "1.3.0" | ||
version = "1.4.0" | ||
description = "Easiest-possible IO for basic file types." | ||
authors = [{ name = "Zach Kurtz", email = "[email protected]" }] | ||
readme = "README.md" | ||
|
@@ -21,6 +21,7 @@ extras = [ | |
"pyyaml>=6.0.2", | ||
"onnx>=1.10.1", | ||
"pydantic>=2.10.2", | ||
"dill>=0.2.2", | ||
] | ||
|
||
[project.urls] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.