8044:874fdd14d3a2 | 8142:43248bafe9b2 |
---|---|
35 SUPPORTED_TYPES = [PY_SOURCE, PTL_SOURCE, RB_SOURCE] | 35 SUPPORTED_TYPES = [PY_SOURCE, PTL_SOURCE, RB_SOURCE] |
36 TYPE_MAPPING = { | 36 TYPE_MAPPING = { |
37 "Python": PY_SOURCE, | 37 "Python": PY_SOURCE, |
38 "Python3": PY_SOURCE, | 38 "Python3": PY_SOURCE, |
39 "MicroPython": PY_SOURCE, | 39 "MicroPython": PY_SOURCE, |
40 "Cython": PY_SOURCE, | |
40 "Ruby": RB_SOURCE, | 41 "Ruby": RB_SOURCE, |
41 } | 42 } |
42 | 43 |
43 | 44 |
44 def getTypeFromTypeName(name): | 45 def getTypeFromTypeName(name): |
132 (?P<MethodPyQtSignature> [^)]* ) | 133 (?P<MethodPyQtSignature> [^)]* ) |
133 \) \s* | 134 \) \s* |
134 )? | 135 )? |
135 ^ | 136 ^ |
136 (?P<MethodIndent> [ \t]* ) | 137 (?P<MethodIndent> [ \t]* ) |
137 (?: async [ \t]+ )? def [ \t]+ | 138 (?: async [ \t]+ )? (?: cdef | cpdef | def) [ \t]+ |
138 (?P<MethodName> \w+ ) | 139 (?P<MethodName> \w+ ) |
139 (?: [ \t]* \[ (?: plain | html ) \] )? | 140 (?: [ \t]* \[ (?: plain | html ) \] )? |
140 [ \t]* \( | 141 [ \t]* \( |
141 (?P<MethodSignature> (?: [^)] | \)[ \t]*,? )*? ) | 142 (?P<MethodSignature> (?: [^)] | \)[ \t]*,? )*? ) |
142 \) [ \t]* | 143 \) [ \t]* |
145 ) | 146 ) |
146 | 147 |
147 | (?P<Class> | 148 | (?P<Class> |
148 ^ | 149 ^ |
149 (?P<ClassIndent> [ \t]* ) | 150 (?P<ClassIndent> [ \t]* ) |
151 (?: cdef [ \t]+ )? | |
150 class [ \t]+ | 152 class [ \t]+ |
151 (?P<ClassName> \w+ ) | 153 (?P<ClassName> \w+ ) |
152 [ \t]* | 154 [ \t]* |
153 (?P<ClassSupers> \( [^)]* \) )? | 155 (?P<ClassSupers> \( [^)]* \) )? |
154 [ \t]* : | 156 [ \t]* : |
173 ^ | 175 ^ |
174 if \s+ __name__ \s* == \s* [^:]+ : $ | 176 if \s+ __name__ \s* == \s* [^:]+ : $ |
175 ) | 177 ) |
176 | 178 |
177 | (?P<Import> | 179 | (?P<Import> |
178 ^ [ \t]* (?: import | from [ \t]+ \. [ \t]+ import ) [ \t]+ | 180 ^ [ \t]* (?: c? import | from [ \t]+ \. [ \t]+ c? import ) [ \t]+ |
179 (?P<ImportList> (?: [^#;\\\n]* (?: \\\n )* )* ) | 181 (?P<ImportList> (?: [^#;\\\n]* (?: \\\n )* )* ) |
180 ) | 182 ) |
181 | 183 |
182 | (?P<ImportFrom> | 184 | (?P<ImportFrom> |
183 ^ [ \t]* from [ \t]+ | 185 ^ [ \t]* from [ \t]+ |
186 (?: | 188 (?: |
187 [ \t]* \. [ \t]* \w+ | 189 [ \t]* \. [ \t]* \w+ |
188 )* | 190 )* |
189 ) | 191 ) |
190 [ \t]+ | 192 [ \t]+ |
191 import [ \t]+ | 193 c? import [ \t]+ |
192 (?P<ImportFromList> | 194 (?P<ImportFromList> |
193 (?: \( \s* .*? \s* \) ) | 195 (?: \( \s* .*? \s* \) ) |
194 | | 196 | |
195 (?: [^#;\\\n]* (?: \\\n )* )* ) | 197 (?: [^#;\\\n]* (?: \\\n )* )* ) |
196 ) | 198 ) |
735 if m in _modules: | 737 if m in _modules: |
736 m = _modules[m] | 738 m = _modules[m] |
737 n = m.name | 739 n = m.name |
738 names.append(n) | 740 names.append(n) |
739 inherit = names | 741 inherit = names |
742 # modify indentation level for conditional defines | |
743 if conditionalsstack: | |
744 if thisindent > conditionalsstack[-1]: | |
745 if not deltaindentcalculated: | |
746 deltastack.append( | |
747 thisindent - conditionalsstack[-1] | |
748 ) | |
749 deltaindent = reduce( | |
750 lambda x, y: x + y, deltastack | |
751 ) | |
752 deltaindentcalculated = True | |
753 thisindent -= deltaindent | |
754 else: | |
755 while ( | |
756 conditionalsstack and | |
757 conditionalsstack[-1] >= thisindent | |
758 ): | |
759 del conditionalsstack[-1] | |
760 if deltastack: | |
761 del deltastack[-1] | |
762 deltaindentcalculated = False | |
740 # remember this class | 763 # remember this class |
741 cur_class = Class(self.name, class_name, inherit, | 764 cur_class = Class(self.name, class_name, inherit, |
742 self.file, lineno) | 765 self.file, lineno) |
743 self.__py_setVisibility(cur_class) | 766 self.__py_setVisibility(cur_class) |
744 endlineno = calculateEndline(lineno, srcLines, thisindent) | 767 endlineno = calculateEndline(lineno, srcLines, thisindent) |