@@ -356,34 +356,36 @@ def numba_const_convert(data, dtype=None, **kwargs):
356356
357357def numba_funcify (obj , node = None , storage_map = None , ** kwargs ) -> Callable :
358358 """Convert `obj` to a Numba-JITable object."""
359- return _numba_funcify (obj , node = node , storage_map = storage_map , ** kwargs )
359+ return cast (
360+ Callable , _numba_funcify (obj , node = node , storage_map = storage_map , ** kwargs )
361+ )
360362
361363
362364numba_cache_index = pathlib .PurePath (config .compiledir , "numba_cache_index" )
363365numba_db = shelve .open (numba_cache_index .as_posix ())
364366
365367
366- def make_node_key (node : "Apply" ) -> Optional [ str ] :
368+ def make_node_key (node ) :
367369 """Create a cache key for `node`.
368370 TODO: Currently this works only with Apply Node
369371 """
370372 if not isinstance (node , Apply ):
371373 return None
372374 key = (node .op ,)
373- key + = tuple (inp .type for inp in node .inputs )
375+ key = tuple (inp .type for inp in node .inputs )
374376 key += tuple (inp .type for inp in node .outputs )
375377
376- key = hashlib .sha256 (pickle .dumps (key )).hexdigest ()
378+ hash_key = hashlib .sha256 (pickle .dumps (key )).hexdigest ()
377379
378- return key
380+ return hash_key
379381
380382
381- def check_cache (node_key : str ):
383+ def check_cache (node_key ):
382384 """Check disk-backed cache."""
383385 return numba_db .get (node_key )
384386
385387
386- def add_to_cache (node_key : str , numba_py_fn ) -> Callable :
388+ def add_to_cache (node_key , numba_py_fn ):
387389 """Add the numba generated function to the cache."""
388390 module_file_base = (
389391 pathlib .PurePath (config .compiledir , node_key ).with_suffix (".py" ).as_posix ()
@@ -403,7 +405,7 @@ def add_to_cache(node_key: str, numba_py_fn) -> Callable:
403405 return numba_py_fn
404406
405407
406- def persist_py_code (func ) -> Callable :
408+ def persist_py_code (func ):
407409 """Persist a Numba JIT-able Python function.
408410 Parameters
409411 ==========
@@ -418,7 +420,6 @@ def _func(obj, node, **kwargs):
418420 numba_py_fn = None
419421 if node_key :
420422 numba_py_fn = check_cache (node_key )
421-
422423 if node_key is None or numba_py_fn is None :
423424 # We could only ever return the function source in our dispatch
424425 # implementations. That way, we can compile directly to the on-disk
0 commit comments