Skip to content

Commit

Permalink
Update utils.py
Browse files Browse the repository at this point in the history
  • Loading branch information
StrikerRUS authored Nov 18, 2020
1 parent 33b5bb7 commit a94f4a8
Showing 1 changed file with 2 additions and 18 deletions.
20 changes: 2 additions & 18 deletions tests/python_package_test/utils.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,7 @@
# coding: utf-8
import sklearn.datasets
from functools import lru_cache

try:
from functools import lru_cache
except ImportError:
import warnings
warnings.warn("Could not import functools.lru_cache", RuntimeWarning)

def lru_cache(maxsize=None):
cache = {}

def _lru_wrapper(user_function):
def wrapper(*args, **kwargs):
arg_key = (args, tuple(kwargs.items()))
if arg_key not in cache:
cache[arg_key] = user_function(*args, **kwargs)
return cache[arg_key]
return wrapper
return _lru_wrapper
import sklearn.datasets


@lru_cache(maxsize=None)
Expand Down

0 comments on commit a94f4a8

Please sign in to comment.