Improve Typing for `threading.Thread`
This PR makes it so that if you pass a Callable, while passing in args, but not kwargs, that type-checking is done on the arguments. Take this simple example, which would normally lead to a false negative:
def my_func(a: int, b: int) -> int: ...
threading.Thread(target=my_func, args=(1, "test")).start()
Which now would get cause by a type-checker. If kwargs are provided, we skip type-checking of the args as in that case there's no mechanism for verifying they are correct.
The only limitation here is that now if you're providing args, it must be a tuple, I don't see that as a major downside to ensure that we have type-checking on the these arguments. Additionally Iterable is a bit more flexible than what the docstring says (list or tuple) already.
Diff from mypy_primer, showing the effect of this PR on open source code:
pyinstrument (https://github.com/joerick/pyinstrument)
+ pyinstrument/low_level/pyi_timing_thread_python.py:45: error: Argument "target" to "Thread" has incompatible type "Callable[[], Any]"; expected "Callable[[VarArg(Never)], object] | None" [arg-type]
websockets (https://github.com/aaugustin/websockets)
+ src/websockets/sync/connection.py:95: error: Argument "target" to "Thread" has incompatible type "Callable[[], None]"; expected "Callable[[VarArg(Never)], object] | None" [arg-type]
tornado (https://github.com/tornadoweb/tornado)
+ tornado/platform/asyncio.py:514: error: Argument "target" to "Thread" has incompatible type "Callable[[], None]"; expected "Optional[Callable[[VarArg(Never)], object]]" [arg-type]
+ tornado/test/ioloop_test.py:85: error: Argument "target" to "Thread" has incompatible type "Callable[[], Any]"; expected "Optional[Callable[[VarArg(Never)], object]]" [arg-type]
+ tornado/test/ioloop_test.py:136: error: Argument "target" to "Thread" has incompatible type "Callable[[], None]"; expected "Optional[Callable[[VarArg(Never)], object]]" [arg-type]
+ tornado/test/ioloop_test.py:156: error: Argument "target" to "Thread" has incompatible type "Callable[[], Any]"; expected "Optional[Callable[[VarArg(Never)], object]]" [arg-type]
+ tornado/test/httpclient_test.py:806: error: Argument "target" to "Thread" has incompatible type "Callable[[], Any]"; expected "Optional[Callable[[VarArg(Never)], object]]" [arg-type]
psycopg (https://github.com/psycopg/psycopg)
+ tests/test_concurrency_async.py:244: error: Argument "target" to "Thread" has incompatible type "Callable[[], Any]"; expected "Callable[[VarArg(Never)], object] | None" [arg-type]
+ tests/test_concurrency.py:29: error: Argument "target" to "Thread" has incompatible type "Callable[[], Any]"; expected "Callable[[VarArg(Never)], object] | None" [arg-type]
+ tests/test_concurrency.py:30: error: Argument "target" to "Thread" has incompatible type "Callable[[], Any]"; expected "Callable[[VarArg(Never)], object] | None" [arg-type]
+ tests/test_concurrency.py:54: error: Argument "target" to "Thread" has incompatible type "Callable[[], Any]"; expected "Callable[[VarArg(Never)], object] | None" [arg-type]
+ tests/test_concurrency.py:128: error: Argument "target" to "Thread" has incompatible type "Callable[[], Any]"; expected "Callable[[VarArg(Never)], object] | None" [arg-type]
+ tests/test_concurrency.py:224: error: Argument "target" to "Thread" has incompatible type "Callable[[], Any]"; expected "Callable[[VarArg(Never)], object] | None" [arg-type]
+ tests/test_concurrency.py:331: error: Argument "target" to "Thread" has incompatible type "Callable[[], Any]"; expected "Callable[[VarArg(Never)], object] | None" [arg-type]
+ tests/test_concurrency.py:458: error: Argument "target" to "Thread" has incompatible type "Callable[[], Any]"; expected "Callable[[VarArg(Never)], object] | None" [arg-type]
prefect (https://github.com/PrefectHQ/prefect)
+ src/prefect/_internal/concurrency/threads.py:34: error: Argument "target" to "Thread" has incompatible type "Callable[[], Any]"; expected "Callable[[VarArg(Never)], object] | None" [arg-type]
+ src/prefect/_internal/concurrency/threads.py:130: error: Argument "target" to "Thread" has incompatible type "Callable[[], Any]"; expected "Callable[[VarArg(Never)], object] | None" [arg-type]
steam.py (https://github.com/Gobot1234/steam.py)
+ steam/utils.py:317: error: Cannot infer type of lambda [misc]
+ steam/utils.py:317: error: Argument "target" to "Thread" has incompatible type "Callable[[], Handle]"; expected "Callable[[VarArg(Never)], object] | None" [arg-type]
mongo-python-driver (https://github.com/mongodb/mongo-python-driver)
+ pymongo/synchronous/periodic_executor.py:108: error: Argument "target" to "Thread" has incompatible type "Callable[[], None]"; expected "Callable[[VarArg(Never)], object] | None" [arg-type]
+ pymongo/synchronous/periodic_executor.py:110: error: Argument "target" to "Thread" has incompatible type "Callable[[], None]"; expected "Callable[[VarArg(Never)], object] | None" [arg-type]
+ pymongo/asynchronous/periodic_executor.py:108: error: Argument "target" to "Thread" has incompatible type "Callable[[], Coroutine[Any, Any, None]]"; expected "Callable[[VarArg(Never)], object] | None" [arg-type]
+ pymongo/asynchronous/periodic_executor.py:110: error: Argument "target" to "Thread" has incompatible type "Callable[[], None]"; expected "Callable[[VarArg(Never)], object] | None" [arg-type]
streamlit (https://github.com/streamlit/streamlit)
+ lib/streamlit/runtime/scriptrunner/script_runner.py: note: In member "start" of class "ScriptRunner":
+ lib/streamlit/runtime/scriptrunner/script_runner.py:253:20: error: Argument "target" to "Thread" has incompatible type "Callable[[], None]"; expected "Optional[Callable[[VarArg(Never)], object]]" [arg-type]
+ lib/tests/streamlit/runtime/runtime_threading_test.py:63:42: error: Argument "target" to "Thread" has incompatible type "Callable[[], Any]"; expected "Optional[Callable[[VarArg(Never)], object]]" [arg-type]
+ lib/tests/streamlit/runtime/app_session_test.py:841:20: error: Cannot infer type of lambda [misc]
+ lib/tests/streamlit/runtime/app_session_test.py:841:20: error: Argument "target" to "Thread" has incompatible type "Callable[[], None]"; expected "Optional[Callable[[VarArg(Never)], object]]" [arg-type]
+ lib/tests/streamlit/delta_generator_test.py: note: In member "test_threads_with" of class "DeltaGeneratorWithTest":
+ lib/tests/streamlit/delta_generator_test.py:500:49: error: Argument "target" to "Thread" has incompatible type "Callable[[], Any]"; expected "Optional[Callable[[VarArg(Never)], object]]" [arg-type]
spark (https://github.com/apache/spark)
+ python/pyspark/util.py:510: error: No overload variant of "__init__" of "Thread" matches argument types "tuple[Any, ...]", "Callable[[VarArg(Any), KwArg(Any)], Any]", "dict[str, Any]" [call-overload]
+ python/pyspark/util.py:510: note: Possible overload variants:
+ python/pyspark/util.py:510: note: def [_Ts`1013] __init__(self, group: None = ..., target: Callable[[VarArg(*_Ts)], object] | None = ..., name: str | None = ..., args: tuple[*_Ts] = ..., *, daemon: bool | None = ...) -> None
+ python/pyspark/util.py:510: note: def __init__(self, group: None, target: Callable[..., object] | None, name: str | None, args: Iterable[Any], kwargs: Mapping[str, Any], *, daemon: bool | None = ...) -> None
+ python/pyspark/util.py:510: note: def __init__(self, group: None = ..., target: Callable[..., object] | None = ..., name: str | None = ..., args: Iterable[Any] = ..., *, kwargs: Mapping[str, Any], daemon: bool | None = ...) -> None
+ python/pyspark/util.py:511: error: Unused "type: ignore" comment [unused-ignore]
+ python/pyspark/util.py:527: error: No overload variant of "__init__" of "Thread" matches argument types "tuple[Any, ...]", "Callable[[VarArg(Any), KwArg(Any)], Any]", "dict[str, Any]" [call-overload]
+ python/pyspark/util.py:527: note: Possible overload variants:
+ python/pyspark/util.py:527: note: def [_Ts`1014] __init__(self, group: None = ..., target: Callable[[VarArg(*_Ts)], object] | None = ..., name: str | None = ..., args: tuple[*_Ts] = ..., *, daemon: bool | None = ...) -> None
+ python/pyspark/util.py:527: note: def __init__(self, group: None, target: Callable[..., object] | None, name: str | None, args: Iterable[Any], kwargs: Mapping[str, Any], *, daemon: bool | None = ...) -> None
+ python/pyspark/util.py:527: note: def __init__(self, group: None = ..., target: Callable[..., object] | None = ..., name: str | None = ..., args: Iterable[Any] = ..., *, kwargs: Mapping[str, Any], daemon: bool | None = ...) -> None
+ python/pyspark/util.py:528: error: Unused "type: ignore" comment [unused-ignore]
+ python/pyspark/util.py:531: error: No overload variant of "__init__" of "Thread" matches argument types "tuple[Any, ...]", "Callable[..., Any]", "dict[str, Any]" [call-overload]
+ python/pyspark/util.py:531: note: Possible overload variants:
+ python/pyspark/util.py:531: note: def [_Ts`1015] __init__(self, group: None = ..., target: Callable[[VarArg(*_Ts)], object] | None = ..., name: str | None = ..., args: tuple[*_Ts] = ..., *, daemon: bool | None = ...) -> None
+ python/pyspark/util.py:531: note: def __init__(self, group: None, target: Callable[..., object] | None, name: str | None, args: Iterable[Any], kwargs: Mapping[str, Any], *, daemon: bool | None = ...) -> None
+ python/pyspark/util.py:531: note: def __init__(self, group: None = ..., target: Callable[..., object] | None = ..., name: str | None = ..., args: Iterable[Any] = ..., *, kwargs: Mapping[str, Any], daemon: bool | None = ...) -> None
+ python/pyspark/util.py:532: error: Unused "type: ignore" comment [unused-ignore]
+ python/pyspark/accumulators.py:327: error: Argument "target" to "Thread" has incompatible type "Callable[[float], None]"; expected "Callable[[VarArg(Never)], object] | None" [arg-type]
+ python/pyspark/core/rdd.py:1578: error: No overload variant of "Thread" matches argument types "Callable[[IO[bytes]], None]", "list[IO[bytes] | None]" [call-overload]
+ python/pyspark/core/rdd.py:1578: note: Possible overload variants:
+ python/pyspark/core/rdd.py:1578: note: def [_Ts`-1] __init__(self, group: None = ..., target: Callable[[VarArg(*_Ts)], object] | None = ..., name: str | None = ..., args: tuple[*_Ts] = ..., *, daemon: bool | None = ...) -> Thread
+ python/pyspark/core/rdd.py:1578: note: def __init__(self, group: None, target: Callable[..., object] | None, name: str | None, args: Iterable[Any], kwargs: Mapping[str, Any], *, daemon: bool | None = ...) -> Thread
+ python/pyspark/core/rdd.py:1578: note: def __init__(self, group: None = ..., target: Callable[..., object] | None = ..., name: str | None = ..., args: Iterable[Any] = ..., *, kwargs: Mapping[str, Any], daemon: bool | None = ...) -> Thread
python-chess (https://github.com/niklasf/python-chess)
+ chess/engine.py:76: error: Argument "target" to "Thread" has incompatible type "Callable[[], None]"; expected "Callable[[VarArg(Never)], object] | None" [arg-type]
discord.py (https://github.com/Rapptz/discord.py)
+ discord/player.py:192: error: Argument "target" to "Thread" has incompatible type "Callable[[BufferedIOBase], None]"; expected "Callable[[str | BufferedIOBase], object] | None" [arg-type]
+ discord/player.py:198: error: Argument "target" to "Thread" has incompatible type "Callable[[IO[bytes]], None]"; expected "Callable[[IO[bytes] | None], object] | None" [arg-type]
- discord/gateway.py:137: error: "__init__" of "Thread" gets multiple values for keyword argument "name" [misc]
+ discord/gateway.py:137: error: No overload variant of "__init__" of "Thread" matches argument types "tuple[Any, ...]", "bool", "str", "dict[str, Any]" [call-overload]
+ discord/gateway.py:137: note: Possible overload variants:
+ discord/gateway.py:137: note: def [_Ts`3786] __init__(self, group: None = ..., target: Callable[[VarArg(*_Ts)], object] | None = ..., name: str | None = ..., args: tuple[*_Ts] = ..., *, daemon: bool | None = ...) -> None
+ discord/gateway.py:137: note: def __init__(self, group: None, target: Callable[..., object] | None, name: str | None, args: Iterable[Any], kwargs: Mapping[str, Any], *, daemon: bool | None = ...) -> None
+ discord/gateway.py:137: note: def __init__(self, group: None = ..., target: Callable[..., object] | None = ..., name: str | None = ..., args: Iterable[Any] = ..., *, kwargs: Mapping[str, Any], daemon: bool | None = ...) -> None
dragonchain (https://github.com/dragonchain/dragonchain)
+ dragonchain/contract_invoker/contract_invoker.py:103:43: error: No overload variant of "Thread" matches argument types "Callable[[Coroutine[Any, Any, _T], DefaultNamedArg(Optional[bool], 'debug')], _T]", "List[Coroutine[Any, Any, None]]", "bool" [call-overload]
+ dragonchain/contract_invoker/contract_invoker.py:103:43: note: Possible overload variants:
+ dragonchain/contract_invoker/contract_invoker.py:103:43: note: def [_Ts`-1] __init__(self, group: None = ..., target: Optional[Callable[[VarArg(Unpack[_Ts])], object]] = ..., name: Optional[str] = ..., args: Tuple[Unpack[_Ts]] = ..., *, daemon: Optional[bool] = ...) -> Thread
+ dragonchain/contract_invoker/contract_invoker.py:103:43: note: def __init__(self, group: None, target: Optional[Callable[..., object]], name: Optional[str], args: Iterable[Any], kwargs: Mapping[str, Any], *, daemon: Optional[bool] = ...) -> Thread
+ dragonchain/contract_invoker/contract_invoker.py:103:43: note: def __init__(self, group: None = ..., target: Optional[Callable[..., object]] = ..., name: Optional[str] = ..., args: Iterable[Any] = ..., *, kwargs: Mapping[str, Any], daemon: Optional[bool] = ...) -> Thread
antidote (https://github.com/Finistere/antidote)
+ tests/core/test_thread_safety.py:39: error: Argument "target" to "Thread" has incompatible type "Callable[[], object]"; expected "Callable[[VarArg(Never)], object] | None" [arg-type]
altair (https://github.com/vega/altair)
+ altair/utils/server.py:144: error: Argument "target" to "Thread" has incompatible type "Callable[[], Any]"; expected "Callable[[VarArg(Never)], object] | None" [arg-type]
freqtrade (https://github.com/freqtrade/freqtrade)
+ freqtrade/exchange/exchange_ws.py:30: error: Argument "target" to "Thread" has incompatible type "Callable[[], None]"; expected "Callable[[VarArg(Never)], object] | None" [arg-type]
AutoSplit (https://github.com/Toufool/AutoSplit)
+ src/capture_method/VideoCaptureDeviceCaptureMethod.py:111:45: error: Argument "target" to "Thread" has incompatible type "Callable[[], Any]"; expected "Callable[[VarArg(Never)], object] | None" [arg-type]
mkdocs (https://github.com/mkdocs/mkdocs)
+ mkdocs/livereload/__init__.py:133: error: Cannot infer type of lambda [misc]
+ mkdocs/livereload/__init__.py:133: error: Argument "target" to "Thread" has incompatible type "Callable[[], None]"; expected "Callable[[VarArg(Never)], object] | None" [arg-type]
porcupine (https://github.com/Akuli/porcupine)
+ porcupine/utils.py:798: error: Argument "target" to "Thread" has incompatible type "Callable[[], None]"; expected "Callable[[VarArg(Never)], object] | None" [arg-type]
+ porcupine/_logs.py:115: error: No overload variant of "Thread" matches argument types "Callable[[str], None]", "list[str]" [call-overload]
+ porcupine/_logs.py:115: note: Possible overload variants:
+ porcupine/_logs.py:115: note: def [_Ts`-1] __init__(self, group: None = ..., target: Callable[[VarArg(*_Ts)], object] | None = ..., name: str | None = ..., args: tuple[*_Ts] = ..., *, daemon: bool | None = ...) -> Thread
+ porcupine/_logs.py:115: note: def __init__(self, group: None, target: Callable[..., object] | None, name: str | None, args: Iterable[Any], kwargs: Mapping[str, Any], *, daemon: bool | None = ...) -> Thread
+ porcupine/_logs.py:115: note: def __init__(self, group: None = ..., target: Callable[..., object] | None = ..., name: str | None = ..., args: Iterable[Any] = ..., *, kwargs: Mapping[str, Any], daemon: bool | None = ...) -> Thread
+ porcupine/plugins/langserver.py:52: error: Argument "target" to "Thread" has incompatible type "Callable[[], None]"; expected "Callable[[VarArg(Never)], object] | None" [arg-type]
+ porcupine/plugins/langserver.py:704: error: No overload variant of "Thread" matches argument types "Callable[[IO[bytes], LoggerAdapter[Logger]], None]", "list[object]", "bool" [call-overload]
+ porcupine/plugins/langserver.py:704: note: Possible overload variants:
+ porcupine/plugins/langserver.py:704: note: def [_Ts`-1] __init__(self, group: None = ..., target: Callable[[VarArg(*_Ts)], object] | None = ..., name: str | None = ..., args: tuple[*_Ts] = ..., *, daemon: bool | None = ...) -> Thread
+ porcupine/plugins/langserver.py:704: note: def __init__(self, group: None, target: Callable[..., object] | None, name: str | None, args: Iterable[Any], kwargs: Mapping[str, Any], *, daemon: bool | None = ...) -> Thread
+ porcupine/plugins/langserver.py:704: note: def __init__(self, group: None = ..., target: Callable[..., object] | None = ..., name: str | None = ..., args: Iterable[Any] = ..., *, kwargs: Mapping[str, Any], daemon: bool | None = ...) -> Thread
+ porcupine/plugins/run/no_terminal.py:91: error: No overload variant of "Thread" matches argument types "Callable[[str, dict[str, str]], None]", "list[Collection[str]]", "bool" [call-overload]
+ porcupine/plugins/run/no_terminal.py:91: note: Possible overload variants:
+ porcupine/plugins/run/no_terminal.py:91: note: def [_Ts`-1] __init__(self, group: None = ..., target: Callable[[VarArg(*_Ts)], object] | None = ..., name: str | None = ..., args: tuple[*_Ts] = ..., *, daemon: bool | None = ...) -> Thread
+ porcupine/plugins/run/no_terminal.py:91: note: def __init__(self, group: None, target: Callable[..., object] | None, name: str | None, args: Iterable[Any], kwargs: Mapping[str, Any], *, daemon: bool | None = ...) -> Thread
+ porcupine/plugins/run/no_terminal.py:91: note: def __init__(self, group: None = ..., target: Callable[..., object] | None = ..., name: str | None = ..., args: Iterable[Any] = ..., *, kwargs: Mapping[str, Any], daemon: bool | None = ...) -> Thread
+ porcupine/plugins/run/no_terminal.py:94: error: Item "None" of "Thread | None" has no attribute "start" [union-attr]
mitmproxy (https://github.com/mitmproxy/mitmproxy)
+ mitmproxy/platform/windows.py:440: error: Argument "target" to "Thread" has incompatible type "Callable[[float], None]"; expected "Callable[[VarArg(Never)], object] | None" [arg-type]
cki-lib (https://gitlab.com/cki-project/cki-lib)
+ tests/test_logger.py:134: error: Argument "target" to "Thread" has incompatible type "Callable[[], None]"; expected "Callable[[VarArg(Never)], object] | None" [arg-type]
+ cki_lib/cronjob.py:115: error: No overload variant of "Thread" matches argument types "Callable[[Any], Any]", "list[Any | None]", "bool" [call-overload]
+ cki_lib/cronjob.py:115: note: Possible overload variants:
+ cki_lib/cronjob.py:115: note: def [_Ts`-1] __init__(self, group: None = ..., target: Callable[[VarArg(*_Ts)], object] | None = ..., name: str | None = ..., args: tuple[*_Ts] = ..., *, daemon: bool | None = ...) -> Thread
+ cki_lib/cronjob.py:115: note: def __init__(self, group: None, target: Callable[..., object] | None, name: str | None, args: Iterable[Any], kwargs: Mapping[str, Any], *, daemon: bool | None = ...) -> Thread
+ cki_lib/cronjob.py:115: note: def __init__(self, group: None = ..., target: Callable[..., object] | None = ..., name: str | None = ..., args: Iterable[Any] = ..., *, kwargs: Mapping[str, Any], daemon: bool | None = ...) -> Thread
+ cki_lib/messagequeue.py:372: error: Cannot infer type of lambda [misc]
+ cki_lib/messagequeue.py:372: error: Argument "target" to "Thread" has incompatible type "Callable[[], Any]"; expected "Callable[[VarArg(Never)], object] | None" [arg-type]
+ tests/test_messagequeue.py:434: error: Cannot infer type of lambda [misc]
+ tests/test_messagequeue.py:434: error: Argument "target" to "Thread" has incompatible type "Callable[[], Any]"; expected "Callable[[VarArg(Never)], object] | None" [arg-type]
urllib3 (https://github.com/urllib3/urllib3)
+ test/test_wait.py:192: error: Argument "target" to "Thread" has incompatible type "Callable[[], None]"; expected "Callable[[VarArg(Never)], object] | None" [arg-type]
cwltool (https://github.com/common-workflow-language/cwltool)
+ cwltool/task_queue.py: note: In member "__init__" of class "TaskQueue":
+ cwltool/task_queue.py:47:41: error: Argument "target" to "Thread" has incompatible type "Callable[[], None]"; expected "Callable[[VarArg(Never)], object] | None" [arg-type]
materialize (https://github.com/MaterializeInc/materialize)
+ misc/python/materialize/zippy/kafka_actions.py:175: error: No overload variant of "Thread" matches argument types "Callable[[str, str, bool, list[str], Traceback | None, str | None, bool], None]", "list[str]" [call-overload]
+ misc/python/materialize/zippy/kafka_actions.py:175: note: Possible overload variants:
+ misc/python/materialize/zippy/kafka_actions.py:175: note: def [_Ts`-1] __init__(self, group: None = ..., target: Callable[[VarArg(*_Ts)], object] | None = ..., name: str | None = ..., args: tuple[*_Ts] = ..., *, daemon: bool | None = ...) -> Thread
+ misc/python/materialize/zippy/kafka_actions.py:175: note: def __init__(self, group: None, target: Callable[..., object] | None, name: str | None, args: Iterable[Any], kwargs: Mapping[str, Any], *, daemon: bool | None = ...) -> Thread
+ misc/python/materialize/zippy/kafka_actions.py:175: note: def __init__(self, group: None = ..., target: Callable[..., object] | None = ..., name: str | None = ..., args: Iterable[Any] = ..., *, kwargs: Mapping[str, Any], daemon: bool | None = ...) -> Thread
+ misc/python/materialize/checks/executors.py:68: error: No overload variant of "Thread" matches argument types "Callable[[str, Traceback | None, str | None], None]", "list[str | Traceback | None]" [call-overload]
+ misc/python/materialize/checks/executors.py:68: note: Possible overload variants:
+ misc/python/materialize/checks/executors.py:68: note: def [_Ts`-1] __init__(self, group: None = ..., target: Callable[[VarArg(*_Ts)], object] | None = ..., name: str | None = ..., args: tuple[*_Ts] = ..., *, daemon: bool | None = ...) -> Thread
+ misc/python/materialize/checks/executors.py:68: note: def __init__(self, group: None, target: Callable[..., object] | None, name: str | None, args: Iterable[Any], kwargs: Mapping[str, Any], *, daemon: bool | None = ...) -> Thread
+ misc/python/materialize/checks/executors.py:68: note: def __init__(self, group: None = ..., target: Callable[..., object] | None = ..., name: str | None = ..., args: Iterable[Any] = ..., *, kwargs: Mapping[str, Any], daemon: bool | None = ...) -> Thread
anyio (https://github.com/agronholm/anyio)
+ src/anyio/from_thread.py:489: error: Argument "target" to "Thread" has incompatible type "Callable[[], None]"; expected "Callable[[VarArg(Never)], object] | None" [arg-type]
cloud-init (https://github.com/canonical/cloud-init)
+ cloudinit/reporting/handlers.py:102: error: Argument "target" to "Thread" has incompatible type "Callable[[], Any]"; expected "Callable[[VarArg(Never)], object] | None" [arg-type]
+ cloudinit/reporting/handlers.py:213: error: Argument "target" to "Thread" has incompatible type "Callable[[], Any]"; expected "Callable[[VarArg(Never)], object] | None" [arg-type]
kopf (https://github.com/nolar/kopf)
+ kopf/_kits/runner.py:78: error: Argument "target" to "Thread" has incompatible type "Callable[[], None]"; expected "Callable[[VarArg(Never)], object] | None" [arg-type]
trio (https://github.com/python-trio/trio)
+ src/trio/_core/_thread_cache.py:149: error: Argument "target" to "Thread" has incompatible type "Callable[[], None]"; expected "Optional[Callable[[VarArg(Never)], object]]" [arg-type]
+ src/trio/_tests/test_threads.py:79: error: Argument "target" to "Thread" has incompatible type "Callable[[], None]"; expected "Optional[Callable[[VarArg(Never)], object]]" [arg-type]
+ src/trio/_tests/test_threads.py:165: error: Argument "target" to "Thread" has incompatible type "Callable[[], None]"; expected "Optional[Callable[[VarArg(Never)], object]]" [arg-type]
+ src/trio/_tests/test_ssl.py:497: error: Argument "target" to "Thread" has incompatible type "Callable[[], None]"; expected "Optional[Callable[[VarArg(Never)], object]]" [arg-type]
core (https://github.com/home-assistant/core)
+ homeassistant/helpers/template.py:704: error: Argument "target" to "ThreadWithException" has incompatible type "Callable[[], None]"; expected "Callable[[VarArg(Never)], object] | None" [arg-type]
+ homeassistant/components/stream/__init__.py:395: error: Argument "target" to "Thread" has incompatible type "Callable[[], None]"; expected "Callable[[VarArg(Never)], object] | None" [arg-type]
+ homeassistant/components/downloader/__init__.py:153: error: Argument "target" to "Thread" has incompatible type "Callable[[], None]"; expected "Callable[[VarArg(Never)], object] | None" [arg-type]
+ homeassistant/components/debugpy/__init__.py:66: error: Argument "target" to "Thread" has incompatible type "Callable[[], Any]"; expected "Callable[[VarArg(Never)], object] | None" [arg-type]