Merge branch 'devel' into paramz

Conflicts:
	GPy/core/parameterization/parameter_core.py
	GPy/testing/pickle_tests.py
This commit is contained in:
mzwiessele 2015-11-02 10:11:26 +00:00
commit 5d605277bc
9 changed files with 58 additions and 38 deletions

View file

@ -39,18 +39,28 @@ def load(file_or_path):
:param file_name: path/to/file.pickle
"""
# This is the pickling pain when changing _src -> src
try:
import cPickle as pickle
if isinstance(file_or_path, basestring):
with open(file_or_path, 'rb') as f:
m = pickle.load(f)
else:
m = pickle.load(file_or_path)
except:
import pickle
if isinstance(file_or_path, str):
with open(file_or_path, 'rb') as f:
m = pickle.load(f)
else:
m = pickle.load(file_or_path)
try:
import cPickle as pickle
if isinstance(file_or_path, basestring):
with open(file_or_path, 'rb') as f:
m = pickle.load(f)
else:
m = pickle.load(file_or_path)
except:
import pickle
if isinstance(file_or_path, str):
with open(file_or_path, 'rb') as f:
m = pickle.load(f)
else:
m = pickle.load(file_or_path)
except ImportError:
import sys
import inspect
sys.modules['GPy.kern._src'] = kern.src
for name, module in inspect.getmembers(kern.src):
if not name.startswith('_'):
sys.modules['GPy.kern._src.{}'.format(name)] = module
m = load(file_or_path)
return m