(ctx: DynamicClassDefContext)
| 49 | |
| 50 | |
| 51 | def as_manager_hook(ctx: DynamicClassDefContext) -> None: |
| 52 | class_def = ClassDef(ctx.name, Block([])) |
| 53 | class_def.fullname = ctx.api.qualified_name(ctx.name) |
| 54 | |
| 55 | info = TypeInfo(SymbolTable(), class_def, ctx.api.cur_mod_id) |
| 56 | class_def.info = info |
| 57 | assert isinstance(ctx.call.callee, MemberExpr) |
| 58 | assert isinstance(ctx.call.callee.expr, IndexExpr) |
| 59 | assert isinstance(ctx.call.callee.expr.analyzed, TypeApplication) |
| 60 | assert isinstance(ctx.call.callee.expr.analyzed.expr, NameExpr) |
| 61 | |
| 62 | queryset_type_fullname = ctx.call.callee.expr.analyzed.expr.fullname |
| 63 | queryset_node = ctx.api.lookup_fully_qualified_or_none(queryset_type_fullname) |
| 64 | assert queryset_node is not None |
| 65 | queryset_info = queryset_node.node |
| 66 | assert isinstance(queryset_info, TypeInfo) |
| 67 | parameter_type = ctx.call.callee.expr.analyzed.types[0] |
| 68 | |
| 69 | obj = ctx.api.named_type("builtins.object") |
| 70 | info.mro = [info, queryset_info, obj.type] |
| 71 | info.bases = [Instance(queryset_info, [parameter_type])] |
| 72 | ctx.api.add_symbol_table_node(ctx.name, SymbolTableNode(GDEF, info)) |
| 73 | |
| 74 | |
| 75 | def plugin(version: str) -> type[DynPlugin]: |
nothing calls this directly
no test coverage detected
searching dependent graphs…