mypy
mypy copied to clipboard
Literal of type string not accepted as keyword name
To Reproduce
from typing import Literal
def fun(**kwargs) -> None:
...
class A:
def __init__(self):
self.a: Literal["a"] = "a"
def test(self) -> None:
return fun(**{self.a: "a"}) # error: Keywords must be strings [misc]
Your Environment
- Mypy version used: 0.971