def _ensure_super_context(self, node: ast.Call) -> None: parent_context = nodes.get_context(node) parent_node = nodes.get_parent(node) attr = getattr(parent_node, 'attr', None) parent_name = getattr(parent_context, 'name', None) if attr and parent_name and attr != parent_name: self.add_violation(oop.WrongSuperCallAccessViolation(node), ) if isinstance(parent_context, FunctionNodes): grand_context = nodes.get_context(parent_context) if isinstance(grand_context, ast.ClassDef): return self.add_violation( oop.WrongSuperCallViolation(node, text='not inside method'), )
def _check_super_arguments(self, node: ast.Call) -> None: if node.args or node.keywords: self.add_violation( oop.WrongSuperCallViolation(node, text='remove arguments'), )