Utilities/ClassBrowsers/pyclbr.py

changeset 45
9a18f4dbb493
parent 13
1af94a91f439
child 97
c4086afea02b
equal deleted inserted replaced
44:fe5cd20cb0eb 45:9a18f4dbb493
234 dict['__path__'] = [file] 234 dict['__path__'] = [file]
235 _modules[module] = dict 235 _modules[module] = dict
236 path = [file] + path 236 path = [file] + path
237 f, file, (suff, mode, type) = \ 237 f, file, (suff, mode, type) = \
238 ClassBrowsers.find_module('__init__', [file]) 238 ClassBrowsers.find_module('__init__', [file])
239 if f:
240 f.close()
239 if type not in SUPPORTED_TYPES: 241 if type not in SUPPORTED_TYPES:
240 # not Python source, can't do anything with this module 242 # not Python source, can't do anything with this module
241 f.close()
242 _modules[module] = dict 243 _modules[module] = dict
243 return dict 244 return dict
244 245
245 _modules[module] = dict 246 _modules[module] = dict
246 classstack = [] # stack of (class, indent) pairs 247 classstack = [] # stack of (class, indent) pairs
247 conditionalsstack = [] # stack of indents of conditional defines 248 conditionalsstack = [] # stack of indents of conditional defines
248 deltastack = [] 249 deltastack = []
249 deltaindent = 0 250 deltaindent = 0
250 deltaindentcalculated = 0 251 deltaindentcalculated = 0
251 src = f.read() 252 try:
252 f.close() 253 src = Utilities.readEncodedFile(file)[0]
254 except (UnicodeError, IOError):
255 # can't do anything with this module
256 _modules[module] = dict
257 return dict
253 258
254 lineno, last_lineno_pos = 1, 0 259 lineno, last_lineno_pos = 1, 0
255 i = 0 260 i = 0
256 while True: 261 while True:
257 m = _getnext(src, i) 262 m = _getnext(src, i)

eric ide

mercurial