File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,7 @@ def _convert_statement(statement: Tree, context: Context) -> List[str]:
6464 )
6565 ],
6666 "static_func_def" : _convert_first_child_as_statement ,
67+ "abstract_func_def" : _convert_abstract_func_def ,
6768 "docstr_stmt" : _pass ,
6869 # func statements:
6970 "func_var_stmt" : _convert_first_child_as_statement ,
@@ -164,6 +165,16 @@ def _convert_func_def(statement: Tree, context: Context) -> List[str]:
164165 ] + _convert_block (statement .children [1 :], context .create_child_context (- 1 ))
165166
166167
168+ def _convert_abstract_func_def (statement : Tree , context : Context ) -> List [str ]:
169+ # Abstract functions don't have a body, so we create a function that raises NotImplementedError
170+ func_header = statement .children [0 ]
171+ func_name = func_header .children [0 ].value
172+ return [
173+ f"{ context .indent_string } def { func_name } ():" ,
174+ f"{ context .indent_string } raise NotImplementedError('Abstract method not implemented')" ,
175+ ]
176+
177+
167178def _convert_branch_with_expression (
168179 prefix : str , statement : Tree , context : Context
169180) -> List [str ]:
You can’t perform that action at this time.
0 commit comments