Utilities/ModuleParser.py

changeset 2965
d133c7edd88a
parent 2922
16905f0f48be
child 2997
7f0ef975da9e
equal deleted inserted replaced
2964:84b65fb9e780 2965:d133c7edd88a
373 """ 373 """
374 self.visibility = 2 374 self.visibility = 2
375 375
376 376
377 class Module(object): 377 class Module(object):
378 ''' 378 """
379 Class to represent a Python module. 379 Class to represent a Python module.
380 ''' 380 """
381 def __init__(self, name, file=None, type=None): 381 def __init__(self, name, file=None, type=None):
382 """ 382 """
383 Constructor 383 Constructor
384 384
385 @param name name of this module (string) 385 @param name name of this module (string)
1177 type = "" 1177 type = ""
1178 return type 1178 return type
1179 1179
1180 1180
1181 class Class(VisibilityBase): 1181 class Class(VisibilityBase):
1182 ''' 1182 """
1183 Class to represent a Python class. 1183 Class to represent a Python class.
1184 ''' 1184 """
1185 def __init__(self, module, name, super, file, lineno): 1185 def __init__(self, module, name, super, file, lineno):
1186 """ 1186 """
1187 Constructor 1187 Constructor
1188 1188
1189 @param module name of module containing this class (string) 1189 @param module name of module containing this class (string)
1280 """ 1280 """
1281 self.endlineno = endLineNo 1281 self.endlineno = endLineNo
1282 1282
1283 1283
1284 class RbModule(Class): 1284 class RbModule(Class):
1285 ''' 1285 """
1286 Class to represent a Ruby module. 1286 Class to represent a Ruby module.
1287 ''' 1287 """
1288 def __init__(self, module, name, file, lineno): 1288 def __init__(self, module, name, file, lineno):
1289 """ 1289 """
1290 Constructor 1290 Constructor
1291 1291
1292 @param module name of module containing this class (string) 1292 @param module name of module containing this class (string)
1306 """ 1306 """
1307 self.classes[name] = _class 1307 self.classes[name] = _class
1308 1308
1309 1309
1310 class Function(VisibilityBase): 1310 class Function(VisibilityBase):
1311 ''' 1311 """
1312 Class to represent a Python function or method. 1312 Class to represent a Python function or method.
1313 ''' 1313 """
1314 General = 0 1314 General = 0
1315 Static = 1 1315 Static = 1
1316 Class = 2 1316 Class = 2
1317 1317
1318 def __init__(self, module, name, file, lineno, signature='', pyqtSignature=None, 1318 def __init__(self, module, name, file, lineno, signature='', pyqtSignature=None,
1356 """ 1356 """
1357 self.endlineno = endLineNo 1357 self.endlineno = endLineNo
1358 1358
1359 1359
1360 class Attribute(VisibilityBase): 1360 class Attribute(VisibilityBase):
1361 ''' 1361 """
1362 Class to represent a Python function or method. 1362 Class to represent a Python function or method.
1363 ''' 1363 """
1364 def __init__(self, module, name, file, lineno, isSignal=False): 1364 def __init__(self, module, name, file, lineno, isSignal=False):
1365 """ 1365 """
1366 Constructor 1366 Constructor
1367 1367
1368 @param module name of module containing this function (string) 1368 @param module name of module containing this function (string)
1389 self.linenos.append(lineno) 1389 self.linenos.append(lineno)
1390 1390
1391 1391
1392 def readModule(module, path=[], inpackage=False, basename="", 1392 def readModule(module, path=[], inpackage=False, basename="",
1393 extensions=None, caching=True): 1393 extensions=None, caching=True):
1394 ''' 1394 """
1395 Function to read a module file and parse it. 1395 Function to read a module file and parse it.
1396 1396
1397 The module is searched in path and sys.path, read and parsed. 1397 The module is searched in path and sys.path, read and parsed.
1398 If the module was parsed before, the information is taken 1398 If the module was parsed before, the information is taken
1399 from a cache in order to speed up processing. 1399 from a cache in order to speed up processing.
1408 source file extensions (list of strings) 1408 source file extensions (list of strings)
1409 @param caching flag indicating that the parsed module should be 1409 @param caching flag indicating that the parsed module should be
1410 cached (boolean) 1410 cached (boolean)
1411 @return reference to a Module object containing the parsed 1411 @return reference to a Module object containing the parsed
1412 module information (Module) 1412 module information (Module)
1413 ''' 1413 """
1414 global _modules 1414 global _modules
1415 1415
1416 if extensions is None: 1416 if extensions is None:
1417 _extensions = ['.py', '.pyw', '.ptl', '.rb'] 1417 _extensions = ['.py', '.pyw', '.ptl', '.rb']
1418 else: 1418 else:

eric ide

mercurial