-
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.
fixed file not found error when installed using pip
- Loading branch information
1 parent
b05c7a0
commit 42319c8
Showing
5 changed files
with
33 additions
and
6 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
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 |
---|---|---|
@@ -1,11 +1,24 @@ | ||
import os | ||
import pickle | ||
|
||
from pickles import read_pickle | ||
|
||
|
||
def load_pickle(pickle_name: str): | ||
""" | ||
TIP: DO NOT use this | ||
Reads the contents of the given pickle, and returns a dict. | ||
:param pickle_name: Name of the pickle file | ||
:return: dict | ||
""" | ||
with open(pickle_name, 'rb') as handle: | ||
return pickle.load(handle) | ||
|
||
|
||
def load_pickle_by_name(name: str): | ||
""" | ||
Reads the contents of the given pickle, and returns a dict. | ||
:param name: Name of the pickle file | ||
:return: dict | ||
""" | ||
return read_pickle(name) |
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,14 @@ | ||
import os | ||
import pickle | ||
|
||
|
||
def read_pickle(name: str) -> dict: | ||
""" | ||
Reads pickles by name | ||
:param name: | ||
:return: | ||
""" | ||
this_dir, _ = os.path.split(__file__) | ||
data_path = os.path.join(this_dir, name) | ||
with open(data_path, 'rb') as handle: | ||
return pickle.load(handle) |