File tree Expand file tree Collapse file tree 1 file changed +4
-25
lines changed Expand file tree Collapse file tree 1 file changed +4
-25
lines changed Original file line number Diff line number Diff line change 1- import sys
2-
3- PY3 = sys .version_info > (3 , 0 )
4- PY34 = sys .version_info >= (3 , 4 )
1+ import importlib .util
52
63
74def _check_module_exists (name : str ) -> bool :
@@ -11,28 +8,10 @@ def _check_module_exists(name: str) -> bool:
118 our tests, e.g., setting multiprocessing start method when imported
129 (see librosa/#747, torchvision/#544).
1310 """
14- if not PY3 : # Python 2
15- import imp
16- try :
17- imp .find_module (name )
18- return True
19- except ImportError :
20- return False
21- elif not PY34 : # Python [3, 3.4)
22- import importlib
23- loader = importlib .find_loader (name )
24- return loader is not None
25- else : # Python >= 3.4
26- import importlib
27- import importlib .util
28- spec = importlib .util .find_spec (name )
29- return spec is not None
11+ spec = importlib .util .find_spec (name )
12+ return spec is not None
3013
3114IMPORT_NUMPY = _check_module_exists ('numpy' )
3215IMPORT_KALDI_IO = _check_module_exists ('kaldi_io' )
3316IMPORT_SCIPY = _check_module_exists ('scipy' )
34-
35- # On Py2, importing librosa 0.6.1 triggers a TypeError (if using newest joblib)
36- # see librosa/librosa#729.
37- # TODO: allow Py2 when librosa 0.6.2 releases
38- IMPORT_LIBROSA = _check_module_exists ('librosa' ) and PY3
17+ IMPORT_LIBROSA = _check_module_exists ('librosa' )
You can’t perform that action at this time.
0 commit comments