homa 2.2__tar.gz → 2.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {homa-2.2 → homa-2.3}/PKG-INFO +1 -1
- {homa-2.2 → homa-2.3}/homa/__init__.py +1 -0
- homa-2.3/homa/helpers.py +22 -0
- {homa-2.2 → homa-2.3}/homa.egg-info/PKG-INFO +1 -1
- {homa-2.2 → homa-2.3}/homa.egg-info/SOURCES.txt +1 -0
- {homa-2.2 → homa-2.3}/LICENSE +0 -0
- {homa-2.2 → homa-2.3}/README.md +0 -0
- {homa-2.2 → homa-2.3}/homa/datasets.py +0 -0
- {homa-2.2 → homa-2.3}/homa.egg-info/dependency_links.txt +0 -0
- {homa-2.2 → homa-2.3}/homa.egg-info/requires.txt +0 -0
- {homa-2.2 → homa-2.3}/homa.egg-info/top_level.txt +0 -0
- {homa-2.2 → homa-2.3}/setup.cfg +0 -0
- {homa-2.2 → homa-2.3}/setup.py +0 -0
{homa-2.2 → homa-2.3}/PKG-INFO
RENAMED
homa-2.3/homa/helpers.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import pickle
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def pickle(filename_or_variable: str | object, target_file: str | None = None):
|
|
5
|
+
if not target_file and isinstance(filename_or_variable, str):
|
|
6
|
+
return read_from_pickle(filename_or_variable)
|
|
7
|
+
|
|
8
|
+
if target_file and isinstance(filename_or_variable, object):
|
|
9
|
+
write_to_pickle(filename_or_variable, target_file)
|
|
10
|
+
|
|
11
|
+
raise Exception("Wrong pickle helper inputs")
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def write_to_pickle(data, filename):
|
|
15
|
+
with open(filename, "wb") as f:
|
|
16
|
+
pickle.dump(data, f)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def read_from_pickle(filename):
|
|
20
|
+
with open(filename, "rb") as f:
|
|
21
|
+
data = pickle.load(f)
|
|
22
|
+
return data
|
{homa-2.2 → homa-2.3}/LICENSE
RENAMED
|
File without changes
|
{homa-2.2 → homa-2.3}/README.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{homa-2.2 → homa-2.3}/setup.cfg
RENAMED
|
File without changes
|
{homa-2.2 → homa-2.3}/setup.py
RENAMED
|
File without changes
|