(self, o: FuncDef)
| 698 | return None |
| 699 | |
| 700 | def visit_func_def(self, o: FuncDef) -> None: |
| 701 | is_dataclass_generated = ( |
| 702 | self.analyzed and self.processing_dataclass and o.info.names[o.name].plugin_generated |
| 703 | ) |
| 704 | if is_dataclass_generated: |
| 705 | # Skip methods generated by the @dataclass decorator |
| 706 | return |
| 707 | if ( |
| 708 | self.is_private_name(o.name, o.fullname) |
| 709 | or self.is_not_in_all(o.name) |
| 710 | or (self.is_recorded_name(o.name) and not o.is_overload) |
| 711 | ): |
| 712 | self.clear_decorators() |
| 713 | return |
| 714 | if self.is_top_level() and self._state not in (EMPTY, FUNC): |
| 715 | self.add("\n") |
| 716 | if not self.is_top_level(): |
| 717 | self_inits = find_self_initializers(o) |
| 718 | for init, value, annotation in self_inits: |
| 719 | if init in self.method_names: |
| 720 | # Can't have both an attribute and a method/property with the same name. |
| 721 | continue |
| 722 | init_code = self.get_init(init, value, annotation) |
| 723 | if init_code: |
| 724 | self.add(init_code) |
| 725 | |
| 726 | if self._class_stack: |
| 727 | if len(o.arguments): |
| 728 | self_var = o.arguments[0].variable.name |
| 729 | else: |
| 730 | self_var = "self" |
| 731 | class_info: ClassInfo | None = None |
| 732 | for class_def in self._class_stack: |
| 733 | class_info = ClassInfo(class_def.name, self_var, parent=class_info) |
| 734 | else: |
| 735 | class_info = None |
| 736 | |
| 737 | ctx = FunctionContext( |
| 738 | module_name=self.module_name, |
| 739 | name=o.name, |
| 740 | docstring=self._get_func_docstring(o), |
| 741 | is_abstract=o.abstract_status != NOT_ABSTRACT, |
| 742 | class_info=class_info, |
| 743 | ) |
| 744 | |
| 745 | self.record_name(o.name) |
| 746 | |
| 747 | default_sig = self.get_default_function_sig(o, ctx) |
| 748 | sigs = self.get_signatures(default_sig, self.sig_generators, ctx) |
| 749 | |
| 750 | for output in self.format_func_def( |
| 751 | sigs, is_coroutine=o.is_coroutine, decorators=self._decorators, docstring=ctx.docstring |
| 752 | ): |
| 753 | self.add(output + "\n") |
| 754 | |
| 755 | self.clear_decorators() |
| 756 | self._state = FUNC |
| 757 |
no test coverage detected