False positive with mypy
Franco0700 opened this issue · comments
Defining a customFunctions, like this:
class CustomFunctions(jmespath.functions.Functions):
@jmespath.functions.signature({'types': ['object']}, {'types': ['array']})
def _func_map_merge(self, obj: str, arg: list[dict[str, str]]) -> list[dict[str, str]]:
result = []
for element in arg:
merged_object = super()._func_merge(obj, element)
result.append(merged_object)
return result
Drop the following error
error: "_func_merge" undefined in superclass
I think it should be some missing information on stubs
I'm not able to repro, can you give me the entire script as well as the commands you're running? Here's what I tried:
import jmespath
from jmespath import functions
from typing import List, Dict
class CustomFunctions(functions.Functions):
@functions.signature({'types': ['object']}, {'types': ['array']})
def _func_map_merge(self, obj: str, arg: List[Dict[str, str]]) -> List[Dict[str, str]]:
result = []
for element in arg:
merged_object = super()._func_merge(obj, element)
result.append(merged_object)
return result
options = jmespath.Options(custom_functions=CustomFunctions())
$ mypy check.py
Success: no issues found in 1 source file