Make collections.abcs more consistent with runtime implementation
Interested to see how much breakage primer reports.
refs: python/typing#1480
Diff from mypy_primer, showing the effect of this PR on open source code:
pandas (https://github.com/pandas-dev/pandas)
+ pandas/core/indexes/multi.py:3867: error: Only @runtime_checkable protocols can be used with instance and class checks [misc]
pydantic (https://github.com/samuelcolvin/pydantic)
+ pydantic/v1/fields.py:952: error: Only @runtime_checkable protocols can be used with instance and class checks [misc]
websockets (https://github.com/aaugustin/websockets)
+ src/websockets/http11.py:112: error: Function does not return a value [func-returns-value]
+ src/websockets/http11.py:117: error: "None" has no attribute "split" [attr-defined]
+ src/websockets/http11.py:119: error: Argument 1 to "d" has incompatible type "None"; expected "bytes" [arg-type]
+ src/websockets/http11.py:127: error: Function does not return a value [func-returns-value]
+ src/websockets/http11.py:131: error: Unsupported right operand type for in ("None") [operator]
+ src/websockets/http11.py:134: error: Unsupported right operand type for in ("None") [operator]
+ src/websockets/http11.py:137: error: Argument 2 to "Request" has incompatible type "None"; expected "Headers" [arg-type]
+ src/websockets/http11.py:213: error: Function does not return a value [func-returns-value]
+ src/websockets/http11.py:218: error: "None" has no attribute "split" [attr-defined]
+ src/websockets/http11.py:220: error: Argument 1 to "d" has incompatible type "None"; expected "bytes" [arg-type]
+ src/websockets/http11.py:236: error: Function does not return a value [func-returns-value]
+ src/websockets/http11.py:240: error: Unsupported right operand type for in ("None") [operator]
+ src/websockets/http11.py:253: error: Value of type "None" is not indexable [index]
+ src/websockets/http11.py:261: error: Function does not return a value [func-returns-value]
+ src/websockets/http11.py:271: error: Function does not return a value [func-returns-value]
+ src/websockets/http11.py:273: error: Argument 3 to "Response" has incompatible type "None"; expected "Headers" [arg-type]
+ src/websockets/http11.py:314: error: Function does not return a value [func-returns-value]
+ src/websockets/http11.py:321: error: "None" has no attribute "split" [attr-defined]
+ src/websockets/http11.py:323: error: Argument 1 to "d" has incompatible type "None"; expected "bytes" [arg-type]
+ src/websockets/http11.py:358: error: Function does not return a value [func-returns-value]
+ src/websockets/http11.py:362: error: "None" has no attribute "endswith" [attr-defined]
+ src/websockets/http11.py:364: error: Returning Any from function declared to return "bytes" [no-any-return]
+ src/websockets/http11.py:364: error: Value of type "None" is not indexable [index]
+ src/websockets/frames.py:226: error: Function does not return a value [func-returns-value]
+ src/websockets/frames.py:227: error: Argument 2 to "unpack" has incompatible type "None"; expected "Buffer" [arg-type]
+ src/websockets/frames.py:245: error: Function does not return a value [func-returns-value]
+ src/websockets/frames.py:246: error: Argument 2 to "unpack" has incompatible type "None"; expected "Buffer" [arg-type]
+ src/websockets/frames.py:248: error: Function does not return a value [func-returns-value]
+ src/websockets/frames.py:249: error: Argument 2 to "unpack" has incompatible type "None"; expected "Buffer" [arg-type]
+ src/websockets/frames.py:255: error: Function does not return a value [func-returns-value]
+ src/websockets/frames.py:258: error: Function does not return a value [func-returns-value]
+ src/websockets/frames.py:260: error: Argument 1 to "apply_mask" has incompatible type "None"; expected "bytes" [arg-type]
+ src/websockets/frames.py:260: error: Argument 2 to "apply_mask" has incompatible type "None"; expected "bytes" [arg-type]
+ src/websockets/frames.py:262: error: Argument 2 to "Frame" has incompatible type "bytes | None"; expected "bytes" [arg-type]
+ src/websockets/protocol.py:521: error: Function does not return a value [func-returns-value]
+ src/websockets/protocol.py:540: error: Function does not return a value [func-returns-value]
+ src/websockets/protocol.py:550: error: Argument 1 to "recv_frame" of "Protocol" has incompatible type "None"; expected "Frame" [arg-type]
+ src/websockets/protocol.py:594: error: Function does not return a value [func-returns-value]
+ src/websockets/server.py:553: error: Function does not return a value [func-returns-value]
+ src/websockets/server.py:564: error: "None" has no attribute "path" [attr-defined]
+ src/websockets/server.py:565: error: "None" has no attribute "headers" [attr-defined]
+ src/websockets/server.py:568: error: Argument 1 to "append" of "list" has incompatible type "None"; expected "Request | Response | Frame" [arg-type]
+ src/websockets/client.py:318: error: Function does not return a value [func-returns-value]
+ src/websockets/client.py:330: error: "None" has no attribute "status_code" [attr-defined]
+ src/websockets/client.py:330: error: "None" has no attribute "reason_phrase" [attr-defined]
+ src/websockets/client.py:332: error: "None" has no attribute "headers" [attr-defined]
+ src/websockets/client.py:334: error: "None" has no attribute "body" [attr-defined]
+ src/websockets/client.py:335: error: "None" has no attribute "body" [attr-defined]
+ src/websockets/client.py:338: error: Argument 1 to "process_response" of "ClientProtocol" has incompatible type "None"; expected "Response" [arg-type]
+ src/websockets/client.py:340: error: "None" has no attribute "_exception" [attr-defined]
+ src/websockets/client.py:341: error: Argument 1 to "append" of "list" has incompatible type "None"; expected "Request | Response | Frame" [arg-type]
+ src/websockets/client.py:349: error: Argument 1 to "append" of "list" has incompatible type "None"; expected "Request | Response | Frame" [arg-type]
ignite (https://github.com/pytorch/ignite)
+ ignite/engine/engine.py:973: error: Function does not return a value [func-returns-value]
+ ignite/engine/engine.py:973: error: Unsupported operand types for + ("float" and "None") [operator]
psycopg (https://github.com/psycopg/psycopg)
+ psycopg/psycopg/transaction.py:114: error: Function does not return a value [func-returns-value]
+ psycopg/psycopg/transaction.py:114: error: Incompatible return value type (got "None", expected "bool") [return-value]
+ psycopg/psycopg/generators.py:102: error: Function does not return a value [func-returns-value]
+ psycopg/psycopg/generators.py:103: error: Incompatible return value type (got "None", expected "list[PGresult]") [return-value]
+ psycopg/psycopg/generators.py:141: error: Function does not return a value [func-returns-value]
+ psycopg/psycopg/generators.py:274: error: Function does not return a value [func-returns-value]
+ psycopg/psycopg/generators.py:275: error: Argument 1 to "len" has incompatible type "None"; expected "Sized" [arg-type]
+ psycopg/psycopg/generators.py:278: error: Value of type "None" is not indexable [index]
+ psycopg/psycopg/generators.py:283: error: Returning Any from function declared to return "memoryview | PGresult" [no-any-return]
+ psycopg/psycopg/generators.py:310: error: Function does not return a value [func-returns-value]
+ psycopg/psycopg/generators.py:310: error: "None" object is not iterable [misc]
+ psycopg/psycopg/generators.py:311: error: Cannot determine type of "result" [has-type]
+ psycopg/psycopg/generators.py:313: error: Cannot determine type of "result" [has-type]
+ psycopg/psycopg/generators.py:315: error: Returning Any from function declared to return "PGresult" [no-any-return]
+ psycopg/psycopg/generators.py:315: error: Cannot determine type of "result" [has-type]
+ psycopg/psycopg/copy.py:156: error: Function does not return a value [func-returns-value]
+ psycopg/psycopg/copy.py:167: error: "None" has no attribute "command_tuples" [attr-defined]
+ psycopg/psycopg/copy.py:172: error: Function does not return a value [func-returns-value]
+ psycopg/psycopg/copy.py:200: error: Function does not return a value [func-returns-value]
+ psycopg/psycopg/_pipeline.py:142: error: Function does not return a value [func-returns-value]
+ psycopg/psycopg/_pipeline.py:144: error: "None" has no attribute "__iter__" (not iterable) [attr-defined]
+ psycopg/psycopg/_pipeline.py:172: error: Function does not return a value [func-returns-value]
+ psycopg/psycopg/cursor.py:289: error: Function does not return a value [func-returns-value]
+ psycopg/psycopg/cursor.py:289: error: "None" object is not iterable [misc]
+ psycopg/psycopg/cursor.py:290: error: Cannot determine type of "result" [has-type]
+ psycopg/psycopg/cursor.py:291: error: Cannot determine type of "result" [has-type]
+ psycopg/psycopg/cursor.py:308: error: Function does not return a value [func-returns-value]
+ psycopg/psycopg/cursor.py:311: error: Argument 4 to "validate" of "PrepareManager" has incompatible type "None"; expected "Sequence[PGresult]" [arg-type]
+ psycopg/psycopg/cursor.py:313: error: Argument 1 to "_check_results" of "BaseCursor" has incompatible type "None"; expected "list[PGresult]" [arg-type]
+ psycopg/psycopg/cursor.py:314: error: Argument 1 to "_set_results" of "BaseCursor" has incompatible type "None"; expected "list[PGresult]" [arg-type]
+ psycopg/psycopg/cursor.py:337: error: Function does not return a value [func-returns-value]
+ psycopg/psycopg/cursor.py:399: error: Function does not return a value [func-returns-value]
+ psycopg/psycopg/cursor.py:400: error: Argument 1 to "len" has incompatible type "None"; expected "Sized" [arg-type]
+ psycopg/psycopg/cursor.py:403: error: Value of type "None" is not indexable [index]
+ psycopg/psycopg/cursor.py:404: error: Argument 1 to "_set_results" of "BaseCursor" has incompatible type "None"; expected "list[PGresult]" [arg-type]
+ psycopg/psycopg/server_cursor.py:113: error: Function does not return a value [func-returns-value]
+ psycopg/psycopg/server_cursor.py:114: error: Value of type "None" is not indexable [index]
+ psycopg/psycopg/server_cursor.py:115: error: Value of type "None" is not indexable [index]
+ psycopg/psycopg/server_cursor.py:128: error: Function does not return a value [func-returns-value]
+ psycopg/psycopg/server_cursor.py:129: error: Argument 1 to "_check_results" of "BaseCursor" has incompatible type "None"; expected "list[PGresult]" [arg-type]
+ psycopg/psycopg/server_cursor.py:130: error: Incompatible types in assignment (expression has type "None", variable has type "list[PGresult]") [assignment]
+ psycopg/psycopg/server_cursor.py:151: error: Function does not return a value [func-returns-value]
+ psycopg/psycopg/server_cursor.py:172: error: Function does not return a value [func-returns-value]
+ psycopg/psycopg/connection.py:439: error: Function does not return a value [func-returns-value]
+ psycopg/psycopg/connection.py:440: error: Argument 1 to "BaseConnection" has incompatible type "None"; expected "PGconn" [arg-type]
+ psycopg/psycopg/connection.py:473: error: Value of type "None" is not indexable [index]
+ psycopg/psycopg/connection.py:473: error: Function does not return a value [func-returns-value]
+ psycopg/psycopg/connection.py:482: error: Returning Any from function declared to return "PGresult | None" [no-any-return]
kopf (https://github.com/nolar/kopf)
+ kopf/_kits/webhacks.py:86: error: Only @runtime_checkable protocols can be used with instance and class checks [misc]
+ kopf/_kits/webhacks.py:90: error: Only @runtime_checkable protocols can be used with instance and class checks [misc]
tornado (https://github.com/tornadoweb/tornado)
+ tornado/gen.py:227: error: Only @runtime_checkable protocols can be used with instance and class checks [misc]
+ tornado/testing.py:103: error: Only @runtime_checkable protocols can be used with instance and class checks [misc]
+ tornado/testing.py:605: error: Only @runtime_checkable protocols can be used with instance and class checks [misc]
scikit-learn (https://github.com/scikit-learn/scikit-learn)
+ sklearn/datasets/_arff_parser.py:241: error: Only @runtime_checkable protocols can be used with instance and class checks [misc]
spark (https://github.com/apache/spark)
+ python/pyspark/sql/connect/client/core.py:1144: error: Cannot instantiate abstract class "ExecutePlanResponseReattachableIterator" with abstract attribute "__next__" [abstract]
+ python/pyspark/sql/connect/client/core.py:1229: error: Cannot instantiate abstract class "ExecutePlanResponseReattachableIterator" with abstract attribute "__next__" [abstract]
mitmproxy (https://github.com/mitmproxy/mitmproxy)
+ mitmproxy/proxy/tunnel.py:70: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/tunnel.py:70: error: "None" object is not iterable [misc]
+ mitmproxy/proxy/tunnel.py:71: error: Cannot determine type of "done" [has-type]
+ mitmproxy/proxy/tunnel.py:75: error: Cannot determine type of "err" [has-type]
+ mitmproxy/proxy/tunnel.py:79: error: Cannot determine type of "err" [has-type]
+ mitmproxy/proxy/tunnel.py:80: error: Cannot determine type of "done" [has-type]
+ mitmproxy/proxy/tunnel.py:80: error: Cannot determine type of "err" [has-type]
+ mitmproxy/proxy/tunnel.py:81: error: Cannot determine type of "err" [has-type]
+ mitmproxy/proxy/layers/modes.py:84: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/modes.py:94: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/modes.py:289: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/tls.py:541: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/tls.py:541: error: Incompatible return value type (got "None", expected "tuple[bool, str | None]") [return-value]
+ mitmproxy/proxy/layers/tls.py:585: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/tls.py:598: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/tls.py:600: error: Incompatible return value type (got "None", expected "tuple[bool, str | None]") [return-value]
+ mitmproxy/proxy/layers/http/_upstream_proxy.py:78: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/http/_upstream_proxy.py:78: error: Incompatible return value type (got "None", expected "tuple[bool, str | None]") [return-value]
+ mitmproxy/proxy/layers/quic.py:1147: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/quic.py:1147: error: Incompatible return value type (got "None", expected "tuple[bool, str | None]") [return-value]
+ mitmproxy/proxy/layers/quic.py:1225: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/quic.py:1241: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/quic.py:1241: error: Incompatible return value type (got "None", expected "tuple[bool, str | None]") [return-value]
+ mitmproxy/proxy/layers/http/_http3.py:71: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/http/_http2.py:187: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/http/_http2.py:392: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/http/_http2.py:437: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/http/_http2.py:437: error: Incompatible return value type (got "None", expected "bool") [return-value]
+ mitmproxy/proxy/layers/http/_http2.py:538: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/http/_http2.py:601: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/http/_http2.py:601: error: Incompatible return value type (got "None", expected "bool") [return-value]
+ mitmproxy/proxy/layers/http/_http2.py:603: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/http/_http2.py:603: error: Incompatible return value type (got "None", expected "bool") [return-value]
+ mitmproxy/proxy/layers/http/__init__.py:263: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/http/__init__.py:267: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/http/__init__.py:289: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/http/__init__.py:359: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/http/__init__.py:366: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/http/__init__.py:370: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/http/__init__.py:399: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/http/__init__.py:403: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/http/__init__.py:485: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/http/__init__.py:675: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/http/__init__.py:704: error: Function does not return a value [func-returns-value]
httpx-caching (https://github.com/johtso/httpx-caching)
+ httpx_caching/_policy.py:126: error: Function does not return a value [func-returns-value]
+ httpx_caching/_policy.py:126: error: "None" object is not iterable [misc]
+ httpx_caching/_policy.py:129: error: Cannot determine type of "evaluation" [has-type]
+ httpx_caching/_policy.py:130: error: Cannot determine type of "cached_response" [has-type]
+ httpx_caching/_policy.py:130: error: Cannot determine type of "evaluation" [has-type]
+ httpx_caching/_policy.py:131: error: Cannot determine type of "cached_response" [has-type]
+ httpx_caching/_policy.py:133: error: Function does not return a value [func-returns-value]
+ httpx_caching/_policy.py:133: error: "None" object is not iterable [misc]
+ httpx_caching/_policy.py:135: error: Cannot determine type of "cached_response" [has-type]
+ httpx_caching/_policy.py:141: error: Cannot determine type of "response" [has-type]
+ httpx_caching/_policy.py:141: error: Cannot determine type of "source" [has-type]
scrapy (https://github.com/scrapy/scrapy)
+ scrapy/contracts/__init__.py:42: error: Only @runtime_checkable protocols can be used with instance and class checks [misc]
+ scrapy/contracts/__init__.py:57: error: Only @runtime_checkable protocols can be used with instance and class checks [misc]
aiohttp (https://github.com/aio-libs/aiohttp)
+ aiohttp/client.py:321:16: error: Cannot instantiate abstract class "_RequestContextManager" with abstract attributes "__name__" and "__qualname__" [abstract]
+ aiohttp/client.py:321:16: note: See https://mypy.rtfd.io/en/stable/_refs.html#code-abstract for more info
+ aiohttp/client.py:692:16: error: Cannot instantiate abstract class "_WSRequestContextManager" with abstract attributes "__name__" and "__qualname__" [abstract]
+ aiohttp/client.py:935:16: error: Cannot instantiate abstract class "_RequestContextManager" with abstract attributes "__name__" and "__qualname__" [abstract]
+ aiohttp/client.py:943:16: error: Cannot instantiate abstract class "_RequestContextManager" with abstract attributes "__name__" and "__qualname__" [abstract]
+ aiohttp/client.py:953:16: error: Cannot instantiate abstract class "_RequestContextManager" with abstract attributes "__name__" and "__qualname__" [abstract]
+ aiohttp/client.py:963:16: error: Cannot instantiate abstract class "_RequestContextManager" with abstract attributes "__name__" and "__qualname__" [abstract]
+ aiohttp/client.py:971:16: error: Cannot instantiate abstract class "_RequestContextManager" with abstract attributes "__name__" and "__qualname__" [abstract]
+ aiohttp/client.py:979:16: error: Cannot instantiate abstract class "_RequestContextManager" with abstract attributes "__name__" and "__qualname__" [abstract]
+ aiohttp/client.py:985:16: error: Cannot instantiate abstract class "_RequestContextManager" with abstract attributes "__name__" and "__qualname__" [abstract]
+ aiohttp/test_utils.py:324:16: error: Cannot instantiate abstract class "_RequestContextManager" with abstract attributes "__name__" and "__qualname__" [abstract]
+ aiohttp/test_utils.py:328:16: error: Cannot instantiate abstract class "_RequestContextManager" with abstract attributes "__name__" and "__qualname__" [abstract]
+ aiohttp/test_utils.py:332:16: error: Cannot instantiate abstract class "_RequestContextManager" with abstract attributes "__name__" and "__qualname__" [abstract]
+ aiohttp/test_utils.py:336:16: error: Cannot instantiate abstract class "_RequestContextManager" with abstract attributes "__name__" and "__qualname__" [abstract]
+ aiohttp/test_utils.py:340:16: error: Cannot instantiate abstract class "_RequestContextManager" with abstract attributes "__name__" and "__qualname__" [abstract]
+ aiohttp/test_utils.py:344:16: error: Cannot instantiate abstract class "_RequestContextManager" with abstract attributes "__name__" and "__qualname__" [abstract]
+ aiohttp/test_utils.py:348:16: error: Cannot instantiate abstract class "_RequestContextManager" with abstract attributes "__name__" and "__qualname__" [abstract]
+ aiohttp/test_utils.py:352:16: error: Cannot instantiate abstract class "_RequestContextManager" with abstract attributes "__name__" and "__qualname__" [abstract]
+ aiohttp/test_utils.py:360:16: error: Cannot instantiate abstract class "_WSRequestContextManager" with abstract attributes "__name__" and "__qualname__" [abstract]
Diff from mypy_primer, showing the effect of this PR on open source code:
websockets (https://github.com/aaugustin/websockets)
+ src/websockets/http11.py:112: error: Function does not return a value [func-returns-value]
+ src/websockets/http11.py:117: error: "None" has no attribute "split" [attr-defined]
+ src/websockets/http11.py:119: error: Argument 1 to "d" has incompatible type "None"; expected "bytes" [arg-type]
+ src/websockets/http11.py:127: error: Function does not return a value [func-returns-value]
+ src/websockets/http11.py:131: error: Unsupported right operand type for in ("None") [operator]
+ src/websockets/http11.py:134: error: Unsupported right operand type for in ("None") [operator]
+ src/websockets/http11.py:137: error: Argument 2 to "Request" has incompatible type "None"; expected "Headers" [arg-type]
+ src/websockets/http11.py:213: error: Function does not return a value [func-returns-value]
+ src/websockets/http11.py:218: error: "None" has no attribute "split" [attr-defined]
+ src/websockets/http11.py:220: error: Argument 1 to "d" has incompatible type "None"; expected "bytes" [arg-type]
+ src/websockets/http11.py:236: error: Function does not return a value [func-returns-value]
+ src/websockets/http11.py:240: error: Unsupported right operand type for in ("None") [operator]
+ src/websockets/http11.py:253: error: Value of type "None" is not indexable [index]
+ src/websockets/http11.py:261: error: Function does not return a value [func-returns-value]
+ src/websockets/http11.py:271: error: Function does not return a value [func-returns-value]
+ src/websockets/http11.py:273: error: Argument 3 to "Response" has incompatible type "None"; expected "Headers" [arg-type]
+ src/websockets/http11.py:314: error: Function does not return a value [func-returns-value]
+ src/websockets/http11.py:321: error: "None" has no attribute "split" [attr-defined]
+ src/websockets/http11.py:323: error: Argument 1 to "d" has incompatible type "None"; expected "bytes" [arg-type]
+ src/websockets/http11.py:358: error: Function does not return a value [func-returns-value]
+ src/websockets/http11.py:362: error: "None" has no attribute "endswith" [attr-defined]
+ src/websockets/http11.py:364: error: Returning Any from function declared to return "bytes" [no-any-return]
+ src/websockets/http11.py:364: error: Value of type "None" is not indexable [index]
+ src/websockets/frames.py:226: error: Function does not return a value [func-returns-value]
+ src/websockets/frames.py:227: error: Argument 2 to "unpack" has incompatible type "None"; expected "Buffer" [arg-type]
+ src/websockets/frames.py:245: error: Function does not return a value [func-returns-value]
+ src/websockets/frames.py:246: error: Argument 2 to "unpack" has incompatible type "None"; expected "Buffer" [arg-type]
+ src/websockets/frames.py:248: error: Function does not return a value [func-returns-value]
+ src/websockets/frames.py:249: error: Argument 2 to "unpack" has incompatible type "None"; expected "Buffer" [arg-type]
+ src/websockets/frames.py:255: error: Function does not return a value [func-returns-value]
+ src/websockets/frames.py:258: error: Function does not return a value [func-returns-value]
+ src/websockets/frames.py:260: error: Argument 1 to "apply_mask" has incompatible type "None"; expected "bytes" [arg-type]
+ src/websockets/frames.py:260: error: Argument 2 to "apply_mask" has incompatible type "None"; expected "bytes" [arg-type]
+ src/websockets/frames.py:262: error: Argument 2 to "Frame" has incompatible type "bytes | None"; expected "bytes" [arg-type]
+ src/websockets/protocol.py:521: error: Function does not return a value [func-returns-value]
+ src/websockets/protocol.py:540: error: Function does not return a value [func-returns-value]
+ src/websockets/protocol.py:550: error: Argument 1 to "recv_frame" of "Protocol" has incompatible type "None"; expected "Frame" [arg-type]
+ src/websockets/protocol.py:594: error: Function does not return a value [func-returns-value]
+ src/websockets/server.py:553: error: Function does not return a value [func-returns-value]
+ src/websockets/server.py:564: error: "None" has no attribute "path" [attr-defined]
+ src/websockets/server.py:565: error: "None" has no attribute "headers" [attr-defined]
+ src/websockets/server.py:568: error: Argument 1 to "append" of "list" has incompatible type "None"; expected "Request | Response | Frame" [arg-type]
+ src/websockets/client.py:318: error: Function does not return a value [func-returns-value]
+ src/websockets/client.py:330: error: "None" has no attribute "status_code" [attr-defined]
+ src/websockets/client.py:330: error: "None" has no attribute "reason_phrase" [attr-defined]
+ src/websockets/client.py:332: error: "None" has no attribute "headers" [attr-defined]
+ src/websockets/client.py:334: error: "None" has no attribute "body" [attr-defined]
+ src/websockets/client.py:335: error: "None" has no attribute "body" [attr-defined]
+ src/websockets/client.py:338: error: Argument 1 to "process_response" of "ClientProtocol" has incompatible type "None"; expected "Response" [arg-type]
+ src/websockets/client.py:340: error: "None" has no attribute "_exception" [attr-defined]
+ src/websockets/client.py:341: error: Argument 1 to "append" of "list" has incompatible type "None"; expected "Request | Response | Frame" [arg-type]
+ src/websockets/client.py:349: error: Argument 1 to "append" of "list" has incompatible type "None"; expected "Request | Response | Frame" [arg-type]
ignite (https://github.com/pytorch/ignite)
+ ignite/engine/engine.py:973: error: Function does not return a value [func-returns-value]
+ ignite/engine/engine.py:973: error: Unsupported operand types for + ("float" and "None") [operator]
psycopg (https://github.com/psycopg/psycopg)
+ psycopg/psycopg/transaction.py:114: error: Function does not return a value [func-returns-value]
+ psycopg/psycopg/transaction.py:114: error: Incompatible return value type (got "None", expected "bool") [return-value]
+ psycopg/psycopg/generators.py:102: error: Function does not return a value [func-returns-value]
+ psycopg/psycopg/generators.py:103: error: Incompatible return value type (got "None", expected "list[PGresult]") [return-value]
+ psycopg/psycopg/generators.py:141: error: Function does not return a value [func-returns-value]
+ psycopg/psycopg/generators.py:274: error: Function does not return a value [func-returns-value]
+ psycopg/psycopg/generators.py:275: error: Argument 1 to "len" has incompatible type "None"; expected "Sized" [arg-type]
+ psycopg/psycopg/generators.py:278: error: Value of type "None" is not indexable [index]
+ psycopg/psycopg/generators.py:283: error: Returning Any from function declared to return "memoryview | PGresult" [no-any-return]
+ psycopg/psycopg/generators.py:310: error: Function does not return a value [func-returns-value]
+ psycopg/psycopg/generators.py:310: error: "None" object is not iterable [misc]
+ psycopg/psycopg/generators.py:311: error: Cannot determine type of "result" [has-type]
+ psycopg/psycopg/generators.py:313: error: Cannot determine type of "result" [has-type]
+ psycopg/psycopg/generators.py:315: error: Returning Any from function declared to return "PGresult" [no-any-return]
+ psycopg/psycopg/generators.py:315: error: Cannot determine type of "result" [has-type]
+ psycopg/psycopg/copy.py:156: error: Function does not return a value [func-returns-value]
+ psycopg/psycopg/copy.py:167: error: "None" has no attribute "command_tuples" [attr-defined]
+ psycopg/psycopg/copy.py:172: error: Function does not return a value [func-returns-value]
+ psycopg/psycopg/copy.py:200: error: Function does not return a value [func-returns-value]
+ psycopg/psycopg/_pipeline.py:142: error: Function does not return a value [func-returns-value]
+ psycopg/psycopg/_pipeline.py:144: error: "None" has no attribute "__iter__" (not iterable) [attr-defined]
+ psycopg/psycopg/_pipeline.py:172: error: Function does not return a value [func-returns-value]
+ psycopg/psycopg/cursor.py:289: error: Function does not return a value [func-returns-value]
+ psycopg/psycopg/cursor.py:289: error: "None" object is not iterable [misc]
+ psycopg/psycopg/cursor.py:290: error: Cannot determine type of "result" [has-type]
+ psycopg/psycopg/cursor.py:291: error: Cannot determine type of "result" [has-type]
+ psycopg/psycopg/cursor.py:308: error: Function does not return a value [func-returns-value]
+ psycopg/psycopg/cursor.py:311: error: Argument 4 to "validate" of "PrepareManager" has incompatible type "None"; expected "Sequence[PGresult]" [arg-type]
+ psycopg/psycopg/cursor.py:313: error: Argument 1 to "_check_results" of "BaseCursor" has incompatible type "None"; expected "list[PGresult]" [arg-type]
+ psycopg/psycopg/cursor.py:314: error: Argument 1 to "_set_results" of "BaseCursor" has incompatible type "None"; expected "list[PGresult]" [arg-type]
+ psycopg/psycopg/cursor.py:337: error: Function does not return a value [func-returns-value]
+ psycopg/psycopg/cursor.py:399: error: Function does not return a value [func-returns-value]
+ psycopg/psycopg/cursor.py:400: error: Argument 1 to "len" has incompatible type "None"; expected "Sized" [arg-type]
+ psycopg/psycopg/cursor.py:403: error: Value of type "None" is not indexable [index]
+ psycopg/psycopg/cursor.py:404: error: Argument 1 to "_set_results" of "BaseCursor" has incompatible type "None"; expected "list[PGresult]" [arg-type]
+ psycopg/psycopg/server_cursor.py:113: error: Function does not return a value [func-returns-value]
+ psycopg/psycopg/server_cursor.py:114: error: Value of type "None" is not indexable [index]
+ psycopg/psycopg/server_cursor.py:115: error: Value of type "None" is not indexable [index]
+ psycopg/psycopg/server_cursor.py:128: error: Function does not return a value [func-returns-value]
+ psycopg/psycopg/server_cursor.py:129: error: Argument 1 to "_check_results" of "BaseCursor" has incompatible type "None"; expected "list[PGresult]" [arg-type]
+ psycopg/psycopg/server_cursor.py:130: error: Incompatible types in assignment (expression has type "None", variable has type "list[PGresult]") [assignment]
+ psycopg/psycopg/server_cursor.py:151: error: Function does not return a value [func-returns-value]
+ psycopg/psycopg/server_cursor.py:172: error: Function does not return a value [func-returns-value]
+ psycopg/psycopg/connection.py:439: error: Function does not return a value [func-returns-value]
+ psycopg/psycopg/connection.py:440: error: Argument 1 to "BaseConnection" has incompatible type "None"; expected "PGconn" [arg-type]
+ psycopg/psycopg/connection.py:473: error: Value of type "None" is not indexable [index]
+ psycopg/psycopg/connection.py:473: error: Function does not return a value [func-returns-value]
+ psycopg/psycopg/connection.py:482: error: Returning Any from function declared to return "PGresult | None" [no-any-return]
spark (https://github.com/apache/spark)
+ python/pyspark/sql/connect/client/core.py:1144: error: Cannot instantiate abstract class "ExecutePlanResponseReattachableIterator" with abstract attribute "__next__" [abstract]
+ python/pyspark/sql/connect/client/core.py:1229: error: Cannot instantiate abstract class "ExecutePlanResponseReattachableIterator" with abstract attribute "__next__" [abstract]
mitmproxy (https://github.com/mitmproxy/mitmproxy)
+ mitmproxy/proxy/tunnel.py:70: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/tunnel.py:70: error: "None" object is not iterable [misc]
+ mitmproxy/proxy/tunnel.py:71: error: Cannot determine type of "done" [has-type]
+ mitmproxy/proxy/tunnel.py:75: error: Cannot determine type of "err" [has-type]
+ mitmproxy/proxy/tunnel.py:79: error: Cannot determine type of "err" [has-type]
+ mitmproxy/proxy/tunnel.py:80: error: Cannot determine type of "done" [has-type]
+ mitmproxy/proxy/tunnel.py:80: error: Cannot determine type of "err" [has-type]
+ mitmproxy/proxy/tunnel.py:81: error: Cannot determine type of "err" [has-type]
+ mitmproxy/proxy/layers/modes.py:84: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/modes.py:94: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/modes.py:289: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/tls.py:541: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/tls.py:541: error: Incompatible return value type (got "None", expected "tuple[bool, str | None]") [return-value]
+ mitmproxy/proxy/layers/tls.py:585: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/tls.py:598: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/tls.py:600: error: Incompatible return value type (got "None", expected "tuple[bool, str | None]") [return-value]
+ mitmproxy/proxy/layers/http/_upstream_proxy.py:78: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/http/_upstream_proxy.py:78: error: Incompatible return value type (got "None", expected "tuple[bool, str | None]") [return-value]
+ mitmproxy/proxy/layers/quic.py:1147: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/quic.py:1147: error: Incompatible return value type (got "None", expected "tuple[bool, str | None]") [return-value]
+ mitmproxy/proxy/layers/quic.py:1225: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/quic.py:1241: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/quic.py:1241: error: Incompatible return value type (got "None", expected "tuple[bool, str | None]") [return-value]
+ mitmproxy/proxy/layers/http/_http3.py:71: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/http/_http2.py:187: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/http/_http2.py:392: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/http/_http2.py:437: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/http/_http2.py:437: error: Incompatible return value type (got "None", expected "bool") [return-value]
+ mitmproxy/proxy/layers/http/_http2.py:538: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/http/_http2.py:601: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/http/_http2.py:601: error: Incompatible return value type (got "None", expected "bool") [return-value]
+ mitmproxy/proxy/layers/http/_http2.py:603: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/http/_http2.py:603: error: Incompatible return value type (got "None", expected "bool") [return-value]
+ mitmproxy/proxy/layers/http/__init__.py:263: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/http/__init__.py:267: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/http/__init__.py:289: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/http/__init__.py:359: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/http/__init__.py:366: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/http/__init__.py:370: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/http/__init__.py:399: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/http/__init__.py:403: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/http/__init__.py:485: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/http/__init__.py:675: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/http/__init__.py:704: error: Function does not return a value [func-returns-value]
httpx-caching (https://github.com/johtso/httpx-caching)
+ httpx_caching/_policy.py:126: error: Function does not return a value [func-returns-value]
+ httpx_caching/_policy.py:126: error: "None" object is not iterable [misc]
+ httpx_caching/_policy.py:129: error: Cannot determine type of "evaluation" [has-type]
+ httpx_caching/_policy.py:130: error: Cannot determine type of "cached_response" [has-type]
+ httpx_caching/_policy.py:130: error: Cannot determine type of "evaluation" [has-type]
+ httpx_caching/_policy.py:131: error: Cannot determine type of "cached_response" [has-type]
+ httpx_caching/_policy.py:133: error: Function does not return a value [func-returns-value]
+ httpx_caching/_policy.py:133: error: "None" object is not iterable [misc]
+ httpx_caching/_policy.py:135: error: Cannot determine type of "cached_response" [has-type]
+ httpx_caching/_policy.py:141: error: Cannot determine type of "response" [has-type]
+ httpx_caching/_policy.py:141: error: Cannot determine type of "source" [has-type]
aiohttp (https://github.com/aio-libs/aiohttp)
+ aiohttp/client.py:321:16: error: Cannot instantiate abstract class "_RequestContextManager" with abstract attributes "__name__" and "__qualname__" [abstract]
+ aiohttp/client.py:321:16: note: See https://mypy.rtfd.io/en/stable/_refs.html#code-abstract for more info
+ aiohttp/client.py:692:16: error: Cannot instantiate abstract class "_WSRequestContextManager" with abstract attributes "__name__" and "__qualname__" [abstract]
+ aiohttp/client.py:935:16: error: Cannot instantiate abstract class "_RequestContextManager" with abstract attributes "__name__" and "__qualname__" [abstract]
+ aiohttp/client.py:943:16: error: Cannot instantiate abstract class "_RequestContextManager" with abstract attributes "__name__" and "__qualname__" [abstract]
+ aiohttp/client.py:953:16: error: Cannot instantiate abstract class "_RequestContextManager" with abstract attributes "__name__" and "__qualname__" [abstract]
+ aiohttp/client.py:963:16: error: Cannot instantiate abstract class "_RequestContextManager" with abstract attributes "__name__" and "__qualname__" [abstract]
+ aiohttp/client.py:971:16: error: Cannot instantiate abstract class "_RequestContextManager" with abstract attributes "__name__" and "__qualname__" [abstract]
+ aiohttp/client.py:979:16: error: Cannot instantiate abstract class "_RequestContextManager" with abstract attributes "__name__" and "__qualname__" [abstract]
+ aiohttp/client.py:985:16: error: Cannot instantiate abstract class "_RequestContextManager" with abstract attributes "__name__" and "__qualname__" [abstract]
+ aiohttp/test_utils.py:324:16: error: Cannot instantiate abstract class "_RequestContextManager" with abstract attributes "__name__" and "__qualname__" [abstract]
+ aiohttp/test_utils.py:328:16: error: Cannot instantiate abstract class "_RequestContextManager" with abstract attributes "__name__" and "__qualname__" [abstract]
+ aiohttp/test_utils.py:332:16: error: Cannot instantiate abstract class "_RequestContextManager" with abstract attributes "__name__" and "__qualname__" [abstract]
+ aiohttp/test_utils.py:336:16: error: Cannot instantiate abstract class "_RequestContextManager" with abstract attributes "__name__" and "__qualname__" [abstract]
+ aiohttp/test_utils.py:340:16: error: Cannot instantiate abstract class "_RequestContextManager" with abstract attributes "__name__" and "__qualname__" [abstract]
+ aiohttp/test_utils.py:344:16: error: Cannot instantiate abstract class "_RequestContextManager" with abstract attributes "__name__" and "__qualname__" [abstract]
+ aiohttp/test_utils.py:348:16: error: Cannot instantiate abstract class "_RequestContextManager" with abstract attributes "__name__" and "__qualname__" [abstract]
+ aiohttp/test_utils.py:352:16: error: Cannot instantiate abstract class "_RequestContextManager" with abstract attributes "__name__" and "__qualname__" [abstract]
+ aiohttp/test_utils.py:360:16: error: Cannot instantiate abstract class "_WSRequestContextManager" with abstract attributes "__name__" and "__qualname__" [abstract]
Looking over these issues, all the aiohttp ones look like a mypy bug where it thinks that any annotated attribute is abstract the others hopefully might be easy enough fixes if you rename typing.Generator strings to types.GeneratorType, I'll see if a mypy PR can get rid of most of them. If that isn't possible would it be possible for mypy to selectively remove this commit?
Diff from mypy_primer, showing the effect of this PR on open source code:
websockets (https://github.com/aaugustin/websockets)
+ src/websockets/http11.py:112: error: Function does not return a value [func-returns-value]
+ src/websockets/http11.py:117: error: "None" has no attribute "split" [attr-defined]
+ src/websockets/http11.py:119: error: Argument 1 to "d" has incompatible type "None"; expected "bytes" [arg-type]
+ src/websockets/http11.py:127: error: Function does not return a value [func-returns-value]
+ src/websockets/http11.py:131: error: Unsupported right operand type for in ("None") [operator]
+ src/websockets/http11.py:134: error: Unsupported right operand type for in ("None") [operator]
+ src/websockets/http11.py:137: error: Argument 2 to "Request" has incompatible type "None"; expected "Headers" [arg-type]
+ src/websockets/http11.py:213: error: Function does not return a value [func-returns-value]
+ src/websockets/http11.py:218: error: "None" has no attribute "split" [attr-defined]
+ src/websockets/http11.py:220: error: Argument 1 to "d" has incompatible type "None"; expected "bytes" [arg-type]
+ src/websockets/http11.py:236: error: Function does not return a value [func-returns-value]
+ src/websockets/http11.py:240: error: Unsupported right operand type for in ("None") [operator]
+ src/websockets/http11.py:253: error: Value of type "None" is not indexable [index]
+ src/websockets/http11.py:261: error: Function does not return a value [func-returns-value]
+ src/websockets/http11.py:271: error: Function does not return a value [func-returns-value]
+ src/websockets/http11.py:273: error: Argument 3 to "Response" has incompatible type "None"; expected "Headers" [arg-type]
+ src/websockets/http11.py:314: error: Function does not return a value [func-returns-value]
+ src/websockets/http11.py:321: error: "None" has no attribute "split" [attr-defined]
+ src/websockets/http11.py:323: error: Argument 1 to "d" has incompatible type "None"; expected "bytes" [arg-type]
+ src/websockets/http11.py:358: error: Function does not return a value [func-returns-value]
+ src/websockets/http11.py:362: error: "None" has no attribute "endswith" [attr-defined]
+ src/websockets/http11.py:364: error: Returning Any from function declared to return "bytes" [no-any-return]
+ src/websockets/http11.py:364: error: Value of type "None" is not indexable [index]
+ src/websockets/frames.py:226: error: Function does not return a value [func-returns-value]
+ src/websockets/frames.py:227: error: Argument 2 to "unpack" has incompatible type "None"; expected "Buffer" [arg-type]
+ src/websockets/frames.py:245: error: Function does not return a value [func-returns-value]
+ src/websockets/frames.py:246: error: Argument 2 to "unpack" has incompatible type "None"; expected "Buffer" [arg-type]
+ src/websockets/frames.py:248: error: Function does not return a value [func-returns-value]
+ src/websockets/frames.py:249: error: Argument 2 to "unpack" has incompatible type "None"; expected "Buffer" [arg-type]
+ src/websockets/frames.py:255: error: Function does not return a value [func-returns-value]
+ src/websockets/frames.py:258: error: Function does not return a value [func-returns-value]
+ src/websockets/frames.py:260: error: Argument 1 to "apply_mask" has incompatible type "None"; expected "bytes" [arg-type]
+ src/websockets/frames.py:260: error: Argument 2 to "apply_mask" has incompatible type "None"; expected "bytes" [arg-type]
+ src/websockets/frames.py:262: error: Argument 2 to "Frame" has incompatible type "bytes | None"; expected "bytes" [arg-type]
+ src/websockets/protocol.py:521: error: Function does not return a value [func-returns-value]
+ src/websockets/protocol.py:540: error: Function does not return a value [func-returns-value]
+ src/websockets/protocol.py:550: error: Argument 1 to "recv_frame" of "Protocol" has incompatible type "None"; expected "Frame" [arg-type]
+ src/websockets/protocol.py:594: error: Function does not return a value [func-returns-value]
+ src/websockets/server.py:553: error: Function does not return a value [func-returns-value]
+ src/websockets/server.py:564: error: "None" has no attribute "path" [attr-defined]
+ src/websockets/server.py:565: error: "None" has no attribute "headers" [attr-defined]
+ src/websockets/server.py:568: error: Argument 1 to "append" of "list" has incompatible type "None"; expected "Request | Response | Frame" [arg-type]
+ src/websockets/client.py:318: error: Function does not return a value [func-returns-value]
+ src/websockets/client.py:330: error: "None" has no attribute "status_code" [attr-defined]
+ src/websockets/client.py:330: error: "None" has no attribute "reason_phrase" [attr-defined]
+ src/websockets/client.py:332: error: "None" has no attribute "headers" [attr-defined]
+ src/websockets/client.py:334: error: "None" has no attribute "body" [attr-defined]
+ src/websockets/client.py:335: error: "None" has no attribute "body" [attr-defined]
+ src/websockets/client.py:338: error: Argument 1 to "process_response" of "ClientProtocol" has incompatible type "None"; expected "Response" [arg-type]
+ src/websockets/client.py:340: error: "None" has no attribute "_exception" [attr-defined]
+ src/websockets/client.py:341: error: Argument 1 to "append" of "list" has incompatible type "None"; expected "Request | Response | Frame" [arg-type]
+ src/websockets/client.py:349: error: Argument 1 to "append" of "list" has incompatible type "None"; expected "Request | Response | Frame" [arg-type]
ignite (https://github.com/pytorch/ignite)
+ ignite/engine/engine.py:973: error: Function does not return a value [func-returns-value]
+ ignite/engine/engine.py:973: error: Unsupported operand types for + ("float" and "None") [operator]
psycopg (https://github.com/psycopg/psycopg)
+ psycopg/psycopg/transaction.py:114: error: Function does not return a value [func-returns-value]
+ psycopg/psycopg/transaction.py:114: error: Incompatible return value type (got "None", expected "bool") [return-value]
+ psycopg/psycopg/generators.py:102: error: Function does not return a value [func-returns-value]
+ psycopg/psycopg/generators.py:103: error: Incompatible return value type (got "None", expected "list[PGresult]") [return-value]
+ psycopg/psycopg/generators.py:141: error: Function does not return a value [func-returns-value]
+ psycopg/psycopg/generators.py:274: error: Function does not return a value [func-returns-value]
+ psycopg/psycopg/generators.py:275: error: Argument 1 to "len" has incompatible type "None"; expected "Sized" [arg-type]
+ psycopg/psycopg/generators.py:278: error: Value of type "None" is not indexable [index]
+ psycopg/psycopg/generators.py:283: error: Returning Any from function declared to return "memoryview | PGresult" [no-any-return]
+ psycopg/psycopg/generators.py:310: error: Function does not return a value [func-returns-value]
+ psycopg/psycopg/generators.py:310: error: "None" object is not iterable [misc]
+ psycopg/psycopg/generators.py:311: error: Cannot determine type of "result" [has-type]
+ psycopg/psycopg/generators.py:313: error: Cannot determine type of "result" [has-type]
+ psycopg/psycopg/generators.py:315: error: Returning Any from function declared to return "PGresult" [no-any-return]
+ psycopg/psycopg/generators.py:315: error: Cannot determine type of "result" [has-type]
+ psycopg/psycopg/copy.py:156: error: Function does not return a value [func-returns-value]
+ psycopg/psycopg/copy.py:167: error: "None" has no attribute "command_tuples" [attr-defined]
+ psycopg/psycopg/copy.py:172: error: Function does not return a value [func-returns-value]
+ psycopg/psycopg/copy.py:200: error: Function does not return a value [func-returns-value]
+ psycopg/psycopg/_pipeline.py:142: error: Function does not return a value [func-returns-value]
+ psycopg/psycopg/_pipeline.py:144: error: "None" has no attribute "__iter__" (not iterable) [attr-defined]
+ psycopg/psycopg/_pipeline.py:172: error: Function does not return a value [func-returns-value]
+ psycopg/psycopg/cursor.py:289: error: Function does not return a value [func-returns-value]
+ psycopg/psycopg/cursor.py:289: error: "None" object is not iterable [misc]
+ psycopg/psycopg/cursor.py:290: error: Cannot determine type of "result" [has-type]
+ psycopg/psycopg/cursor.py:291: error: Cannot determine type of "result" [has-type]
+ psycopg/psycopg/cursor.py:308: error: Function does not return a value [func-returns-value]
+ psycopg/psycopg/cursor.py:311: error: Argument 4 to "validate" of "PrepareManager" has incompatible type "None"; expected "Sequence[PGresult]" [arg-type]
+ psycopg/psycopg/cursor.py:313: error: Argument 1 to "_check_results" of "BaseCursor" has incompatible type "None"; expected "list[PGresult]" [arg-type]
+ psycopg/psycopg/cursor.py:314: error: Argument 1 to "_set_results" of "BaseCursor" has incompatible type "None"; expected "list[PGresult]" [arg-type]
+ psycopg/psycopg/cursor.py:337: error: Function does not return a value [func-returns-value]
+ psycopg/psycopg/cursor.py:399: error: Function does not return a value [func-returns-value]
+ psycopg/psycopg/cursor.py:400: error: Argument 1 to "len" has incompatible type "None"; expected "Sized" [arg-type]
+ psycopg/psycopg/cursor.py:403: error: Value of type "None" is not indexable [index]
+ psycopg/psycopg/cursor.py:404: error: Argument 1 to "_set_results" of "BaseCursor" has incompatible type "None"; expected "list[PGresult]" [arg-type]
+ psycopg/psycopg/server_cursor.py:113: error: Function does not return a value [func-returns-value]
+ psycopg/psycopg/server_cursor.py:114: error: Value of type "None" is not indexable [index]
+ psycopg/psycopg/server_cursor.py:115: error: Value of type "None" is not indexable [index]
+ psycopg/psycopg/server_cursor.py:128: error: Function does not return a value [func-returns-value]
+ psycopg/psycopg/server_cursor.py:129: error: Argument 1 to "_check_results" of "BaseCursor" has incompatible type "None"; expected "list[PGresult]" [arg-type]
+ psycopg/psycopg/server_cursor.py:130: error: Incompatible types in assignment (expression has type "None", variable has type "list[PGresult]") [assignment]
+ psycopg/psycopg/server_cursor.py:151: error: Function does not return a value [func-returns-value]
+ psycopg/psycopg/server_cursor.py:172: error: Function does not return a value [func-returns-value]
+ psycopg/psycopg/connection.py:439: error: Function does not return a value [func-returns-value]
+ psycopg/psycopg/connection.py:440: error: Argument 1 to "BaseConnection" has incompatible type "None"; expected "PGconn" [arg-type]
+ psycopg/psycopg/connection.py:473: error: Value of type "None" is not indexable [index]
+ psycopg/psycopg/connection.py:473: error: Function does not return a value [func-returns-value]
+ psycopg/psycopg/connection.py:482: error: Returning Any from function declared to return "PGresult | None" [no-any-return]
mitmproxy (https://github.com/mitmproxy/mitmproxy)
+ mitmproxy/proxy/tunnel.py:70: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/tunnel.py:70: error: "None" object is not iterable [misc]
+ mitmproxy/proxy/tunnel.py:71: error: Cannot determine type of "done" [has-type]
+ mitmproxy/proxy/tunnel.py:75: error: Cannot determine type of "err" [has-type]
+ mitmproxy/proxy/tunnel.py:79: error: Cannot determine type of "err" [has-type]
+ mitmproxy/proxy/tunnel.py:80: error: Cannot determine type of "done" [has-type]
+ mitmproxy/proxy/tunnel.py:80: error: Cannot determine type of "err" [has-type]
+ mitmproxy/proxy/tunnel.py:81: error: Cannot determine type of "err" [has-type]
+ mitmproxy/proxy/layers/modes.py:84: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/modes.py:94: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/modes.py:289: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/tls.py:541: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/tls.py:541: error: Incompatible return value type (got "None", expected "tuple[bool, str | None]") [return-value]
+ mitmproxy/proxy/layers/tls.py:585: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/tls.py:598: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/tls.py:600: error: Incompatible return value type (got "None", expected "tuple[bool, str | None]") [return-value]
+ mitmproxy/proxy/layers/http/_upstream_proxy.py:78: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/http/_upstream_proxy.py:78: error: Incompatible return value type (got "None", expected "tuple[bool, str | None]") [return-value]
+ mitmproxy/proxy/layers/quic.py:1147: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/quic.py:1147: error: Incompatible return value type (got "None", expected "tuple[bool, str | None]") [return-value]
+ mitmproxy/proxy/layers/quic.py:1225: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/quic.py:1241: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/quic.py:1241: error: Incompatible return value type (got "None", expected "tuple[bool, str | None]") [return-value]
+ mitmproxy/proxy/layers/http/_http3.py:71: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/http/_http2.py:187: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/http/_http2.py:392: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/http/_http2.py:437: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/http/_http2.py:437: error: Incompatible return value type (got "None", expected "bool") [return-value]
+ mitmproxy/proxy/layers/http/_http2.py:538: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/http/_http2.py:601: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/http/_http2.py:601: error: Incompatible return value type (got "None", expected "bool") [return-value]
+ mitmproxy/proxy/layers/http/_http2.py:603: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/http/_http2.py:603: error: Incompatible return value type (got "None", expected "bool") [return-value]
+ mitmproxy/proxy/layers/http/__init__.py:263: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/http/__init__.py:267: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/http/__init__.py:289: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/http/__init__.py:359: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/http/__init__.py:366: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/http/__init__.py:370: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/http/__init__.py:399: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/http/__init__.py:403: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/http/__init__.py:485: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/http/__init__.py:675: error: Function does not return a value [func-returns-value]
+ mitmproxy/proxy/layers/http/__init__.py:704: error: Function does not return a value [func-returns-value]
httpx-caching (https://github.com/johtso/httpx-caching)
+ httpx_caching/_policy.py:126: error: Function does not return a value [func-returns-value]
+ httpx_caching/_policy.py:126: error: "None" object is not iterable [misc]
+ httpx_caching/_policy.py:129: error: Cannot determine type of "evaluation" [has-type]
+ httpx_caching/_policy.py:130: error: Cannot determine type of "cached_response" [has-type]
+ httpx_caching/_policy.py:130: error: Cannot determine type of "evaluation" [has-type]
+ httpx_caching/_policy.py:131: error: Cannot determine type of "cached_response" [has-type]
+ httpx_caching/_policy.py:133: error: Function does not return a value [func-returns-value]
+ httpx_caching/_policy.py:133: error: "None" object is not iterable [misc]
+ httpx_caching/_policy.py:135: error: Cannot determine type of "cached_response" [has-type]
+ httpx_caching/_policy.py:141: error: Cannot determine type of "response" [has-type]
+ httpx_caching/_policy.py:141: error: Cannot determine type of "source" [has-type]
aiohttp (https://github.com/aio-libs/aiohttp)
+ aiohttp/client.py:321:16: error: Cannot instantiate abstract class "_RequestContextManager" with abstract attributes "__name__" and "__qualname__" [abstract]
+ aiohttp/client.py:321:16: note: See https://mypy.rtfd.io/en/stable/_refs.html#code-abstract for more info
+ aiohttp/client.py:692:16: error: Cannot instantiate abstract class "_WSRequestContextManager" with abstract attributes "__name__" and "__qualname__" [abstract]
+ aiohttp/client.py:935:16: error: Cannot instantiate abstract class "_RequestContextManager" with abstract attributes "__name__" and "__qualname__" [abstract]
+ aiohttp/client.py:943:16: error: Cannot instantiate abstract class "_RequestContextManager" with abstract attributes "__name__" and "__qualname__" [abstract]
+ aiohttp/client.py:953:16: error: Cannot instantiate abstract class "_RequestContextManager" with abstract attributes "__name__" and "__qualname__" [abstract]
+ aiohttp/client.py:963:16: error: Cannot instantiate abstract class "_RequestContextManager" with abstract attributes "__name__" and "__qualname__" [abstract]
+ aiohttp/client.py:971:16: error: Cannot instantiate abstract class "_RequestContextManager" with abstract attributes "__name__" and "__qualname__" [abstract]
+ aiohttp/client.py:979:16: error: Cannot instantiate abstract class "_RequestContextManager" with abstract attributes "__name__" and "__qualname__" [abstract]
+ aiohttp/client.py:985:16: error: Cannot instantiate abstract class "_RequestContextManager" with abstract attributes "__name__" and "__qualname__" [abstract]
+ aiohttp/test_utils.py:324:16: error: Cannot instantiate abstract class "_RequestContextManager" with abstract attributes "__name__" and "__qualname__" [abstract]
+ aiohttp/test_utils.py:328:16: error: Cannot instantiate abstract class "_RequestContextManager" with abstract attributes "__name__" and "__qualname__" [abstract]
+ aiohttp/test_utils.py:332:16: error: Cannot instantiate abstract class "_RequestContextManager" with abstract attributes "__name__" and "__qualname__" [abstract]
+ aiohttp/test_utils.py:336:16: error: Cannot instantiate abstract class "_RequestContextManager" with abstract attributes "__name__" and "__qualname__" [abstract]
+ aiohttp/test_utils.py:340:16: error: Cannot instantiate abstract class "_RequestContextManager" with abstract attributes "__name__" and "__qualname__" [abstract]
+ aiohttp/test_utils.py:344:16: error: Cannot instantiate abstract class "_RequestContextManager" with abstract attributes "__name__" and "__qualname__" [abstract]
+ aiohttp/test_utils.py:348:16: error: Cannot instantiate abstract class "_RequestContextManager" with abstract attributes "__name__" and "__qualname__" [abstract]
+ aiohttp/test_utils.py:352:16: error: Cannot instantiate abstract class "_RequestContextManager" with abstract attributes "__name__" and "__qualname__" [abstract]
+ aiohttp/test_utils.py:360:16: error: Cannot instantiate abstract class "_WSRequestContextManager" with abstract attributes "__name__" and "__qualname__" [abstract]
This change feels correct, let's see if we can get type checkers to agree.
Diff from mypy_primer, showing the effect of this PR on open source code:
websockets (https://github.com/aaugustin/websockets)
+ src/websockets/http11.py:134: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ src/websockets/http11.py:139: error: "None" has no attribute "split" [attr-defined]
+ src/websockets/http11.py:141: error: Argument 1 to "d" has incompatible type "None"; expected "bytes" [arg-type]
+ src/websockets/http11.py:144: error: Argument 1 to "d" has incompatible type "None"; expected "bytes" [arg-type]
+ src/websockets/http11.py:150: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ src/websockets/http11.py:154: error: Unsupported right operand type for in ("None") [operator]
+ src/websockets/http11.py:157: error: Unsupported right operand type for in ("None") [operator]
+ src/websockets/http11.py:160: error: Argument 2 to "Request" has incompatible type "None"; expected "Headers" [arg-type]
+ src/websockets/http11.py:236: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ src/websockets/http11.py:241: error: "None" has no attribute "split" [attr-defined]
+ src/websockets/http11.py:243: error: Argument 1 to "d" has incompatible type "None"; expected "bytes" [arg-type]
+ src/websockets/http11.py:246: error: Argument 1 to "d" has incompatible type "None"; expected "bytes" [arg-type]
+ src/websockets/http11.py:262: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ src/websockets/http11.py:266: error: Unsupported right operand type for in ("None") [operator]
+ src/websockets/http11.py:279: error: Value of type "None" is not indexable [index]
+ src/websockets/http11.py:287: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ src/websockets/http11.py:293: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ src/websockets/http11.py:295: error: Argument 3 to "Response" has incompatible type "None"; expected "Headers" [arg-type]
+ src/websockets/http11.py:336: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ src/websockets/http11.py:343: error: "None" has no attribute "split" [attr-defined]
+ src/websockets/http11.py:345: error: Argument 1 to "d" has incompatible type "None"; expected "bytes" [arg-type]
+ src/websockets/http11.py:380: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ src/websockets/http11.py:384: error: "None" has no attribute "endswith" [attr-defined]
+ src/websockets/http11.py:386: error: Returning Any from function declared to return "bytes" [no-any-return]
+ src/websockets/http11.py:386: error: Value of type "None" is not indexable [index]
+ src/websockets/frames.py:231: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ src/websockets/frames.py:232: error: Argument 2 to "unpack" has incompatible type "None"; expected "Buffer" [arg-type]
+ src/websockets/frames.py:250: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ src/websockets/frames.py:251: error: Argument 2 to "unpack" has incompatible type "None"; expected "Buffer" [arg-type]
+ src/websockets/frames.py:253: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ src/websockets/frames.py:254: error: Argument 2 to "unpack" has incompatible type "None"; expected "Buffer" [arg-type]
+ src/websockets/frames.py:258: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ src/websockets/frames.py:261: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ src/websockets/frames.py:263: error: Argument 1 to "apply_mask" has incompatible type "None"; expected "bytes" [arg-type]
+ src/websockets/frames.py:263: error: Argument 2 to "apply_mask" has incompatible type "None"; expected "bytes" [arg-type]
+ src/websockets/frames.py:265: error: Argument 2 to "Frame" has incompatible type "bytes | None"; expected "bytes | bytearray | memoryview[int]" [arg-type]
+ src/websockets/protocol.py:546: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ src/websockets/protocol.py:565: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ src/websockets/protocol.py:575: error: Argument 1 to "recv_frame" of "Protocol" has incompatible type "None"; expected "Frame" [arg-type]
+ src/websockets/protocol.py:619: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ src/websockets/server.py:557: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ src/websockets/server.py:568: error: "None" has no attribute "path" [attr-defined]
+ src/websockets/server.py:569: error: "None" has no attribute "headers" [attr-defined]
+ src/websockets/server.py:572: error: Argument 1 to "append" of "list" has incompatible type "None"; expected "Request | Response | Frame" [arg-type]
+ src/websockets/client.py:315: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ src/websockets/client.py:328: error: "None" has no attribute "status_code" [attr-defined]
+ src/websockets/client.py:328: error: "None" has no attribute "reason_phrase" [attr-defined]
+ src/websockets/client.py:330: error: "None" has no attribute "headers" [attr-defined]
+ src/websockets/client.py:332: error: "None" has no attribute "body" [attr-defined]
+ src/websockets/client.py:333: error: "None" has no attribute "body" [attr-defined]
+ src/websockets/client.py:336: error: Argument 1 to "process_response" of "ClientProtocol" has incompatible type "None"; expected "Response" [arg-type]
+ src/websockets/client.py:338: error: "None" has no attribute "_exception" [attr-defined]
+ src/websockets/client.py:339: error: Argument 1 to "append" of "list" has incompatible type "None"; expected "Request | Response | Frame" [arg-type]
+ src/websockets/client.py:348: error: Argument 1 to "append" of "list" has incompatible type "None"; expected "Request | Response | Frame" [arg-type]
psycopg (https://github.com/psycopg/psycopg)
+ psycopg/psycopg/transaction.py:113: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ psycopg/psycopg/transaction.py:113: error: Incompatible return value type (got "None", expected "bool") [return-value]
+ psycopg/psycopg/generators.py:136: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ psycopg/psycopg/generators.py:137: error: Incompatible return value type (got "None", expected "list[PGresult]") [return-value]
+ psycopg/psycopg/generators.py:179: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ psycopg/psycopg/generators.py:325: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ psycopg/psycopg/generators.py:326: error: Argument 1 to "len" has incompatible type "None"; expected "Sized" [arg-type]
+ psycopg/psycopg/generators.py:329: error: Value of type "None" is not indexable [index]
+ psycopg/psycopg/generators.py:333: error: Returning Any from function declared to return "memoryview[int] | PGresult" [no-any-return]
+ psycopg/psycopg/generators.py:383: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ psycopg/psycopg/generators.py:383: error: "None" object is not iterable [misc]
+ psycopg/psycopg/generators.py:384: error: Cannot determine type of "result" [has-type]
+ psycopg/psycopg/generators.py:385: error: Cannot determine type of "result" [has-type]
+ psycopg/psycopg/generators.py:387: error: Returning Any from function declared to return "PGresult" [no-any-return]
+ psycopg/psycopg/generators.py:387: error: Cannot determine type of "result" [has-type]
+ psycopg/psycopg/_pipeline.py:115: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ psycopg/psycopg/_pipeline.py:117: error: "None" has no attribute "__iter__" (not iterable) [attr-defined]
+ psycopg/psycopg/_pipeline.py:145: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ psycopg/psycopg/_copy_base.py:149: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ psycopg/psycopg/_copy_base.py:160: error: "None" has no attribute "command_tuples" [attr-defined]
+ psycopg/psycopg/_copy_base.py:165: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ psycopg/psycopg/_copy_base.py:180: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ psycopg/psycopg/_cursor_base.py:282: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ psycopg/psycopg/_cursor_base.py:282: error: "None" object is not iterable [misc]
+ psycopg/psycopg/_cursor_base.py:283: error: Cannot determine type of "result" [has-type]
+ psycopg/psycopg/_cursor_base.py:284: error: Cannot determine type of "result" [has-type]
+ psycopg/psycopg/_cursor_base.py:301: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ psycopg/psycopg/_cursor_base.py:304: error: Argument 4 to "validate" of "PrepareManager" has incompatible type "None"; expected "Sequence[PGresult]" [arg-type]
+ psycopg/psycopg/_cursor_base.py:306: error: Argument 1 to "_check_results" of "BaseCursor" has incompatible type "None"; expected "list[PGresult]" [arg-type]
+ psycopg/psycopg/_cursor_base.py:307: error: Argument 1 to "_set_results" of "BaseCursor" has incompatible type "None"; expected "list[PGresult]" [arg-type]
+ psycopg/psycopg/_cursor_base.py:337: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ psycopg/psycopg/_cursor_base.py:399: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ psycopg/psycopg/_cursor_base.py:400: error: Argument 1 to "len" has incompatible type "None"; expected "Sized" [arg-type]
+ psycopg/psycopg/_cursor_base.py:403: error: Value of type "None" is not indexable [index]
+ psycopg/psycopg/_cursor_base.py:404: error: Argument 1 to "_set_results" of "BaseCursor" has incompatible type "None"; expected "list[PGresult]" [arg-type]
+ psycopg/psycopg/_connection_base.py:430: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ psycopg/psycopg/_connection_base.py:431: error: Argument 1 to "BaseConnection" has incompatible type "None"; expected "PGconn" [arg-type]
+ psycopg/psycopg/_connection_base.py:469: error: Value of type "None" is not indexable [index]
+ psycopg/psycopg/_connection_base.py:469: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ psycopg/psycopg/_connection_base.py:478: error: Returning Any from function declared to return "PGresult | None" [no-any-return]
+ psycopg/psycopg/_connection_base.py:509: error: Value of type "None" is not indexable [index]
+ psycopg/psycopg/_connection_base.py:509: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ psycopg/psycopg/server_cursor.py:116: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ psycopg/psycopg/server_cursor.py:117: error: Value of type "None" is not indexable [index]
+ psycopg/psycopg/server_cursor.py:118: error: Value of type "None" is not indexable [index]
+ psycopg/psycopg/server_cursor.py:131: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ psycopg/psycopg/server_cursor.py:132: error: Argument 1 to "_check_results" of "BaseCursor" has incompatible type "None"; expected "list[PGresult]" [arg-type]
+ psycopg/psycopg/server_cursor.py:133: error: Incompatible types in assignment (expression has type "None", variable has type "list[PGresult]") [assignment]
+ psycopg/psycopg/server_cursor.py:154: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ psycopg/psycopg/server_cursor.py:175: error: Function does not return a value (it only ever returns None) [func-returns-value]
mitmproxy (https://github.com/mitmproxy/mitmproxy)
+ mitmproxy/proxy/tunnel.py:70: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ mitmproxy/proxy/tunnel.py:70: error: "None" object is not iterable [misc]
+ mitmproxy/proxy/tunnel.py:71: error: Cannot determine type of "done" [has-type]
+ mitmproxy/proxy/tunnel.py:75: error: Cannot determine type of "err" [has-type]
+ mitmproxy/proxy/tunnel.py:79: error: Cannot determine type of "err" [has-type]
+ mitmproxy/proxy/tunnel.py:80: error: Cannot determine type of "done" [has-type]
+ mitmproxy/proxy/tunnel.py:80: error: Cannot determine type of "err" [has-type]
+ mitmproxy/proxy/tunnel.py:81: error: Cannot determine type of "err" [has-type]
+ mitmproxy/proxy/layers/modes.py:84: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ mitmproxy/proxy/layers/modes.py:94: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ mitmproxy/proxy/layers/modes.py:289: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ mitmproxy/proxy/layers/tls.py:561: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ mitmproxy/proxy/layers/tls.py:561: error: Incompatible return value type (got "None", expected "tuple[bool, str | None]") [return-value]
+ mitmproxy/proxy/layers/tls.py:605: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ mitmproxy/proxy/layers/tls.py:618: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ mitmproxy/proxy/layers/tls.py:620: error: Incompatible return value type (got "None", expected "tuple[bool, str | None]") [return-value]
+ mitmproxy/proxy/layers/quic/_stream_layers.py:448: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ mitmproxy/proxy/layers/quic/_stream_layers.py:448: error: Incompatible return value type (got "None", expected "tuple[bool, str | None]") [return-value]
+ mitmproxy/proxy/layers/quic/_stream_layers.py:535: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ mitmproxy/proxy/layers/quic/_stream_layers.py:557: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ mitmproxy/proxy/layers/quic/_stream_layers.py:557: error: Incompatible return value type (got "None", expected "tuple[bool, str | None]") [return-value]
+ mitmproxy/proxy/layers/http/_upstream_proxy.py:81: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ mitmproxy/proxy/layers/http/_upstream_proxy.py:81: error: Incompatible return value type (got "None", expected "tuple[bool, str | None]") [return-value]
+ mitmproxy/proxy/layers/http/_http3.py:69: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ mitmproxy/proxy/layers/http/_http2.py:187: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ mitmproxy/proxy/layers/http/_http2.py:392: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ mitmproxy/proxy/layers/http/_http2.py:437: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ mitmproxy/proxy/layers/http/_http2.py:437: error: Incompatible return value type (got "None", expected "bool") [return-value]
+ mitmproxy/proxy/layers/http/_http2.py:538: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ mitmproxy/proxy/layers/http/_http2.py:601: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ mitmproxy/proxy/layers/http/_http2.py:601: error: Incompatible return value type (got "None", expected "bool") [return-value]
+ mitmproxy/proxy/layers/http/_http2.py:603: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ mitmproxy/proxy/layers/http/_http2.py:603: error: Incompatible return value type (got "None", expected "bool") [return-value]
+ mitmproxy/proxy/layers/http/__init__.py:266: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ mitmproxy/proxy/layers/http/__init__.py:270: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ mitmproxy/proxy/layers/http/__init__.py:292: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ mitmproxy/proxy/layers/http/__init__.py:362: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ mitmproxy/proxy/layers/http/__init__.py:369: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ mitmproxy/proxy/layers/http/__init__.py:373: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ mitmproxy/proxy/layers/http/__init__.py:402: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ mitmproxy/proxy/layers/http/__init__.py:406: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ mitmproxy/proxy/layers/http/__init__.py:488: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ mitmproxy/proxy/layers/http/__init__.py:678: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ mitmproxy/proxy/layers/http/__init__.py:708: error: Function does not return a value (it only ever returns None) [func-returns-value]
ignite (https://github.com/pytorch/ignite)
+ ignite/engine/engine.py:973: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ ignite/engine/engine.py:973: error: Unsupported operand types for + ("float" and "None") [operator]
httpx-caching (https://github.com/johtso/httpx-caching)
+ httpx_caching/_policy.py:126: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ httpx_caching/_policy.py:126: error: "None" object is not iterable [misc]
+ httpx_caching/_policy.py:129: error: Cannot determine type of "evaluation" [has-type]
+ httpx_caching/_policy.py:130: error: Cannot determine type of "cached_response" [has-type]
+ httpx_caching/_policy.py:130: error: Cannot determine type of "evaluation" [has-type]
+ httpx_caching/_policy.py:131: error: Cannot determine type of "cached_response" [has-type]
+ httpx_caching/_policy.py:133: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ httpx_caching/_policy.py:133: error: "None" object is not iterable [misc]
+ httpx_caching/_policy.py:135: error: Cannot determine type of "cached_response" [has-type]
+ httpx_caching/_policy.py:141: error: Cannot determine type of "response" [has-type]
+ httpx_caching/_policy.py:141: error: Cannot determine type of "source" [has-type]
Expression (https://github.com/cognitedata/Expression)
+ tests/test_gen.py:149: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ tests/test_gen.py:151: error: Unsupported operand types for + ("None" and "int") [operator]
trio (https://github.com/python-trio/trio)
+ src/trio/_core/_traps.py:283: error: "Coroutine[Any, Outcome[object], Any]" has no attribute "cr_running" [attr-defined]
+ src/trio/_core/_run.py:1872: error: "Coroutine[object, Never, object]" has no attribute "cr_frame" [attr-defined]
+ src/trio/_core/_run.py:1873: error: "Coroutine[object, Never, object]" has no attribute "cr_frame" [attr-defined]
+ src/trio/_core/_tests/test_asyncgen.py:91: error: "AsyncGenerator[int, None]" has no attribute "ag_frame" [attr-defined]
+ src/trio/_core/_tests/test_asyncgen.py:304: error: "AsyncGenerator[object, Never]" has no attribute "ag_frame" [attr-defined]
+ src/trio/_core/_tests/test_asyncgen.py:307: error: "AsyncGenerator[object, Never]" has no attribute "ag_frame" [attr-defined]
Diff from mypy_primer, showing the effect of this PR on open source code:
trio (https://github.com/python-trio/trio)
+ src/trio/_core/_traps.py:283: error: "Coroutine[Any, Outcome[object], Any]" has no attribute "cr_running" [attr-defined]
+ src/trio/_core/_run.py:1872: error: "Coroutine[object, Never, object]" has no attribute "cr_frame" [attr-defined]
+ src/trio/_core/_run.py:1873: error: "Coroutine[object, Never, object]" has no attribute "cr_frame" [attr-defined]
+ src/trio/_core/_tests/test_asyncgen.py:91: error: "AsyncGenerator[int, None]" has no attribute "ag_frame" [attr-defined]
+ src/trio/_core/_tests/test_asyncgen.py:304: error: "AsyncGenerator[object, Never]" has no attribute "ag_frame" [attr-defined]
+ src/trio/_core/_tests/test_asyncgen.py:307: error: "AsyncGenerator[object, Never]" has no attribute "ag_frame" [attr-defined]
Diff from mypy_primer, showing the effect of this PR on open source code:
trio (https://github.com/python-trio/trio)
+ src/trio/_core/_traps.py:283: error: "Coroutine[Any, Outcome[object], Any]" has no attribute "cr_running" [attr-defined]
+ src/trio/_core/_run.py:1872: error: "Coroutine[object, Never, object]" has no attribute "cr_frame" [attr-defined]
+ src/trio/_core/_run.py:1873: error: "Coroutine[object, Never, object]" has no attribute "cr_frame" [attr-defined]
+ src/trio/_core/_tests/test_asyncgen.py:91: error: "AsyncGenerator[int, None]" has no attribute "ag_frame" [attr-defined]
+ src/trio/_core/_tests/test_asyncgen.py:304: error: "AsyncGenerator[object, Never]" has no attribute "ag_frame" [attr-defined]
+ src/trio/_core/_tests/test_asyncgen.py:307: error: "AsyncGenerator[object, Never]" has no attribute "ag_frame" [attr-defined]
Diff from mypy_primer, showing the effect of this PR on open source code:
trio (https://github.com/python-trio/trio)
+ src/trio/_core/_traps.py:283: error: "Coroutine[Any, Outcome[object], Any]" has no attribute "cr_running" [attr-defined]
+ src/trio/_core/_run.py:1872: error: "Coroutine[object, Never, object]" has no attribute "cr_frame" [attr-defined]
+ src/trio/_core/_run.py:1873: error: "Coroutine[object, Never, object]" has no attribute "cr_frame" [attr-defined]
+ src/trio/_core/_tests/test_asyncgen.py:91: error: "AsyncGenerator[int, None]" has no attribute "ag_frame" [attr-defined]
+ src/trio/_core/_tests/test_asyncgen.py:304: error: "AsyncGenerator[object, Never]" has no attribute "ag_frame" [attr-defined]
+ src/trio/_core/_tests/test_asyncgen.py:307: error: "AsyncGenerator[object, Never]" has no attribute "ag_frame" [attr-defined]
Diff from mypy_primer, showing the effect of this PR on open source code:
trio (https://github.com/python-trio/trio)
+ src/trio/_core/_traps.py:283: error: "Coroutine[Any, Outcome[object], Any]" has no attribute "cr_running" [attr-defined]
+ src/trio/_core/_run.py:1872: error: "Coroutine[object, Never, object]" has no attribute "cr_frame" [attr-defined]
+ src/trio/_core/_run.py:1873: error: "Coroutine[object, Never, object]" has no attribute "cr_frame" [attr-defined]
+ src/trio/_core/_tests/test_asyncgen.py:91: error: "AsyncGenerator[int, None]" has no attribute "ag_frame" [attr-defined]
+ src/trio/_core/_tests/test_asyncgen.py:304: error: "AsyncGenerator[object, Never]" has no attribute "ag_frame" [attr-defined]
+ src/trio/_core/_tests/test_asyncgen.py:307: error: "AsyncGenerator[object, Never]" has no attribute "ag_frame" [attr-defined]
cc @A5rocks regarding the primer changes in trio. I think they are technically correct; trio uses the Coroutine ABC, which does not guarantee the existence of attributes like cr_frame. However, I'm not sure this makes the user experience better in practice.
Diff from mypy_primer, showing the effect of this PR on open source code:
trio (https://github.com/python-trio/trio)
+ src/trio/_core/_traps.py:283: error: "Coroutine[Any, Outcome[object], Any]" has no attribute "cr_running" [attr-defined]
+ src/trio/_core/_run.py:1873: error: "Coroutine[object, Never, object]" has no attribute "cr_frame" [attr-defined]
+ src/trio/_core/_run.py:1874: error: "Coroutine[object, Never, object]" has no attribute "cr_frame" [attr-defined]
+ src/trio/_core/_tests/test_asyncgen.py:91: error: "AsyncGenerator[int, None]" has no attribute "ag_frame" [attr-defined]
+ src/trio/_core/_tests/test_asyncgen.py:304: error: "AsyncGenerator[object, Never]" has no attribute "ag_frame" [attr-defined]
+ src/trio/_core/_tests/test_asyncgen.py:307: error: "AsyncGenerator[object, Never]" has no attribute "ag_frame" [attr-defined]
cc @A5rocks regarding the primer changes in trio. I think they are technically correct; trio uses the Coroutine ABC, which does not guarantee the existence of attributes like
cr_frame. However, I'm not sure this makes the user experience better in practice.
I agree with these changes being technically correct, because asyncio.iscoroutine exists. (I'm not too sure about if it didn't exist, but oh well. I see something about a types.coroutine decorator but I can't get a collections.abc.Coroutine isinstance check to pass.)
>>> import asyncio
>>> @asyncio.coroutine
... def blah():
... yield "hello"
...
>>> asyncio.iscoroutine(blah())
True
>>> blah().cr_frame
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'generator' object has no attribute 'cr_frame'
Anyways, I think it's better to be more correct. We have added asserts to check cr_frame in the past (because it's Optional) and this is just more along that line. Though take what I say with a grain of salt because I don't really know the internal details.
Diff from mypy_primer, showing the effect of this PR on open source code:
trio (https://github.com/python-trio/trio)
+ src/trio/_core/_traps.py:307: error: "Coroutine[Any, Outcome[object], Any]" has no attribute "cr_running" [attr-defined]
+ src/trio/_core/_ki.py:179: error: "Coroutine[Any, Outcome[object], Any]" has no attribute "cr_frame" [attr-defined]
+ src/trio/_core/_run.py:1882: error: "Coroutine[object, Never, object]" has no attribute "cr_frame" [attr-defined]
+ src/trio/_core/_tests/test_asyncgen.py:91: error: "AsyncGenerator[int, None]" has no attribute "ag_frame" [attr-defined]
+ src/trio/_core/_tests/test_asyncgen.py:304: error: "AsyncGenerator[object, Never]" has no attribute "ag_frame" [attr-defined]
+ src/trio/_core/_tests/test_asyncgen.py:307: error: "AsyncGenerator[object, Never]" has no attribute "ag_frame" [attr-defined]
Diff from mypy_primer, showing the effect of this PR on open source code:
trio (https://github.com/python-trio/trio)
+ src/trio/_core/_traps.py:307: error: "Coroutine[Any, Outcome[object], Any]" has no attribute "cr_running" [attr-defined]
+ src/trio/_core/_ki.py:179: error: "Coroutine[Any, Outcome[object], Any]" has no attribute "cr_frame" [attr-defined]
+ src/trio/_core/_run.py:1882: error: "Coroutine[object, Never, object]" has no attribute "cr_frame" [attr-defined]
+ src/trio/_core/_tests/test_asyncgen.py:91: error: "AsyncGenerator[int, None]" has no attribute "ag_frame" [attr-defined]
+ src/trio/_core/_tests/test_asyncgen.py:304: error: "AsyncGenerator[object, Never]" has no attribute "ag_frame" [attr-defined]
+ src/trio/_core/_tests/test_asyncgen.py:307: error: "AsyncGenerator[object, Never]" has no attribute "ag_frame" [attr-defined]
Diff from mypy_primer, showing the effect of this PR on open source code:
trio (https://github.com/python-trio/trio)
+ src/trio/_core/_traps.py:307: error: "Coroutine[Any, Outcome[object], Any]" has no attribute "cr_running" [attr-defined]
+ src/trio/_core/_ki.py:179: error: "Coroutine[Any, Outcome[object], Any]" has no attribute "cr_frame" [attr-defined]
+ src/trio/_core/_run.py:1882: error: "Coroutine[object, Never, object]" has no attribute "cr_frame" [attr-defined]
+ src/trio/_core/_tests/test_asyncgen.py:91: error: "AsyncGenerator[int, None]" has no attribute "ag_frame" [attr-defined]
+ src/trio/_core/_tests/test_asyncgen.py:304: error: "AsyncGenerator[object, Never]" has no attribute "ag_frame" [attr-defined]
+ src/trio/_core/_tests/test_asyncgen.py:307: error: "AsyncGenerator[object, Never]" has no attribute "ag_frame" [attr-defined]