コード例 #1
0
 def visit_func_def(self, node: FuncDef) -> None:
     if not self.recurse_into_functions:
         return
     node.expanded = []
     node.type = node.unanalyzed_type
     if node.type:
         # Type variable binder binds type variables before the type is analyzed,
         # this causes unanalyzed_type to be modified in place. We needed to revert this
         # in order to get the state exactly as it was before semantic analysis.
         # See also #4814.
         assert isinstance(node.type, CallableType)
         node.type.variables = []
     with self.enter_method(node.info) if node.info else nothing():
         super().visit_func_def(node)
コード例 #2
0
ファイル: aststripnew.py プロジェクト: elazarg/mypy
 def visit_func_def(self, node: FuncDef) -> None:
     if not self.recurse_into_functions:
         return
     node.expanded = []
     node.type = node.unanalyzed_type
     if node.type:
         # Type variable binder binds type variables before the type is analyzed,
         # this causes unanalyzed_type to be modified in place. We needed to revert this
         # in order to get the state exactly as it was before semantic analysis.
         # See also #4814.
         assert isinstance(node.type, CallableType)
         node.type.variables = []
     with self.enter_method(node.info) if node.info else nothing():
         super().visit_func_def(node)