PYRIGHT: adding to ordered dict is flagged by pyright
d["w"] = 5
d["b"] = 3
for k, v in d.items():
print(k, v)
[{
"resource": "/C:/develop/MyPython/stdlib-stub-test/src/validate_ordereddict.py",
"owner": "_generated_diagnostic_collection_name_#12",
"code": {
"value": "reportGeneralTypeIssues",
"target": {
"$mid": 1,
"external": "https://github.com/microsoft/pyright/blob/main/docs/configuration.md#reportGeneralTypeIssues",
"path": "/microsoft/pyright/blob/main/docs/configuration.md",
"scheme": "https",
"authority": "github.com",
"fragment": "reportGeneralTypeIssues"
}
},
"severity": 8,
"message": "Argument of type \"Literal['w']\" cannot be assigned to parameter \"k\" of type \"Literal['z', 'a']\" in function \"__setitem__\"\n Type \"Literal['w']\" cannot be assigned to type \"Literal['z', 'a']\"\n \"Literal['w']\" cannot be assigned to type \"Literal['z']\"\n \"Literal['w']\" cannot be assigned to type \"Literal['a']\"",
"source": "Pylance",
"startLineNumber": 9,
"startColumn": 1,
"endLineNumber": 9,
"endColumn": 7
}]
PYRIGHT: adding to ordered dict is flagged by pyright
d["w"] = 5
d["b"] = 3
for k, v in d.items(): print(k, v)