eric6/Utilities/ClassBrowsers/__init__.py

changeset 8205
4a0f1f896341
parent 7923
91e843545d9a
equal deleted inserted replaced
8204:fd477cded1c1 8205:4a0f1f896341
119 if ext in __extensions["Ruby"]: 119 if ext in __extensions["Ruby"]:
120 for p in path: # only search in path 120 for p in path: # only search in path
121 pathname = os.path.join(p, name) 121 pathname = os.path.join(p, name)
122 if os.path.exists(pathname): 122 if os.path.exists(pathname):
123 return (open(pathname), pathname, (ext, 'r', RB_SOURCE)) 123 return (open(pathname), pathname, (ext, 'r', RB_SOURCE))
124 # __IGNORE_WARNING_Y115__
124 raise ImportError 125 raise ImportError
125 126
126 elif ext in __extensions["IDL"]: 127 elif ext in __extensions["IDL"]:
127 for p in path: # only search in path 128 for p in path: # only search in path
128 pathname = os.path.join(p, name) 129 pathname = os.path.join(p, name)
129 if os.path.exists(pathname): 130 if os.path.exists(pathname):
130 return (open(pathname), pathname, (ext, 'r', IDL_SOURCE)) 131 return (open(pathname), pathname, (ext, 'r', IDL_SOURCE))
132 # __IGNORE_WARNING_Y115__
131 raise ImportError 133 raise ImportError
132 134
133 elif ext in __extensions["ProtoBuf"]: 135 elif ext in __extensions["ProtoBuf"]:
134 for p in path: # only search in path 136 for p in path: # only search in path
135 pathname = os.path.join(p, name) 137 pathname = os.path.join(p, name)
136 if os.path.exists(pathname): 138 if os.path.exists(pathname):
137 return (open(pathname), pathname, (ext, 'r', PROTO_SOURCE)) 139 return (open(pathname), pathname, (ext, 'r', PROTO_SOURCE))
140 # __IGNORE_WARNING_Y115__
138 raise ImportError 141 raise ImportError
139 142
140 elif ext in __extensions["JavaScript"]: 143 elif ext in __extensions["JavaScript"]:
141 for p in path: # only search in path 144 for p in path: # only search in path
142 pathname = os.path.join(p, name) 145 pathname = os.path.join(p, name)
143 if os.path.exists(pathname): 146 if os.path.exists(pathname):
144 return (open(pathname), pathname, (ext, 'r', JS_SOURCE)) 147 return (open(pathname), pathname, (ext, 'r', JS_SOURCE))
148 # __IGNORE_WARNING_Y115__
145 raise ImportError 149 raise ImportError
146 150
147 elif ext == '.ptl': 151 elif ext == '.ptl':
148 for p in path: # only search in path 152 for p in path: # only search in path
149 pathname = os.path.join(p, name) 153 pathname = os.path.join(p, name)
150 if os.path.exists(pathname): 154 if os.path.exists(pathname):
151 return (open(pathname), pathname, (ext, 'r', PTL_SOURCE)) 155 return (open(pathname), pathname, (ext, 'r', PTL_SOURCE))
156 # __IGNORE_WARNING_Y115__
152 raise ImportError 157 raise ImportError
153 158
154 elif ( 159 elif (
155 name.lower().endswith( 160 name.lower().endswith(
156 tuple(Preferences.getPython("Python3Extensions"))) or 161 tuple(Preferences.getPython("Python3Extensions"))) or
158 ): 163 ):
159 for p in path: # search in path 164 for p in path: # search in path
160 pathname = os.path.join(p, name) 165 pathname = os.path.join(p, name)
161 if os.path.exists(pathname): 166 if os.path.exists(pathname):
162 return (open(pathname), pathname, (ext, 'r', PY_SOURCE)) 167 return (open(pathname), pathname, (ext, 'r', PY_SOURCE))
168 # __IGNORE_WARNING_Y115__
163 raise ImportError 169 raise ImportError
164 170
165 # standard Python module file 171 # standard Python module file
166 if name.lower().endswith('.py'): 172 if name.lower().endswith('.py'):
167 name = name[:-3] 173 name = name[:-3]
170 if spec is None: 176 if spec is None:
171 raise ImportError 177 raise ImportError
172 if isinstance(spec.loader, importlib.machinery.SourceFileLoader): 178 if isinstance(spec.loader, importlib.machinery.SourceFileLoader):
173 ext = os.path.splitext(spec.origin)[-1] 179 ext = os.path.splitext(spec.origin)[-1]
174 return (open(spec.origin), spec.origin, (ext, 'r', PY_SOURCE)) 180 return (open(spec.origin), spec.origin, (ext, 'r', PY_SOURCE))
181 # __IGNORE_WARNING_Y115__
175 182
176 raise ImportError 183 raise ImportError

eric ide

mercurial