143 )? |
144 )? |
144 ^ |
145 ^ |
145 (?P<MethodIndent> [ \t]* ) |
146 (?P<MethodIndent> [ \t]* ) |
146 (?: async [ \t]+ )? (?: cdef | cpdef | def) [ \t]+ |
147 (?: async [ \t]+ )? (?: cdef | cpdef | def) [ \t]+ |
147 (?P<MethodName> \w+ ) |
148 (?P<MethodName> \w+ ) |
148 (?: [ \t]* \[ (?: plain | html ) \] )? |
149 (?: [ \t]* \[ [^\]]+ \] )? |
149 [ \t]* \( |
150 [ \t]* \( |
150 (?P<MethodSignature> (?: [^)] | \)[ \t]*,? )*? ) |
151 (?P<MethodSignature> (?: [^)] | \)[ \t]*,? )*? ) |
151 \) [ \t]* |
152 \) [ \t]* |
152 (?P<MethodReturnAnnotation> (?: -> [ \t]* [^:]+ )? ) |
153 (?P<MethodReturnAnnotation> (?: -> [ \t]* [^:]+ )? ) |
153 [ \t]* : |
154 [ \t]* : |
157 ^ |
158 ^ |
158 (?P<ClassIndent> [ \t]* ) |
159 (?P<ClassIndent> [ \t]* ) |
159 (?: cdef [ \t]+ )? |
160 (?: cdef [ \t]+ )? |
160 class [ \t]+ |
161 class [ \t]+ |
161 (?P<ClassName> \w+ ) |
162 (?P<ClassName> \w+ ) |
|
163 (?: [ \t]* \[ [^\]]+ \] )? |
162 [ \t]* |
164 [ \t]* |
163 (?P<ClassSupers> \( [^)]* \) )? |
165 (?P<ClassSupers> \( [^)]* \) )? |
164 [ \t]* : |
166 [ \t]* : |
165 ) |
167 ) |
166 |
168 |
167 | (?P<Attribute> |
169 | (?P<Attribute> |
168 ^ |
170 ^ |
169 (?P<AttributeIndent> [ \t]* ) |
171 (?P<AttributeIndent> [ \t]* ) |
170 self [ \t]* \. [ \t]* |
172 self [ \t]* \. [ \t]* |
171 (?P<AttributeName> \w+ ) |
173 (?P<AttributeName> \w+ ) |
|
174 (?: [ \t]* : [^=\n]+ )? |
172 [ \t]* = |
175 [ \t]* = |
173 ) |
176 ) |
174 |
177 |
175 | (?P<Variable> |
178 | (?P<Variable> |
176 ^ |
179 ^ |
177 (?P<VariableIndent> [ \t]* ) |
180 (?P<VariableIndent> [ \t]* ) |
178 (?P<VariableName> \w+ ) |
181 (?P<VariableName> \w+ ) |
179 [ \t]* = [ \t]* (?P<VariableSignal> (?:pyqtSignal)? ) |
182 [ \t]* = [ \t]* (?P<VariableSignal> (?:pyqtSignal)? ) |
|
183 ) |
|
184 |
|
185 | (?P<TypedVariable> |
|
186 ^ |
|
187 (?P<TypedVariableIndent> [ \t]* ) |
|
188 (?P<TypedVariableName> \w+ ) |
|
189 [ \t]* : |
180 ) |
190 ) |
181 |
191 |
182 | (?P<Main> |
192 | (?P<Main> |
183 ^ |
193 ^ |
184 if \s+ __name__ \s* == \s* [^:]+ : $ |
194 if \s+ __name__ \s* == \s* [^:]+ : $ |
837 ) |
847 ) |
838 self.__py_setVisibility(attr) |
848 self.__py_setVisibility(attr) |
839 classstack[index][0].addGlobal(variable_name, attr) |
849 classstack[index][0].addGlobal(variable_name, attr) |
840 break |
850 break |
841 |
851 |
|
852 elif m.start("TypedVariable") >= 0: |
|
853 thisindent = _indent(m.group("TypedVariableIndent")) |
|
854 variable_name = m.group("TypedVariableName") |
|
855 if not keyword.iskeyword(variable_name): |
|
856 # only if the determined name is not a keyword (e.g. else, except) |
|
857 lineno += src.count("\n", last_lineno_pos, start) |
|
858 last_lineno_pos = start |
|
859 if thisindent == 0: |
|
860 # global variable |
|
861 attr = Attribute(self.name, variable_name, self.file, lineno) |
|
862 self.__py_setVisibility(attr) |
|
863 self.addGlobal(variable_name, attr) |
|
864 else: |
|
865 index = -1 |
|
866 while index >= -len(classstack): |
|
867 if classstack[index][1] >= thisindent: |
|
868 index -= 1 |
|
869 else: |
|
870 if classstack[index][0] is not None and isinstance( |
|
871 classstack[index][0], Class |
|
872 ): |
|
873 attr = Attribute( |
|
874 self.name, variable_name, self.file, lineno |
|
875 ) |
|
876 self.__py_setVisibility(attr) |
|
877 classstack[index][0].addGlobal(variable_name, attr) |
|
878 break |
|
879 |
842 elif m.start("Import") >= 0: |
880 elif m.start("Import") >= 0: |
843 # - import module |
881 # - import module |
844 names = [ |
882 names = [ |
845 n.strip() |
883 n.strip() |
846 for n in "".join(m.group("ImportList").splitlines()) |
884 for n in "".join(m.group("ImportList").splitlines()) |