'Is there a way to tell mypy to ignore checks on overridden functions?
I changed a function in a specific library by monkey patching it with a different function.
Library's send function
def send(content: str):
...
Monkey patch
def new(content: Union[str, dict[str, str]]):
return send(content)
library.send = new
But using that function results in a mypy error:
Code that resulted in an error
library.send(
{"ja": "Japanese text", "en": "English text"}
)
Error text
Argument 1 to "send" has incompatible type "Dict[str, str]"; expected "str"
Is it possible to make exceptions for certain functions to avoid this?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|