You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A recent update to types-docutils (from 0.20.0.20240311 to 0.20.0.20240314) has added typing to ViewList. ( python/typeshed@a1bfd65python/typeshed#11469 ). We also recently turned on mypy typing for 3rd party types, so are getting the following errors
docs/ext/release_notes.py:30: error: Need type annotation for "rst" [var-annotated]
docs/ext/release_notes.py:56: error: Argument 2 to "nested_parse_with_titles" has incompatible type "ViewList[Any]"; expected "StringList" [arg-type]
docs/ext/operations_user_doc.py:84: error: Need type annotation for "rst" [var-annotated]
docs/ext/operations_user_doc.py:91: error: Argument 2 to "nested_parse_with_titles" has incompatible type "ViewList[Any]"; expected "StringList" [arg-type]
mypy can only infer the type if the generic type is used in the constructor. This is unlike built in containers, which can infer from the constructor or a method call
l1= [1]
reveal_type(l1) # -> Revealed type is "builtins.list[builtins.int]l2= []
l2.append(1)
reveal_type(l2) # -> Revealed type is "builtins.list[builtins.int]"
Summary
A recent update to
types-docutils
(from 0.20.0.20240311 to 0.20.0.20240314) has added typing toViewList
. ( python/typeshed@a1bfd65 python/typeshed#11469 ). We also recently turned on mypy typing for 3rd party types, so are getting the following errorsThis is because
ViewList
is a generic container.https://github.com/python/typeshed/blob/a1bfd65e9fa92e1bb61a475c7622ba0376d936d5/stubs/docutils/docutils/statemachine.pyi#L114
mypy can only infer the type if the generic type is used in the constructor. This is unlike built in containers, which can infer from the constructor or a method call
For custom classes this does not work python/mypy#13134
Steps To Reproduce
Expected Behaviour
Current Behaviour
Context
Failure Logs
Screenshot(s)
The text was updated successfully, but these errors were encountered: