Utilities/ModuleParser.py

changeset 3034
7ce719013078
parent 3030
4a0a82ddd9d2
child 3039
8dd0165d805d
equal deleted inserted replaced
3033:58fe260e7469 3034:7ce719013078
636 if cur_obj: 636 if cur_obj:
637 cur_obj.addDescription(contents) 637 cur_obj.addDescription(contents)
638 638
639 elif m.start("String") >= 0: 639 elif m.start("String") >= 0:
640 if modulelevel and \ 640 if modulelevel and \
641 (src[start - len('\r\n'):start] == '\r\n' or \ 641 (src[start - len('\r\n'):start] == '\r\n' or
642 src[start - len('\n'):start] == '\n' or \ 642 src[start - len('\n'):start] == '\n' or
643 src[start - len('\r'):start] == '\r'): 643 src[start - len('\r'):start] == '\r'):
644 contents = m.group("StringContents3") 644 contents = m.group("StringContents3")
645 if contents is not None: 645 if contents is not None:
646 contents = _hashsub(r"\1", contents) 646 contents = _hashsub(r"\1", contents)
647 else: 647 else:
752 variable_name, attr) 752 variable_name, attr)
753 break 753 break
754 754
755 elif m.start("Import") >= 0: 755 elif m.start("Import") >= 0:
756 # import module 756 # import module
757 names = [n.strip() for n in 757 names = [n.strip() for n in
758 "".join(m.group("ImportList").splitlines()) 758 "".join(m.group("ImportList").splitlines())
759 .replace("\\", "").split(',')] 759 .replace("\\", "").split(',')]
760 for name in names: 760 for name in names:
761 if not name in self.imports: 761 if not name in self.imports:
762 self.imports.append(name) 762 self.imports.append(name)
763 763
764 elif m.start("ImportFrom") >= 0: 764 elif m.start("ImportFrom") >= 0:
765 # from module import stuff 765 # from module import stuff
766 mod = m.group("ImportFromPath") 766 mod = m.group("ImportFromPath")
767 names = [n.strip() for n in 767 names = [n.strip() for n in
768 "".join(m.group("ImportFromList").splitlines()) 768 "".join(m.group("ImportFromList").splitlines())
769 .replace("\\", "").split(',')] 769 .replace("\\", "").split(',')]
770 if mod not in self.from_imports: 770 if mod not in self.from_imports:
771 self.from_imports[mod] = [] 771 self.from_imports[mod] = []
772 self.from_imports[mod].extend(names) 772 self.from_imports[mod].extend(names)

eric ide

mercurial