mypy question

Karsten Hilbert Karsten.Hilbert at gmx.net
Fri Dec 29 07:15:29 EST 2023


Hi all,

I am not sure why mypy thinks this

gmPG2.py:554: error: Argument "queries" to "run_rw_queries" has incompatible type "List[Dict[str, str]]"; expected
"List[Dict[str, Union[str, List[Any], Dict[str, Any]]]]"  [arg-type]
                    rows, idx = run_rw_queries(link_obj = conn, queries = queries, return_data = True)
                                                                          ^~~~~~~

should be flagged. The intent is for "queries" to be

a list
	of dicts
		with keys of str
		and values of
			str OR
			list of anything OR
			dict with
				keys of str
				and values of anything

I'd have thunk list[dict[str,str]] matches that ?

This is on Python 3.11.2 with mypy 1.0.1 on Debian.

Karsten
--
GPG  40BE 5B0E C98E 1713 AFA6  5BC0 3BEA AC80 7D4F C89B


More information about the Python-list mailing list