##// END OF EJS Templates
use importlib.machinery when available...
MinRK -
Show More
@@ -17,12 +17,19 b' from __future__ import print_function'
17 17
18 18 # Stdlib imports
19 19 import glob
20 import imp
21 20 import inspect
22 21 import os
23 22 import re
24 23 import sys
25 24
25 try:
26 # Python 3
27 from importlib.machinery import all_suffixes
28 _suffixes = all_suffixes()
29 except ImportError:
30 from imp import get_suffixes
31 _suffixes = [ s[0] for s in get_suffixes() ]
32
26 33 # Third-party imports
27 34 from time import time
28 35 from zipimport import zipimporter
@@ -51,7 +58,7 b' TIMEOUT_GIVEUP = 20'
51 58 import_re = re.compile(r'(?P<name>[a-zA-Z_][a-zA-Z0-9_]*?)'
52 59 r'(?P<package>[/\\]__init__)?'
53 60 r'(?P<suffix>%s)$' %
54 r'|'.join(re.escape(s[0]) for s in imp.get_suffixes()))
61 r'|'.join(re.escape(s) for s in _suffixes))
55 62
56 63 # RE for the ipython %run command (python + ipython scripts)
57 64 magic_run_re = re.compile(r'.*(\.ipy|\.ipynb|\.py[w]?)$')
General Comments 0
You need to be logged in to leave comments. Login now