(ctx: DynamicClassDefContext)
| 31 | |
| 32 | |
| 33 | def add_info_hook(ctx: DynamicClassDefContext) -> None: |
| 34 | class_def = ClassDef(ctx.name, Block([])) |
| 35 | class_def.fullname = ctx.api.qualified_name(ctx.name) |
| 36 | |
| 37 | info = TypeInfo(SymbolTable(), class_def, ctx.api.cur_mod_id) |
| 38 | class_def.info = info |
| 39 | assert isinstance(ctx.call.args[0], RefExpr) |
| 40 | queryset_type_fullname = ctx.call.args[0].fullname |
| 41 | queryset_node = ctx.api.lookup_fully_qualified_or_none(queryset_type_fullname) |
| 42 | assert queryset_node is not None |
| 43 | queryset_info = queryset_node.node |
| 44 | assert isinstance(queryset_info, TypeInfo) |
| 45 | obj = ctx.api.named_type("builtins.object") |
| 46 | info.mro = [info, queryset_info, obj.type] |
| 47 | info.bases = [Instance(queryset_info, [])] |
| 48 | ctx.api.add_symbol_table_node(ctx.name, SymbolTableNode(GDEF, info)) |
| 49 | |
| 50 | |
| 51 | def as_manager_hook(ctx: DynamicClassDefContext) -> None: |
nothing calls this directly
no test coverage detected
searching dependent graphs…