-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Enable --check-untyped-defs
by default
#12901
base: master
Are you sure you want to change the base?
Enable --check-untyped-defs
by default
#12901
Conversation
Changing the default of an option apparently isn't as straightforward as just changing the default argument to add_invertible_flag. We need to also specify dest, change the name of the flag, and change the default in options.py.
Remove strict_flag=True to prevent check-untyped-defs from being disabled when --strict is passed. Also update the help text for the untyped group to remove the statement referring to --check-untyped-defs being disabled by default.
This comment has been minimized.
This comment has been minimized.
My analysis of some of the mypy_primer errors (see below for summary): Stone
PanderaMost of these errors look like genuine errors. Some notes about some of those errors:
pyjwt
Summary
|
Thanks for looking into this! You probably know this already, but just in case, note that ^ is only a fraction of the complete mypy_primer output ( |
This comment has been minimized.
This comment has been minimized.
Diff from mypy_primer, showing the effect of this PR on open source code: aiortc (https://github.com/aiortc/aiortc)
+ src/aiortc/contrib/media.py:74: error: Call to untyped function "blackhole_consume" in typed context [no-untyped-call]
+ src/aiortc/contrib/media.py:99: error: Module has no attribute "AudioResampler" [attr-defined]
+ src/aiortc/contrib/media.py:115: error: Module has no attribute "FFmpegError" [attr-defined]
+ src/aiortc/contrib/media.py:154: error: "VideoFrame" has no attribute "time" [attr-defined]
+ src/aiortc/contrib/media.py:178: error: Module has no attribute "FFmpegError" [attr-defined]
+ src/aiortc/contrib/media.py:226: error: Need type annotation for "_queue" [var-annotated]
- src/aiortc/contrib/media.py:308: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
- src/aiortc/contrib/media.py:309: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
- src/aiortc/contrib/media.py:312: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
- src/aiortc/contrib/media.py:315: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
- src/aiortc/contrib/media.py:316: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
+ src/aiortc/contrib/media.py:305: error: Module has no attribute "open" [attr-defined]
+ src/aiortc/contrib/media.py:320: error: Call to untyped function "PlayerStreamTrack" in typed context [no-untyped-call]
+ src/aiortc/contrib/media.py:323: error: Call to untyped function "PlayerStreamTrack" in typed context [no-untyped-call]
+ src/aiortc/contrib/media.py:327: error: Call to untyped function "PlayerStreamTrack" in typed context [no-untyped-call]
+ src/aiortc/contrib/media.py:330: error: Call to untyped function "PlayerStreamTrack" in typed context [no-untyped-call]
+ src/aiortc/contrib/media.py:422: error: Module has no attribute "open" [attr-defined]
+ src/aiortc/contrib/media.py:446: error: Call to untyped function "MediaRecorderContext" in typed context [no-untyped-call]
+ src/aiortc/contrib/media.py:521: error: Call to untyped function "stop" in typed context [no-untyped-call]
+ src/aiortc/rtcrtpsender.py:228: error: Incompatible types in assignment (expression has type "float", variable has type "None") [assignment]
+ src/aiortc/rtcsctptransport.py:846: error: Call to untyped function "_receive_chunk" in typed context [no-untyped-call]
+ src/aiortc/rtcsctptransport.py:850: error: Call to untyped function "_send_sack" in typed context [no-untyped-call]
+ src/aiortc/rtcsctptransport.py:927: error: Call to untyped function "_receive_sack_chunk" in typed context [no-untyped-call]
+ src/aiortc/rtcsctptransport.py:940: error: Incompatible types in assignment (expression has type "ShutdownAckChunk", variable has type "HeartbeatAckChunk") [assignment]
+ src/aiortc/rtcsctptransport.py:957: error: Call to untyped function "_receive_reconfig_param" in typed context [no-untyped-call]
+ src/aiortc/rtcsctptransport.py:957: error: "type" has no attribute "parse" [attr-defined]
+ src/aiortc/rtcsctptransport.py:979: error: Incompatible types in assignment (expression has type "InitAckChunk", variable has type "HeartbeatAckChunk") [assignment]
+ src/aiortc/rtcsctptransport.py:980: error: "HeartbeatAckChunk" has no attribute "initiate_tag" [attr-defined]
+ src/aiortc/rtcsctptransport.py:981: error: "HeartbeatAckChunk" has no attribute "advertised_rwnd" [attr-defined]
+ src/aiortc/rtcsctptransport.py:982: error: "HeartbeatAckChunk" has no attribute "outbound_streams" [attr-defined]
+ src/aiortc/rtcsctptransport.py:983: error: "HeartbeatAckChunk" has no attribute "inbound_streams" [attr-defined]
+ src/aiortc/rtcsctptransport.py:984: error: "HeartbeatAckChunk" has no attribute "initial_tsn" [attr-defined]
+ src/aiortc/rtcsctptransport.py:1012: error: Incompatible types in assignment (expression has type "CookieAckChunk", variable has type "HeartbeatAckChunk") [assignment]
+ src/aiortc/rtcsctptransport.py:1234: error: No overload variant of "pop" of "dict" matches argument types "bytes", "None" [call-overload]
+ src/aiortc/rtcsctptransport.py:1234: note: Possible overload variants:
+ src/aiortc/rtcsctptransport.py:1234: note: def pop(self, int, /) -> InboundStream
+ src/aiortc/rtcsctptransport.py:1234: note: def [_T] pop(self, int, Union[InboundStream, _T], /) -> Union[InboundStream, _T]
+ src/aiortc/rtcsctptransport.py:1237: error: No overload variant of "get" of "dict" matches argument type "bytes" [call-overload]
+ src/aiortc/rtcsctptransport.py:1237: note: Possible overload variants:
+ src/aiortc/rtcsctptransport.py:1237: note: def get(self, int, /) -> RTCDataChannel
+ src/aiortc/rtcsctptransport.py:1237: note: def [_T] get(self, int, Union[RTCDataChannel, _T], /) -> Union[RTCDataChannel, _T]
+ src/aiortc/rtcsctptransport.py:1239: error: Call to untyped function "_data_channel_close" in typed context [no-untyped-call]
+ src/aiortc/rtcsctptransport.py:1247: error: Call to untyped function "_send_reconfig_param" in typed context [no-untyped-call]
+ src/aiortc/rtcsctptransport.py:1258: error: Call to untyped function "_send_reconfig_param" in typed context [no-untyped-call]
+ src/aiortc/rtcsctptransport.py:1359: error: Need type annotation for "gaps" (hint: "gaps: List[<type>] = ...") [var-annotated]
+ src/aiortc/rtcsctptransport.py:1369: error: Call to untyped function "SackChunk" in typed context [no-untyped-call]
+ src/aiortc/rtcsctptransport.py:1567: error: Argument "streams" to "StreamResetOutgoingParam" has incompatible type "List[int]"; expected "List[bytes]" [arg-type]
+ src/aiortc/rtcsctptransport.py:1569: error: Incompatible types in assignment (expression has type "StreamResetOutgoingParam", variable has type "None") [assignment]
+ src/aiortc/rtcsctptransport.py:1572: error: Call to untyped function "_send_reconfig_param" in typed context [no-untyped-call]
+ src/aiortc/rtcsctptransport.py:1622: error: Call to untyped function "_transmit_reconfig" in typed context [no-untyped-call]
+ src/aiortc/rtcsctptransport.py:1625: error: Need type annotation for "new_queue" [var-annotated]
+ src/aiortc/rtcrtptransceiver.py:129: error: Call to untyped function "stop" in typed context [no-untyped-call]
+ src/aiortc/rtcpeerconnection.py:486: error: Call to untyped function "stop" in typed context [no-untyped-call]
+ src/aiortc/contrib/signaling.py:34: error: Dict entry 2 has incompatible type "str": "int"; expected "str": "str" [dict-item]
+ src/aiortc/contrib/signaling.py:59: error: Call to untyped function "send" in typed context [no-untyped-call]
+ src/aiortc/contrib/signaling.py:67: error: Call to untyped function "object_from_string" in typed context [no-untyped-call]
+ src/aiortc/contrib/signaling.py:71: error: Call to untyped function "object_to_string" in typed context [no-untyped-call]
+ src/aiortc/contrib/signaling.py:110: error: Call to untyped function "send" in typed context [no-untyped-call]
+ src/aiortc/contrib/signaling.py:119: error: Call to untyped function "_connect" in typed context [no-untyped-call]
+ src/aiortc/contrib/signaling.py:124: error: Call to untyped function "object_from_string" in typed context [no-untyped-call]
+ src/aiortc/contrib/signaling.py:127: error: Call to untyped function "_connect" in typed context [no-untyped-call]
+ src/aiortc/contrib/signaling.py:128: error: Call to untyped function "object_to_string" in typed context [no-untyped-call]
+ src/aiortc/contrib/signaling.py:163: error: Call to untyped function "send" in typed context [no-untyped-call]
+ src/aiortc/contrib/signaling.py:173: error: Call to untyped function "_connect" in typed context [no-untyped-call]
+ src/aiortc/contrib/signaling.py:178: error: Call to untyped function "object_from_string" in typed context [no-untyped-call]
+ src/aiortc/contrib/signaling.py:181: error: Call to untyped function "_connect" in typed context [no-untyped-call]
+ src/aiortc/contrib/signaling.py:182: error: Call to untyped function "object_to_string" in typed context [no-untyped-call]
+ src/aiortc/contrib/signaling.py:213: error: Call to untyped function "TcpSocketSignaling" in typed context [no-untyped-call]
+ src/aiortc/contrib/signaling.py:215: error: Call to untyped function "UnixSocketSignaling" in typed context [no-untyped-call]
+ src/aiortc/contrib/signaling.py:217: error: Call to untyped function "CopyAndPasteSignaling" in typed context [no-untyped-call]
vision (https://github.com/pytorch/vision)
+ torchvision/_internally_replaced_utils.py:33: error: Module has no attribute "WinDLL" [attr-defined]
+ torchvision/_internally_replaced_utils.py:41: error: Module has no attribute "add_dll_directory" [attr-defined]
+ torchvision/extension.py:98: error: Module has no attribute "WinDLL" [attr-defined]
+ torchvision/models/_api.py:76: error: "__getattr__" undefined in superclass [misc]
+ torchvision/transforms/_transforms_video.py:31: error: No overload variant of "int" matches argument type "Number" [call-overload]
+ torchvision/transforms/_transforms_video.py:31: note: Possible overload variants:
+ torchvision/transforms/_transforms_video.py:31: note: def __new__(cls, Union[str, bytes, bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer, SupportsInt, SupportsIndex, SupportsTrunc] = ..., /) -> int
+ torchvision/transforms/_transforms_video.py:31: note: def __new__(cls, Union[str, bytes, bytearray], /, base: SupportsIndex) -> int
+ torchvision/transforms/_transforms_video.py:43: error: Argument 2 to "get_params" of "RandomCrop" has incompatible type "Tuple[Any, ...]"; expected "Tuple[int, int]" [arg-type]
+ torchvision/transforms/_transforms_video.py:77: error: Argument 2 to "get_params" of "RandomResizedCrop" has incompatible type "Sequence[Any]"; expected "List[float]" [arg-type]
+ torchvision/transforms/_transforms_video.py:77: error: Argument 3 to "get_params" of "RandomResizedCrop" has incompatible type "Sequence[Any]"; expected "List[float]" [arg-type]
+ torchvision/transforms/_transforms_video.py:87: error: No overload variant of "int" matches argument type "Number" [call-overload]
+ torchvision/transforms/_transforms_video.py:87: note: Possible overload variants:
+ torchvision/transforms/_transforms_video.py:87: note: def __new__(cls, Union[str, bytes, bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer, SupportsInt, SupportsIndex, SupportsTrunc] = ..., /) -> int
+ torchvision/transforms/_transforms_video.py:87: note: def __new__(cls, Union[str, bytes, bytearray], /, base: SupportsIndex) -> int
+ torchvision/models/optical_flow/raft.py:262: error: Incompatible types in assignment (expression has type "Callable[[Any, Any], Any]", variable has type "ConvGRU") [assignment]
pyinstrument (https://github.com/joerick/pyinstrument)
- pyinstrument/frame.py:376: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
+ pyinstrument/vendor/appdirs.py:497: error: Module has no attribute "OpenKey" [attr-defined]
+ pyinstrument/vendor/appdirs.py:498: error: Module has no attribute "HKEY_CURRENT_USER" [attr-defined]
+ pyinstrument/vendor/appdirs.py:501: error: Module has no attribute "QueryValueEx" [attr-defined]
+ pyinstrument/vendor/appdirs.py:515: error: Module has no attribute "windll" [attr-defined]
+ pyinstrument/vendor/appdirs.py:526: error: Module has no attribute "windll" [attr-defined]
+ pyinstrument/vendor/appdirs.py:537: error: Module has no attribute "zeros" [attr-defined]
+ pyinstrument/vendor/appdirs.py:550: error: Module has no attribute "zeros" [attr-defined]
+ pyinstrument/vendor/decorator.py:103: error: Need type annotation for "arg" [var-annotated]
+ pyinstrument/vendor/decorator.py:253: error: Incompatible types in assignment (expression has type "Optional[str]", variable has type "str") [assignment]
+ pyinstrument/vendor/decorator.py:259: error: Incompatible types in assignment (expression has type "Optional[Tuple[Any, ...]]", variable has type "Tuple[]") [assignment]
+ pyinstrument/vendor/decorator.py:294: error: Missing positional arguments "args", "kwds" in call to "__init__" of "_GeneratorContextManager" [call-arg]
+ pyinstrument/vendor/decorator.py:353: error: Need type annotation for "typemap" (hint: "typemap: Dict[<type>, <type>] = ...") [var-annotated]
+ pyinstrument/vendor/decorator.py:360: error: Need type annotation for "ras" [var-annotated]
+ pyinstrument/__main__.py:241: error: Incompatible types in assignment (expression has type "CommandLineOptions", variable has type "Values") [assignment]
+ pyinstrument/__main__.py:269: error: Incompatible types in assignment (expression has type "TextIO", variable has type "StreamReaderWriter") [assignment]
+ pyinstrument/__main__.py:275: error: Argument 1 to "create_renderer" has incompatible type "Values"; expected "CommandLineOptions" [arg-type]
+ pyinstrument/__main__.py:331: error: Incompatible types in assignment (expression has type "TextIO", variable has type "StreamReaderWriter") [assignment]
kornia (https://github.com/kornia/kornia)
+ kornia/constants.py:35: error: Need type annotation for "val" [var-annotated]
- kornia/feature/defmo.py:221: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
+ kornia/metrics/average_meter.py:27: error: Incompatible types in assignment (expression has type "Union[int, float, bool, Any]", variable has type "int") [assignment]
+ kornia/metrics/average_meter.py:28: error: Incompatible types in assignment (expression has type "Union[int, float, Any]", variable has type "int") [assignment]
+ kornia/metrics/average_meter.py:30: error: Incompatible types in assignment (expression has type "float", variable has type "int") [assignment]
+ kornia/feature/loftr/utils/position_encoding.py:56: error: Cannot determine type of "pe" [has-type]
+ kornia/feature/loftr/loftr_module/transformer.py:54: error: "object" not callable [operator]
- kornia/utils/helpers.py:37: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
+ kornia/utils/helpers.py:48: error: "None" not callable [misc]
+ kornia/testing/__init__.py:363: error: Variable "typ" is not valid as a type [valid-type]
+ kornia/testing/__init__.py:363: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
+ kornia/feature/siftdesc.py:170: error: "List[Any]" has no attribute "view" [attr-defined]
- kornia/geometry/linalg.py:101: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
- kornia/geometry/linalg.py:102: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
- kornia/geometry/linalg.py:105: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
- kornia/geometry/linalg.py:106: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
- kornia/geometry/linalg.py:109: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
- kornia/feature/siftdesc.py:145: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
- kornia/feature/siftdesc.py:148: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
- kornia/feature/siftdesc.py:150: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
- kornia/feature/siftdesc.py:151: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
- kornia/feature/siftdesc.py:153: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
- kornia/feature/siftdesc.py:154: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
- kornia/feature/siftdesc.py:156: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
- kornia/feature/siftdesc.py:158: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
- kornia/feature/siftdesc.py:159: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
- kornia/feature/siftdesc.py:160: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
- kornia/feature/siftdesc.py:161: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
- kornia/feature/siftdesc.py:163: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
- kornia/feature/siftdesc.py:295: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
- kornia/feature/siftdesc.py:297: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
- kornia/feature/siftdesc.py:298: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
- kornia/feature/siftdesc.py:299: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
- kornia/feature/siftdesc.py:300: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
- kornia/feature/siftdesc.py:301: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
- kornia/feature/siftdesc.py:303: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
- kornia/feature/siftdesc.py:304: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
- kornia/feature/siftdesc.py:305: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
- kornia/feature/siftdesc.py:306: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
- kornia/feature/siftdesc.py:308: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
+ kornia/nerf/data_utils.py:112: error: Argument 1 to "len" has incompatible type "Optional[RaySampler]"; expected "Sized" [arg-type]
paroxython (https://github.com/laowantong/paroxython)
+ paroxython/__init__.py:55: error: Argument "tags" to "main" has incompatible type "str"; expected "Literal['Taxon', 'Label']" [arg-type]
operator (https://github.com/canonical/operator)
+ ops/_vendor/websocket/_cookiejar.py:32: error: Need type annotation for "simpleCookie" [var-annotated]
+ ops/_vendor/websocket/_cookiejar.py:40: error: Item "None" of "Union[SimpleCookie[Any], Any, None]" has no attribute "update" [union-attr]
+ ops/_vendor/websocket/_cookiejar.py:45: error: Need type annotation for "simpleCookie" [var-annotated]
+ ops/_vendor/websocket/_cookiejar.py:66: error: Need type annotation for "cookie" [var-annotated]
+ ops/_vendor/websocket/_abnf.py:143: error: Cannot assign to a method [assignment]
+ ops/_vendor/websocket/_abnf.py:225: error: Unsupported operand types for << ("Callable[[Any, Any], Any]" and "int") [operator]
+ ops/_vendor/websocket/_abnf.py:227: error: Unsupported operand types for << ("Callable[[Any, Any], Any]" and "int") [operator]
+ ops/_vendor/websocket/_abnf.py:230: error: Unsupported operand types for << ("Callable[[Any, Any], Any]" and "int") [operator]
+ ops/_vendor/websocket/_abnf.py:233: error: Function "Callable[[Any, Any], Any]" could always be true in boolean context [truthy-function]
+ ops/_vendor/websocket/_abnf.py:315: error: Value of type "Optional[Any]" is not indexable [index]
+ ops/_vendor/websocket/_abnf.py:338: error: "None" object is not iterable [misc]
+ ops/_vendor/websocket/_abnf.py:418: error: Value of type "Optional[Any]" is not indexable [index]
+ ops/_vendor/websocket/_abnf.py:419: error: Value of type "Optional[Any]" is not indexable [index]
+ ops/_vendor/websocket/_abnf.py:423: error: Value of type "Optional[Any]" is not indexable [index]
+ ops/lib/__init__.py:94: error: Need type annotation for "_libraries" (hint: "_libraries: Dict[<type>, <type>] = ...") [var-annotated]
+ ops/lib/__init__.py:190: error: Need type annotation for "libinfo" (hint: "libinfo: Dict[<type>, <type>] = ...") [var-annotated]
+ ops/lib/__init__.py:221: error: Argument 2 to "_Lib" has incompatible type "object"; expected "str" [arg-type]
+ ops/lib/__init__.py:221: error: Argument 3 to "_Lib" has incompatible type "object"; expected "str" [arg-type]
+ ops/lib/__init__.py:221: error: Argument 4 to "_Lib" has incompatible type "object"; expected "int" [arg-type]
+ ops/lib/__init__.py:221: error: Argument 5 to "_Lib" has incompatible type "object"; expected "int" [arg-type]
+ ops/_vendor/websocket/_url.py:173: error: Argument 1 to "unquote" has incompatible type "Optional[str]"; expected "Union[str, bytes]" [arg-type]
+ ops/_vendor/websocket/_http.py:187: error: "OSError" has no attribute "remote_ip" [attr-defined]
+ ops/_vendor/websocket/_http.py:189: error: Module has no attribute "WSAECONNREFUSED"; maybe "ECONNREFUSED"? [attr-defined]
+ ops/_vendor/websocket/_http.py:191: error: Incompatible types in assignment (expression has type "Tuple[int]", variable has type "Tuple[int, Any]") [assignment]
+ ops/_vendor/websocket/_http.py:257: error: Incompatible types in assignment (expression has type "str", target has type "VerifyMode") [assignment]
+ ops/_vendor/websocket/_http.py:260: error: Incompatible types in assignment (expression has type "str", target has type "VerifyMode") [assignment]
+ ops/_vendor/websocket/_http.py:270: error: Name "match_hostname" is not defined [name-defined]
+ ops/_vendor/websocket/_http.py:307: error: Need type annotation for "headers" (hint: "headers: Dict[<type>, <type>] = ...") [var-annotated]
+ ops/_vendor/websocket/_core.py:104: error: Incompatible types in assignment (expression has type "NoLock", variable has type "Lock") [assignment]
+ ops/_vendor/websocket/_core.py:105: error: Incompatible types in assignment (expression has type "NoLock", variable has type "Lock") [assignment]
+ ops/_vendor/websocket/_core.py:121: error: Item "None" of "Optional[Any]" has no attribute "fileno" [union-attr]
+ ops/_vendor/websocket/_core.py:474: error: Item "None" of "Optional[Any]" has no attribute "gettimeout" [union-attr]
+ ops/_vendor/websocket/_core.py:475: error: Item "None" of "Optional[Any]" has no attribute "settimeout" [union-attr]
+ ops/_vendor/websocket/_core.py:491: error: Item "None" of "Optional[Any]" has no attribute "settimeout" [union-attr]
+ ops/_vendor/websocket/_core.py:492: error: Item "None" of "Optional[Any]" has no attribute "shutdown" [union-attr]
+ ops/_vendor/websocket/_core.py:503: error: Item "None" of "Optional[Any]" has no attribute "shutdown" [union-attr]
+ ops/_vendor/websocket/_app.py:204: error: Incompatible types in assignment (expression has type "float", variable has type "int") [assignment]
+ ops/_vendor/websocket/_app.py:335: error: Item "None" of "Optional[Any]" has no attribute "recv_data_frame" [union-attr]
+ ops/_vendor/websocket/_app.py:341: error: Incompatible types in assignment (expression has type "float", variable has type "int") [assignment]
+ ops/_vendor/websocket/_app.py:380: error: Item "None" of "Optional[Any]" has no attribute "is_ssl" [union-attr]
- ops/framework.py:995: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
- ops/framework.py:1126: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
- ops/framework.py:1127: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
+ ops/testing.py:1702: error: Missing positional argument "pebble_client" in call to "_can_connect" of "_TestingModelBackend" [call-arg]
+ ops/testing.py:1702: error: Argument 1 to "_can_connect" of "_TestingModelBackend" has incompatible type "_TestingPebbleClient"; expected "_TestingModelBackend" [arg-type]
- ops/testing.py:2257: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
+ ops/testing.py:2278: error: Incompatible types in assignment (expression has type "Union[_File, _Directory]", variable has type "_Directory") [assignment]
+ ops/testing.py:2344: error: Incompatible types in assignment (expression has type "Union[_File, _Directory]", variable has type "_Directory") [assignment]
+ ops/testing.py:2381: error: Incompatible types in assignment (expression has type "Union[_File, _Directory]", variable has type "_Directory") [assignment]
+ ops/main.py:61: error: Incompatible types in assignment (expression has type "Path", variable has type "Optional[str]") [assignment]
+ ops/main.py:63: error: Incompatible types in assignment (expression has type "Path", variable has type "Optional[str]") [assignment]
apprise (https://github.com/caronc/apprise)
+ apprise/logger.py:49: error: Module has no attribute "TRACE" [attr-defined]
+ apprise/logger.py:50: error: Module has no attribute "TRACE" [attr-defined]
+ apprise/logger.py:57: error: Module has no attribute "DEPRECATE" [attr-defined]
+ apprise/logger.py:58: error: Module has no attribute "DEPRECATE" [attr-defined]
+ apprise/logger.py:123: error: "object" has no attribute "setLevel" [attr-defined]
+ apprise/logger.py:128: error: "object" has no attribute "setFormatter" [attr-defined]
+ apprise/logger.py:157: error: Incompatible types in assignment (expression has type "TextIOWrapper", variable has type "StringIO") [assignment]
+ apprise/logger.py:160: error: Argument 1 to "addHandler" of "Logger" has incompatible type "object"; expected "Handler" [arg-type]
+ apprise/logger.py:171: error: "object" has no attribute "flush" [attr-defined]
+ apprise/logger.py:175: error: Argument 1 to "removeHandler" of "Logger" has incompatible type "object"; expected "Handler" [arg-type]
+ apprise/logger.py:184: error: "object" has no attribute "close" [attr-defined]
+ apprise/conversion.py:68: error: "Type[URLBase]" has no attribute "escape_html" [attr-defined]
+ apprise/utils.py:56: error: Argument 1 to "module_from_spec" has incompatible type "Optional[ModuleSpec]"; expected "ModuleSpec" [arg-type]
+ apprise/utils.py:59: error: Item "None" of "Optional[ModuleSpec]" has no attribute "loader" [union-attr]
+ apprise/utils.py:59: error: Item "None" of "Union[Loader, None, Any]" has no attribute "exec_module" [union-attr]
+ apprise/utils.py:547: error: Need type annotation for "result" [var-annotated]
+ apprise/utils.py:711: error: Unsupported target for indexed assignment ("object") [index]
+ apprise/utils.py:715: error: Incompatible types in assignment (expression has type "Union[str, Any, None]", variable has type "str") [assignment]
+ apprise/utils.py:725: error: "object" has no attribute "update" [attr-defined]
+ apprise/utils.py:733: error: Unsupported target for indexed assignment ("object") [index]
+ apprise/utils.py:734: error: Unsupported target for indexed assignment ("object") [index]
+ apprise/utils.py:738: error: Value of type "object" is not indexable [index]
+ apprise/utils.py:740: error: Value of type "object" is not indexable [index]
+ apprise/utils.py:740: error: Unsupported target for indexed assignment ("object") [index]
+ apprise/utils.py:747: error: Value of type "object" is not indexable [index]
+ apprise/utils.py:750: error: Unsupported target for indexed assignment ("object") [index]
+ apprise/utils.py:753: error: "object" has no attribute "__delitem__" [attr-defined]
+ apprise/utils.py:757: error: Value of type "object" is not indexable [index]
+ apprise/utils.py:758: error: Unsupported target for indexed assignment ("object") [index]
+ apprise/utils.py:758: error: Item "None" of "Optional[Match[str]]" has no attribute "group" [union-attr]
+ apprise/utils.py:759: error: Unsupported target for indexed assignment ("object") [index]
+ apprise/utils.py:759: error: Item "None" of "Optional[Match[str]]" has no attribute "group" [union-attr]
+ apprise/utils.py:760: error: Value of type "object" is not indexable [index]
+ apprise/utils.py:762: error: Unsupported target for indexed assignment ("object") [index]
+ apprise/utils.py:764: error: "object" has no attribute "__delitem__" [attr-defined]
+ apprise/utils.py:767: error: Unsupported target for indexed assignment ("object") [index]
+ apprise/utils.py:768: error: Value of type "object" is not indexable [index]
+ apprise/utils.py:775: error: "object" has no attribute "get" [attr-defined]
+ apprise/utils.py:777: error: Unsupported target for indexed assignment ("object") [ind
... (truncated 47297 lines) ... |
Having
--check-untyped-defs
off by default is rather surprising behavior, since most people don't expect whether a function is annotated to change whether mypy checks that function. See #11201 and #3948 (comment) for previous discussions of this.I'm mainly creating this to see what mypy_primer says about the impact of changing the default and if there are other changes we can make to reduce the number of new errors. I haven't looked at whether the test suite passes yet.
Test Plan
I made sure
mypy --check-untyped-defs
,mypy --no-check-untyped-defs
, andmypy --strict
all behaved the same as before, and mypy with no options reported errors in untyped functions. I also looked at themypy --help
output and made sure it seemed reasonable.