Skip to content

Commit

Permalink
Update joblib/memory.py
Browse files Browse the repository at this point in the history
Co-authored-by: Thomas Moreau <thomas.moreau.2010@gmail.com>
  • Loading branch information
studyproject-mlds and tomMoral committed Nov 12, 2020
1 parent 0e6bcdc commit a7037e3
Showing 1 changed file with 10 additions and 17 deletions.
27 changes: 10 additions & 17 deletions joblib/memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,17 +412,9 @@ class MemorizedFunc(Logger):
# Public interface
# ------------------------------------------------------------------------

def __init__(
self,
func,
location,
backend='local',
ignore=None,
mmap_mode=None,
compress=False,
verbose=1,
timestamp=None,
hash_func=None):
def __init__(self, func, location, backend='local', ignore=None,
mmap_mode=None, compress=False, verbose=1,
timestamp=None, hash_func=None):
Logger.__init__(self)
self.mmap_mode = mmap_mode
self.compress = compress
Expand Down Expand Up @@ -628,9 +620,9 @@ def __getstate__(self):

def _get_argument_hash(self, *args, **kwargs):
return self.hash_func(
filter_args(
self.func, self.ignore, args, kwargs), coerce_mmap=(
self.mmap_mode is not None))
filter_args(self.func, self.ignore, args, kwargs),
coerce_mmap=self.mmap_mode is not None
)

def _get_output_identifiers(self, *args, **kwargs):
"""Return the func identifier and input parameter hash of a result."""
Expand Down Expand Up @@ -908,8 +900,8 @@ class Memory(Logger):
hash_func: callable, optional
Parameters: (obj: object, hash_name: string, coerce_mmap: Boolean)
Return the hash from an object. Default is None.
If hash_func is None hashing.hash is used
Returns the hash from an object.
If hash_func is None (default), hashing.hash is used.
"""
# ------------------------------------------------------------------------
# Public interface
Expand Down Expand Up @@ -1019,7 +1011,8 @@ def cache(self, func=None, ignore=None, verbose=None, mmap_mode=False):
compress=self.compress,
verbose=verbose,
timestamp=self.timestamp,
hash_func=self.hash_func)
hash_func=self.hash_func
)

def clear(self, warn=True):
""" Erase the complete cache directory.
Expand Down

0 comments on commit a7037e3

Please sign in to comment.