Skip to content

Commit

Permalink
applying comments
Browse files Browse the repository at this point in the history
  • Loading branch information
aabadie committed May 27, 2016
1 parent 801d049 commit f33fac6
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions joblib/numpy_pickle.py
Expand Up @@ -389,8 +389,8 @@ def dump(value, filename, compress=0, protocol=None, cache_size=None):
if Path is not None and isinstance(filename, Path):
filename = str(filename)

isFilename = isinstance(filename, _basestring)
isFileobj = hasattr(filename, "read") and hasattr(filename, "write")
is_filename = isinstance(filename, _basestring)
is_fileobj = hasattr(filename, "write")

compress_method = 'zlib' # zlib is the default compression method.
if compress is True:
Expand Down Expand Up @@ -419,7 +419,7 @@ def dump(value, filename, compress=0, protocol=None, cache_size=None):
'Non valid compression method given: "{0}". Possible values are '
'{1}.'.format(compress_method, _COMPRESSORS))

if not isFilename and not isFileobj:
if not is_filename and not is_fileobj:
# People keep inverting arguments, and the resulting error is
# incomprehensible
raise ValueError(
Expand All @@ -428,7 +428,7 @@ def dump(value, filename, compress=0, protocol=None, cache_size=None):
% (filename, type(filename))
)

if isFilename and not isinstance(compress, tuple):
if is_filename and not isinstance(compress, tuple):
# In case no explicit compression was requested using both compression
# method and level in a tuple and the filename has an explicit
# extension, we select the corresponding compressor.
Expand Down Expand Up @@ -472,7 +472,7 @@ def dump(value, filename, compress=0, protocol=None, cache_size=None):
NumpyPickler(f, protocol=protocol).dump(value)

else:
if isFilename:
if is_filename:
with open(filename, 'wb') as f:
NumpyPickler(f, protocol=protocol).dump(value)
else:
Expand Down Expand Up @@ -548,7 +548,7 @@ def load(filename, mmap_mode=None):
if Path is not None and isinstance(filename, Path):
filename = str(filename)

if hasattr(filename, "read") and hasattr(filename, "write"):
if hasattr(filename, "read") and hasattr(filename, "seek"):
with _read_fileobject(filename, "", mmap_mode) as fobj:
obj = _unpickle(fobj)
else:
Expand Down

0 comments on commit f33fac6

Please sign in to comment.