Python doesn't need keyword arguments to be dictionaries, Mapping is sufficient.
Minimal Repro & contrived example:
from collections import Mapping
class M(Mapping):
def keys(self):
return ['a']
def __getitem__(self, key):
return 'world'
def __len__(self):
return 1
def __iter__(self):
return self.keys()
def foo(a: str=None) -> None:
print(f'Hello {a}')
def bar(b: Mapping) -> None:
foo(**b)
foo(**M())
bar(M())
Results in:
$ mypy test_mapping.py
test_mapping.py:23: error: Argument after ** must be a dictionary
test_mapping.py:26: error: Argument after ** must be a dictionary