141 [ \t]* = [ \t]* (?P<VariableSignal> (?:pyqtSignal)? ) |
141 [ \t]* = [ \t]* (?P<VariableSignal> (?:pyqtSignal)? ) |
142 ) |
142 ) |
143 |
143 |
144 | (?P<Import> |
144 | (?P<Import> |
145 ^ (?: import | from [ \t]+ \. [ \t]+ import ) [ \t]+ |
145 ^ (?: import | from [ \t]+ \. [ \t]+ import ) [ \t]+ |
146 (?P<ImportList> [^#;\n]+ ) |
146 (?P<ImportList> (?: [^#;\\\n]+ (?: \\\n )* )* ) |
147 ) |
147 ) |
148 |
148 |
149 | (?P<ImportFrom> |
149 | (?P<ImportFrom> |
150 ^ from [ \t]+ |
150 ^ from [ \t]+ |
151 (?P<ImportFromPath> |
151 (?P<ImportFromPath> |
152 \w+ |
152 \.* \w+ |
153 (?: |
153 (?: |
154 [ \t]* \. [ \t]* \w+ |
154 [ \t]* \. [ \t]* \w+ |
155 )* |
155 )* |
156 ) |
156 ) |
157 [ \t]+ |
157 [ \t]+ |
158 import [ \t]+ |
158 import [ \t]+ |
159 (?P<ImportFromList> [^#;\n]+ ) |
159 (?P<ImportFromList> (?: [^#;\\\n]+ (?: \\\n )* )* ) |
160 ) |
160 ) |
161 |
161 |
162 | (?P<ConditionalDefine> |
162 | (?P<ConditionalDefine> |
163 ^ |
163 ^ |
164 (?P<ConditionalDefineIndent> [ \t]* ) |
164 (?P<ConditionalDefineIndent> [ \t]* ) |
704 classstack[index][0].addGlobal(variable_name, attr) |
704 classstack[index][0].addGlobal(variable_name, attr) |
705 break |
705 break |
706 |
706 |
707 elif m.start("Import") >= 0: |
707 elif m.start("Import") >= 0: |
708 # import module |
708 # import module |
709 for name in m.group("ImportList").split(','): |
709 names = [n.strip() for n in "".join( |
710 name = name.strip() |
710 m.group("ImportList").splitlines()).replace("\\", "").split(',')] |
|
711 for name in names: |
711 if not name in self.imports: |
712 if not name in self.imports: |
712 self.imports.append(name) |
713 self.imports.append(name) |
713 |
714 |
714 elif m.start("ImportFrom") >= 0: |
715 elif m.start("ImportFrom") >= 0: |
715 # from module import stuff |
716 # from module import stuff |
716 mod = m.group("ImportFromPath") |
717 mod = m.group("ImportFromPath") |
717 names = m.group("ImportFromList").split(',') |
718 names = [n.strip() for n in "".join( |
|
719 m.group("ImportFromList").splitlines()).replace("\\", "").split(',')] |
718 if mod not in self.from_imports: |
720 if mod not in self.from_imports: |
719 self.from_imports[mod] = [] |
721 self.from_imports[mod] = [] |
720 for n in names: |
722 self.from_imports[mod].extend(names) |
721 n = n.strip() |
|
722 self.from_imports[mod].append(n) |
|
723 |
723 |
724 elif m.start("ConditionalDefine") >= 0: |
724 elif m.start("ConditionalDefine") >= 0: |
725 # a conditional function/method definition |
725 # a conditional function/method definition |
726 thisindent = _indent(m.group("ConditionalDefineIndent")) |
726 thisindent = _indent(m.group("ConditionalDefineIndent")) |
727 while conditionalsstack and \ |
727 while conditionalsstack and \ |