moving around files (#616)

moved around files
This commit is contained in:
Ethan Weber authored and GitHub committed 2022-10-02 16:54:34 -07:00
1 parent 9d15ba6a2a
commit c20fed83bb
61 files changed
+226 -332

No files matched your search

+1 -25
View File
@@ -15,10 +15,9 @@
"""
Input/output utils.
"""
import json
import pickle
from pathlib import Path
from typing import Any
def load_from_json(filename: Path):
@@ -42,26 +41,3 @@ def write_to_json(filename: Path, content: dict):
assert filename.suffix == ".json"
with open(filename, "w", encoding="UTF-8") as file:
json.dump(content, file)
def load_from_pkl(filename: Path):
"""Load from a pickle file.
Args:
filename: The filename to load from.
"""
assert filename.suffix == ".pkl"
with open(filename, "rb") as f:
return pickle.load(f)
def write_to_pkl(filename: Path, content: Any):
"""Write to a pickle file.
Args:
filename (str): The filename to write to.
content (Any): The data to write.
"""
assert filename.suffix == ".pkl"
with open(filename, "wb") as f:
pickle.dump(content, f)