(
api: CheckerPluginInterface, type_args: Sequence[Type]
)
| 50 | |
| 51 | |
| 52 | def make_fake_register_class_instance( |
| 53 | api: CheckerPluginInterface, type_args: Sequence[Type] |
| 54 | ) -> Instance: |
| 55 | defn = ClassDef(SINGLEDISPATCH_REGISTER_RETURN_CLASS, Block([])) |
| 56 | defn.fullname = f"functools.{SINGLEDISPATCH_REGISTER_RETURN_CLASS}" |
| 57 | info = TypeInfo(SymbolTable(), defn, "functools") |
| 58 | obj_type = api.named_generic_type("builtins.object", []).type |
| 59 | info.bases = [Instance(obj_type, [])] |
| 60 | info.mro = [info, obj_type] |
| 61 | defn.info = info |
| 62 | |
| 63 | func_arg = Argument(Var("name"), AnyType(TypeOfAny.implementation_artifact), None, ARG_POS) |
| 64 | add_method_to_class(api, defn, "__call__", [func_arg], NoneType()) |
| 65 | |
| 66 | return Instance(info, type_args) |
| 67 | |
| 68 | |
| 69 | PluginContext: _TypeAlias = FunctionContext | MethodContext |
no test coverage detected
searching dependent graphs…