src/eric7/Utilities/ClassBrowsers/pyclbr.py

branch
server
changeset 10596
ea35c92a3c7c
parent 10592
2bada76be1a6
child 10680
306373ccf8fd
equal deleted inserted replaced
10594:6156d9675f62 10596:ea35c92a3c7c
415 @rtype dict 415 @rtype dict
416 """ 416 """
417 fsInterface = ericApp().getObject("EricServer").getServiceInterface("FileSystem") 417 fsInterface = ericApp().getObject("EricServer").getServiceInterface("FileSystem")
418 418
419 if searchPath and FileSystemUtilities.isRemoteFileName(searchPath[0]): 419 if searchPath and FileSystemUtilities.isRemoteFileName(searchPath[0]):
420 type = ClassBrowsers.determineSourceType(module, isTypeFile) 420 sourceType = ClassBrowsers.determineSourceType(module, isTypeFile)
421 file = fsInterface.join(searchPath[0], module) 421 file = fsInterface.join(searchPath[0], module)
422 else: 422 else:
423 # search the path for the module 423 # search the path for the module
424 searchPath = [] if searchPath is None else searchPath[:] 424 searchPath = [] if searchPath is None else searchPath[:]
425 fullpath = searchPath[:] + sys.path[:] 425 fullpath = searchPath[:] + sys.path[:]
426 f, file, (suff, mode, type) = ClassBrowsers.find_module( 426 f, file, (suff, mode, sourceType) = ClassBrowsers.find_module(
427 module, fullpath, isTypeFile 427 module, fullpath, isTypeFile
428 ) 428 )
429 if f: 429 if f:
430 f.close() 430 f.close()
431 431
432 if type not in SUPPORTED_TYPES: 432 if sourceType not in SUPPORTED_TYPES:
433 # not Python source, can't do anything with this module 433 # not Python source, can't do anything with this module
434 return {} 434 return {}
435 435
436 try: 436 try:
437 if FileSystemUtilities.isRemoteFileName(file): 437 src = (
438 src = fsInterface.readEncodedFile(file)[0] 438 fsInterface.readEncodedFile(file)[0]
439 else: 439 if FileSystemUtilities.isRemoteFileName(file)
440 src = Utilities.readEncodedFile(file)[0] 440 else Utilities.readEncodedFile(file)[0]
441 )
441 except (OSError, UnicodeError): 442 except (OSError, UnicodeError):
442 # can't do anything with this module 443 # can't do anything with this module
443 return {} 444 return {}
444 445
445 return scan(src, file, module) 446 return scan(src, file, module)

eric ide

mercurial