Skip to content

Commit 2297c4d

Browse files
committed
mypyc does not understand method assignments?
1 parent 0eaa652 commit 2297c4d

File tree

1 file changed

+25
-7
lines changed

1 file changed

+25
-7
lines changed

mypy/stubgen.py

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,30 +78,36 @@
7878
Block,
7979
BytesExpr,
8080
CallExpr,
81+
CastExpr,
8182
ClassDef,
8283
ComparisonExpr,
8384
ComplexExpr,
85+
ConditionalExpr,
8486
Decorator,
8587
DictExpr,
88+
DictionaryComprehension,
8689
EllipsisExpr,
8790
Expression,
8891
ExpressionStmt,
8992
FloatExpr,
9093
FuncBase,
9194
FuncDef,
95+
GeneratorExpr,
9296
IfStmt,
9397
Import,
9498
ImportAll,
9599
ImportFrom,
96100
IndexExpr,
97101
IntExpr,
98102
LambdaExpr,
103+
ListComprehension,
99104
ListExpr,
100105
MemberExpr,
101106
MypyFile,
102107
NameExpr,
103108
OpExpr,
104109
OverloadedFuncDef,
110+
SetComprehension,
105111
SetExpr,
106112
SliceExpr,
107113
StarExpr,
@@ -396,14 +402,26 @@ def _visit_unsupported_expr(self, o: object) -> str:
396402
# Something we do not understand.
397403
return self.stubgen.add_name("_typeshed.Incomplete")
398404

399-
visit_comparison_expr = _visit_unsupported_expr
400-
visit_cast_expr = _visit_unsupported_expr
401-
visit_conditional_expr = _visit_unsupported_expr
405+
def visit_comparison_expr(self, o: ComparisonExpr) -> str:
406+
return self._visit_unsupported_expr(o)
402407

403-
visit_list_comprehension = _visit_unsupported_expr
404-
visit_set_comprehension = _visit_unsupported_expr
405-
visit_dictionary_comprehension = _visit_unsupported_expr
406-
visit_generator_expr = _visit_unsupported_expr
408+
def visit_cast_expr(self, o: CastExpr) -> str:
409+
return self._visit_unsupported_expr(o)
410+
411+
def visit_conditional_expr(self, o: ConditionalExpr) -> str:
412+
return self._visit_unsupported_expr(o)
413+
414+
def visit_list_comprehension(self, o: ListComprehension) -> str:
415+
return self._visit_unsupported_expr(o)
416+
417+
def visit_set_comprehension(self, o: SetComprehension) -> str:
418+
return self._visit_unsupported_expr(o)
419+
420+
def visit_dictionary_comprehension(self, o: DictionaryComprehension) -> str:
421+
return self._visit_unsupported_expr(o)
422+
423+
def visit_generator_expr(self, o: GeneratorExpr) -> str:
424+
return self._visit_unsupported_expr(o)
407425

408426

409427
def find_defined_names(file: MypyFile) -> set[str]:

0 commit comments

Comments
 (0)