Type mismatch python function for decorator

37 Views Asked by At

I'm working with some Python code that utilizes decorators. Here's the relevant code snippet:

def method1(
    a: Type[BaseClass],
    b: Callable[[Tuple[BaseClass, ...]], Callable[[Type], Type]],
    c: Tuple[BaseClass, ...],) -> Callable[[Type], Type]:
    # ... (function definition)

def example(*input: Class) -> Callable[[Type], Type]:
    return method1(Class, example, input)

I'm encountering a type warning in the example decorator, specifically in the return method1(Class, example, input) call for argument example.

The warning message I'm getting is:

Expected type '(Tuple[BaseClass, ...]) -> (type) -> type', got '(input: Tuple[Class, ...]) -> (type) -> type' instead

Class inherits from BaseClass.

I'm unsure why the type mismatch is occurring in this case. Arguments a and b don't have warnings.

Any insights on how to resolve this type mismatch to ensure the no warnings would be greatly appreciated.

0

There are 0 best solutions below