(
self, node: DeferredNodeType | FineGrainedDeferredNodeType, impl_only: bool
)
| 677 | return True |
| 678 | |
| 679 | def check_partial( |
| 680 | self, node: DeferredNodeType | FineGrainedDeferredNodeType, impl_only: bool |
| 681 | ) -> None: |
| 682 | self.widened_vars = [] |
| 683 | if isinstance(node, MypyFile): |
| 684 | self.check_top_level(node) |
| 685 | else: |
| 686 | with self.binder.top_frame_context(): |
| 687 | # TODO: use impl_only in the daemon as well. |
| 688 | if not impl_only: |
| 689 | self.accept(node) |
| 690 | return |
| 691 | if node.line in self.globals_unreachable: |
| 692 | return |
| 693 | if isinstance(node, (FuncDef, Decorator)): |
| 694 | self.check_partial_impl(node) |
| 695 | else: |
| 696 | # Overloads need some special logic, since settable |
| 697 | # properties are stored as overloads. |
| 698 | for i, item in enumerate(node.items): |
| 699 | # Setter and/or deleter can technically be empty. |
| 700 | allow_empty = not node.is_property or i > 0 |
| 701 | assert isinstance(item, Decorator) |
| 702 | # Although the actual bodies of overload items are empty, we |
| 703 | # still need to execute some logic that doesn't affect signature. |
| 704 | with self.tscope.function_scope(item.func): |
| 705 | self.check_func_item( |
| 706 | item.func, name=node.name, allow_empty=allow_empty |
| 707 | ) |
| 708 | if node.impl is not None: |
| 709 | # Handle the implementation as a regular function. |
| 710 | with self.enter_overload_impl(node.impl): |
| 711 | self.check_partial_impl(node.impl) |
| 712 | |
| 713 | def check_partial_impl(self, impl: FuncDef | Decorator) -> None: |
| 714 | """Check only the body (not the signature) of a non-overloaded function.""" |
no test coverage detected