Josverl / micropython-stubber

Generate and maintain stubs for different MicroPython ports to use with VSCode and Pylance, PyRight, Thonny, PyCharm or MyPy
https://micropython-stubber.readthedocs.io
Other
172 stars 14 forks source link

pyright: add to ordered dict #333

Closed Josverl closed 8 months ago

Josverl commented 1 year ago

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
}]
Josverl commented 10 months ago

test : snippets/feat_stdlib/check_collections\check_ordereddict.py image

Josverl commented 8 months ago

fixed by update to stdlib