Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass additional kwargs to pickle.load (in __load) #5

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions pyradigm/pyradigm.py
Original file line number Diff line number Diff line change
Expand Up @@ -585,15 +585,15 @@ def __copy(self, other):

return self

def __load(self, path):
def __load(self, path, **kwargs):
"""Method to load the serialized dataset from disk."""
try:
path = os.path.abspath(path)
with open(path, 'rb') as df:
# loaded_dataset = pickle.load(df)
self.__data, self.__classes, self.__labels, \
self.__dtype, self.__description, \
self.__num_features, self.__feature_names = pickle.load(df)
self.__num_features, self.__feature_names = pickle.load(df, **kwargs)

# ensure the loaded dataset is valid
self.__validate(self.__data, self.__classes, self.__labels)
Expand All @@ -603,7 +603,7 @@ def __load(self, path):
except:
raise

def save(self, path):
def save(self, path, **kwargs):
"""Method to serialize the dataset to disk."""
try:
path = os.path.abspath(path)
Expand All @@ -612,7 +612,7 @@ def save(self, path):
pickle.dump((self.__data, self.__classes, self.__labels,
self.__dtype, self.__description, self.__num_features,
self.__feature_names),
df)
df, **kwargs)
return
except IOError as ioe:
raise IOError('Unable to save the dataset to file: {}', format(ioe))
Expand Down