293 @rtype dict |
293 @rtype dict |
294 """ |
294 """ |
295 fsInterface = ericApp().getObject("EricServer").getServiceInterface("FileSystem") |
295 fsInterface = ericApp().getObject("EricServer").getServiceInterface("FileSystem") |
296 |
296 |
297 if searchPath and FileSystemUtilities.isRemoteFileName(searchPath[0]): |
297 if searchPath and FileSystemUtilities.isRemoteFileName(searchPath[0]): |
298 type = ClassBrowsers.determineSourceType(module) |
298 sourceType = ClassBrowsers.determineSourceType(module) |
299 file = fsInterface.join(searchPath[0], module) |
299 file = fsInterface.join(searchPath[0], module) |
300 else: |
300 else: |
301 # search the path for the module |
301 # search the path for the module |
302 fullpath = [] if searchPath is None else searchPath[:] |
302 fullpath = [] if searchPath is None else searchPath[:] |
303 f, file, (suff, mode, type) = ClassBrowsers.find_module(module, fullpath) |
303 f, file, (suff, mode, sourceType) = ClassBrowsers.find_module(module, fullpath) |
304 if f: |
304 if f: |
305 f.close() |
305 f.close() |
306 |
306 |
307 if type not in SUPPORTED_TYPES: |
307 if sourceType not in SUPPORTED_TYPES: |
308 # not Ruby source, can't do anything with this module |
308 # not Ruby source, can't do anything with this module |
309 return {} |
309 return {} |
310 |
310 |
311 try: |
311 try: |
312 if FileSystemUtilities.isRemoteFileName(file): |
312 src = ( |
313 src = fsInterface.readEncodedFile(file)[0] |
313 fsInterface.readEncodedFile(file)[0] |
314 else: |
314 if FileSystemUtilities.isRemoteFileName(file) |
315 src = Utilities.readEncodedFile(file)[0] |
315 else Utilities.readEncodedFile(file)[0] |
|
316 ) |
316 except (OSError, UnicodeError): |
317 except (OSError, UnicodeError): |
317 # can't do anything with this module |
318 # can't do anything with this module |
318 return {} |
319 return {} |
319 |
320 |
320 return scan(src, file, module) |
321 return scan(src, file, module) |