eric6/Utilities/ClassBrowsers/__init__.py

changeset 7259
7c017076c12e
parent 7229
53054eb5b15a
child 7360
9190402e4505
equal deleted inserted replaced
7258:aff39db4dacc 7259:7c017076c12e
78 rbclbr._modules.clear() 78 rbclbr._modules.clear()
79 elif ext in __extensions["JavaScript"]: 79 elif ext in __extensions["JavaScript"]:
80 from . import jsclbr 80 from . import jsclbr
81 dictionary = jsclbr.readmodule_ex(module, path) 81 dictionary = jsclbr.readmodule_ex(module, path)
82 jsclbr._modules.clear() 82 jsclbr._modules.clear()
83 elif ext in Preferences.getPython("PythonExtensions") or \ 83 elif (
84 ext in Preferences.getPython("Python3Extensions") or \ 84 ext in Preferences.getPython("PythonExtensions") or
85 isPyFile: 85 ext in Preferences.getPython("Python3Extensions") or
86 isPyFile
87 ):
86 from . import pyclbr 88 from . import pyclbr
87 dictionary = pyclbr.readmodule_ex(module, path, isPyFile=isPyFile) 89 dictionary = pyclbr.readmodule_ex(module, path, isPyFile=isPyFile)
88 pyclbr._modules.clear() 90 pyclbr._modules.clear()
89 else: 91 else:
90 # try Python if it is without extension 92 # try Python if it is without extension
156 name = name[:-3] 158 name = name[:-3]
157 159
158 try: 160 try:
159 return imp.find_module(name, path) 161 return imp.find_module(name, path)
160 except ImportError: 162 except ImportError:
161 if name.lower().endswith( 163 if (
164 name.lower().endswith(
162 tuple(Preferences.getPython("PythonExtensions") + 165 tuple(Preferences.getPython("PythonExtensions") +
163 Preferences.getPython("Python3Extensions"))) or \ 166 Preferences.getPython("Python3Extensions"))) or
164 isPyFile: 167 isPyFile
168 ):
165 for p in path: # search in path 169 for p in path: # search in path
166 pathname = os.path.join(p, name) 170 pathname = os.path.join(p, name)
167 if os.path.exists(pathname): 171 if os.path.exists(pathname):
168 return (open(pathname), pathname, (ext, 'r', PY_SOURCE)) 172 return (open(pathname), pathname, (ext, 'r', PY_SOURCE))
169 raise ImportError 173 raise ImportError

eric ide

mercurial