Skip to content

chore(typing): fix mypy>=1.14.0 warnings#3739

Merged
dangotbanned merged 2 commits intomainfrom
fix-mypy-1.14.x
Jan 2, 2025
Merged

chore(typing): fix mypy>=1.14.0 warnings#3739
dangotbanned merged 2 commits intomainfrom
fix-mypy-1.14.x

Conversation

@dangotbanned
Copy link
Copy Markdown
Member

@dangotbanned dangotbanned commented Jan 2, 2025

Resolves 2 new warnings that appeared after updating my env.

Warnings

tools/markup.py:71: error: Incompatible types in assignment (expression has type "str | list[dict[str, Any]]", variable has type "str")  [assignment]
            s = super().__call__(s)  # pyright: ignore[reportAssignmentType]
                ^~~~~~~~~~~~~~~~~~~
tools/markup.py:158: error: Incompatible return value type (got "str | list[dict[str, Any]]", expected "list[dict[str, Any]]")  [return-value]
        return tokens[0]
               ^~~~~~~~~
Found 2 errors in 1 file (checked 11 source files)

Additional

The second warning reminded me of (#3687 (comment)), so I've done some tidying up and opened a PR upstream

`pyright` had already detected this, but `mypy` has now caught up.

tools\markup.py:71: error: Incompatible types in assignment (expression has type "str | list[dict[str, Any]]", variable has type "str")  [assignment]             s = super().__call__(s)  # pyright: ignore[reportAssignmentType]                 ^~~~~~~~~~~~~~~~~~~
Also simplifies some of the surrounding **temporary** code
Warning:

tools\markup.py:158: error: Incompatible return value type (got "str | list[dict[str, Any]]", expected "list[dict[str, Any]]")  [return-value]         return tokens[0]                ^~~~~~~~~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant