def visit_ClassDef(self, node: ast.ClassDef) -> ast.ClassDef: self.generic_visit(node) if node.bases: node.bases = [ ast.Name(id=_n(core.CustomResource), ctx=ast.Load()), *node.bases, ] else: node.bases = [ast.Name(id=_n(core.ExternalResource), ctx=ast.Load())] return node
def _visit_cls(self: 'ASTTagger', node: ast.ClassDef): bases = visit_suite(self.visit, node.bases) keywords = visit_suite(self.visit, node.keywords) decorator_list = visit_suite(self.visit, node.decorator_list) self.symtable.entered.add(node.name) new = self.symtable.enter_new() new.entered.add('__module__') new.entered.add('__qualname__') # pep-3155 nested name. new_tagger = ASTTagger(new) new.cts.add(ContextType.ClassDef) body = visit_suite(new_tagger.visit, node.body) node.bases = bases node.keywords = keywords node.decorator_list = decorator_list node.body = body return Tag(node, new)