Skip to content

Commit 43669cc

Browse files
committed
fix: use lru_cache in py3
1 parent 4516a8d commit 43669cc

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

nipype/__init__.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import os
88
import functools
9+
import sys
910
from distutils.version import LooseVersion
1011

1112
from .info import (LONG_DESCRIPTION as __doc__, URL as __url__, STATUS as
@@ -59,7 +60,16 @@ def get_info():
5960
Rename, Function, Select, Merge)
6061

6162

62-
@functools.lru_cache()
63+
def sys_based_cache(condition):
64+
def decorator(func):
65+
if not condition:
66+
return func
67+
else:
68+
return functools.lru_cache(func)
69+
return decorator
70+
71+
72+
@sys_based_cache(sys.version >= 3)
6373
def check_version(raise_exception=False):
6474
"""Check for the latest version of the library
6575

0 commit comments

Comments
 (0)