Skip to content

mypy failing on trunk #12113

@glyph

Description

@glyph
mypy run-test: commands[0] | mypy --cache-dir=/Users/glyph/Projects/Twisted/.tox/mypy_cache --pretty src
src/twisted/web/http.py:257:16: error: Item "str" of "Message | str | Any" has no attribute "get_param" 
[union-attr]
            name = part.get_param("name", header="content-disposition")
                   ^~~~~~~~~~~~~~
src/twisted/web/http.py:260:19: error: Item "str" of "Message | str | Any" has no attribute "get_payload" 
[union-attr]
            payload = part.get_payload(decode=True)
                      ^~~~~~~~~~~~~~~~
src/twisted/web/http.py:261:16: error: Item "tuple[str | None, ...]" of
"str | Any | tuple[str | None, str | None, str]" has no attribute "encode"  [union-attr]
            result[name.encode("utf8")] = [payload]
                   ^~~~~~~~~~~
src/twisted/web/http.py:262:12: error: Incompatible return value type (got
"dict[bytes | Any, list[Message | bytes | Any]]", expected "dict[bytes, list[bytes]]")  [return-value]
        return result
               ^~~~~~
src/twisted/mail/test/test_bounce.py:93:26: error: Item "str" of "Any | str | Message" has no attribute
"get_payload"  [union-attr]
            self.assertEqual(parts[0].get_payload(), "Custom transcript\n")
                             ^~~~~~~~~~~~~~~~~~~~
src/twisted/mail/test/test_bounce.py:93:32: error: Invalid index type "int" for
"Message | str | list[Message | str] | Any"; expected type "str"  [index]
            self.assertEqual(parts[0].get_payload(), "Custom transcript\n")
                                   ^
src/twisted/mail/test/test_bounce.py:111:24: error: Item "str" of "Any | str | Message" has no attribute
"get_payload"  [union-attr]
            innerMessage = parts[1].get_payload()
                           ^~~~~~~~~~~~~~~~~~~~
src/twisted/mail/test/test_bounce.py:111:30: error: Invalid index type "int" for
"Message | str | list[Message | str] | Any"; expected type "str"  [index]
            innerMessage = parts[1].get_payload()
                                 ^
src/twisted/mail/test/test_bounce.py:116:26: error: Item "str" of "Any | str | Message" has no attribute
"get_payload"  [union-attr]
            self.assertEqual(innerMessage[0].get_payload() + "\n", messageText)
                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~
src/twisted/mail/test/test_bounce.py:116:26: error: Unsupported left operand type for + ("Message")  [operator]
            self.assertEqual(innerMessage[0].get_payload() + "\n", messageText)
                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/twisted/mail/test/test_bounce.py:116:26: error: No overload variant of "__add__" of "list" matches argument
type "str"  [operator]
            self.assertEqual(innerMessage[0].get_payload() + "\n", messageText)
                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/twisted/mail/test/test_bounce.py:116:26: note: Possible overload variants:
src/twisted/mail/test/test_bounce.py:116:26: note:     def __add__(self, list[Message | str], /) -> list[Message | str]
src/twisted/mail/test/test_bounce.py:116:26: note:     def [_S] __add__(self, list[_S], /) -> list[_S | Message | str]
src/twisted/mail/test/test_bounce.py:116:26: note: Left operand is of type "Any | Message | str | list[Message | str]"
src/twisted/mail/test/test_bounce.py:116:39: error: Invalid index type "int" for
"Any | Message | str | list[Message | str]"; expected type "str"  [index]
            self.assertEqual(innerMessage[0].get_payload() + "\n", messageText)
                                          ^
src/twisted/trial/test/test_script.py:531: error: Unused "type: ignore" comment  [unused-ignore]
                options.tracer.globaltrace,  # type: ignore[attr-defined]
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Found 13 errors in 3 files (checked 851 source files)
ERROR: InvocationError for command /Users/glyph/Projects/Twisted/.tox/mypy/bin/mypy --cache-dir=/Users/glyph/Projects/Twisted/.tox/mypy_cache --pretty src (exited with code 1)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions