Utilities/ModuleParser.py

changeset 3621
15f23ed3f216
parent 3591
2f2a4a76dd22
child 3656
441956d8fce5
equal deleted inserted replaced
3620:2c8d96d47cda 3621:15f23ed3f216
463 Public method to add information about global variables. 463 Public method to add information about global variables.
464 464
465 @param name name of the global to add (string) 465 @param name name of the global to add (string)
466 @param attr Attribute object to be added 466 @param attr Attribute object to be added
467 """ 467 """
468 if not name in self.globals: 468 if name not in self.globals:
469 self.globals[name] = attr 469 self.globals[name] = attr
470 else: 470 else:
471 self.globals[name].addAssignment(attr.lineno) 471 self.globals[name].addAssignment(attr.lineno)
472 472
473 def addDescription(self, description): 473 def addDescription(self, description):
758 # import module 758 # import module
759 names = [n.strip() for n in 759 names = [n.strip() for n in
760 "".join(m.group("ImportList").splitlines()) 760 "".join(m.group("ImportList").splitlines())
761 .replace("\\", "").split(',')] 761 .replace("\\", "").split(',')]
762 for name in names: 762 for name in names:
763 if not name in self.imports: 763 if name not in self.imports:
764 self.imports.append(name) 764 self.imports.append(name)
765 765
766 elif m.start("ImportFrom") >= 0: 766 elif m.start("ImportFrom") >= 0:
767 # from module import stuff 767 # from module import stuff
768 mod = m.group("ImportFromPath") 768 mod = m.group("ImportFromPath")
1271 Public method to add information about attributes. 1271 Public method to add information about attributes.
1272 1272
1273 @param name name of the attribute to add (string) 1273 @param name name of the attribute to add (string)
1274 @param attr Attribute object to be added 1274 @param attr Attribute object to be added
1275 """ 1275 """
1276 if not name in self.attributes: 1276 if name not in self.attributes:
1277 self.attributes[name] = attr 1277 self.attributes[name] = attr
1278 else: 1278 else:
1279 self.attributes[name].addAssignment(attr.lineno) 1279 self.attributes[name].addAssignment(attr.lineno)
1280 1280
1281 def getAttribute(self, name): 1281 def getAttribute(self, name):
1295 Public method to add information about global (class) variables. 1295 Public method to add information about global (class) variables.
1296 1296
1297 @param name name of the global to add (string) 1297 @param name name of the global to add (string)
1298 @param attr Attribute object to be added 1298 @param attr Attribute object to be added
1299 """ 1299 """
1300 if not name in self.globals: 1300 if name not in self.globals:
1301 self.globals[name] = attr 1301 self.globals[name] = attr
1302 else: 1302 else:
1303 self.globals[name].addAssignment(attr.lineno) 1303 self.globals[name].addAssignment(attr.lineno)
1304 1304
1305 def addDescription(self, description): 1305 def addDescription(self, description):

eric ide

mercurial