135 [ \t]* = [ \t]* (?P<VariableSignal> (?:pyqtSignal)? ) |
135 [ \t]* = [ \t]* (?P<VariableSignal> (?:pyqtSignal)? ) |
136 ) |
136 ) |
137 |
137 |
138 | (?P<Import> |
138 | (?P<Import> |
139 ^ (?: import | from [ \t]+ \. [ \t]+ import ) [ \t]+ |
139 ^ (?: import | from [ \t]+ \. [ \t]+ import ) [ \t]+ |
140 (?P<ImportList> [^#;\n]+ ) |
140 (?P<ImportList> (?: [^#;\\\n]+ (?: \\\n )* )* ) |
141 ) |
141 ) |
142 |
142 |
143 | (?P<ImportFrom> |
143 | (?P<ImportFrom> |
144 ^ from [ \t]+ |
144 ^ from [ \t]+ |
145 (?P<ImportFromPath> |
145 (?P<ImportFromPath> |
146 \w+ |
146 \.* \w+ |
147 (?: |
147 (?: |
148 [ \t]* \. [ \t]* \w+ |
148 [ \t]* \. [ \t]* \w+ |
149 )* |
149 )* |
150 ) |
150 ) |
151 [ \t]+ |
151 [ \t]+ |
152 import [ \t]+ |
152 import [ \t]+ |
153 (?P<ImportFromList> [^#;\n]+ ) |
153 (?P<ImportFromList> (?: [^#;\\\n]+ (?: \\\n )* )* ) |
154 ) |
154 ) |
155 |
155 |
156 | (?P<ConditionalDefine> |
156 | (?P<ConditionalDefine> |
157 ^ |
157 ^ |
158 (?P<ConditionalDefineIndent> [ \t]* ) |
158 (?P<ConditionalDefineIndent> [ \t]* ) |
675 classstack[index][0].addGlobal(variable_name, attr) |
675 classstack[index][0].addGlobal(variable_name, attr) |
676 break |
676 break |
677 |
677 |
678 elif m.start("Import") >= 0: |
678 elif m.start("Import") >= 0: |
679 # import module |
679 # import module |
680 for name in m.group("ImportList").split(','): |
680 names = [n.strip() for n in "".join( |
681 name = name.strip() |
681 m.group("ImportList").splitlines()).replace("\\", "").split(',')] |
|
682 for name in names: |
682 if not name in self.imports: |
683 if not name in self.imports: |
683 self.imports.append(name) |
684 self.imports.append(name) |
684 |
685 |
685 elif m.start("ImportFrom") >= 0: |
686 elif m.start("ImportFrom") >= 0: |
686 # from module import stuff |
687 # from module import stuff |
687 mod = m.group("ImportFromPath") |
688 mod = m.group("ImportFromPath") |
688 names = m.group("ImportFromList").split(',') |
689 names = [n.strip() for n in "".join( |
|
690 m.group("ImportFromList").splitlines()).replace("\\", "").split(',')] |
689 if mod not in self.from_imports: |
691 if mod not in self.from_imports: |
690 self.from_imports[mod] = [] |
692 self.from_imports[mod] = [] |
691 for n in names: |
693 self.from_imports[mod].extend(names) |
692 n = n.strip() |
|
693 self.from_imports[mod].append(n) |
|
694 |
694 |
695 elif m.start("ConditionalDefine") >= 0: |
695 elif m.start("ConditionalDefine") >= 0: |
696 # a conditional function/method definition |
696 # a conditional function/method definition |
697 thisindent = _indent(m.group("ConditionalDefineIndent")) |
697 thisindent = _indent(m.group("ConditionalDefineIndent")) |
698 while conditionalsstack and \ |
698 while conditionalsstack and \ |