Sync typeshed by hauntsaninja · Pull Request #10537 · python/mypy

Diff from mypy_primer, showing the effect of this PR on open source code:

jax (https://github.com/google/jax.git)
+ jax/_src/config.py:280: error: Argument 1 has incompatible type "Union[Any, _Unset]"; expected "Optional[str]"  [arg-type]
+ jax/_src/numpy/lax_numpy.py:1761: error: Argument 1 to "_wraps" has incompatible type "Optional[Any]"; expected "Callable[..., Any]"  [arg-type]

kopf (https://github.com/nolar/kopf.git)
+ kopf/_cogs/structs/dicts.py:297: error: Unsupported operand types for + ("Tuple[str, ...]" and "Tuple[_K]")
+ kopf/_cogs/structs/dicts.py:323: error: Unsupported operand types for + ("Tuple[str, ...]" and "Tuple[_K]")
+ kopf/cli.py:95: error: Unsupported operand types for + ("Tuple[Union[str, Pattern[Any]], ...]" and "Tuple[Optional[str]]")

werkzeug (https://github.com/pallets/werkzeug.git)
+ src/werkzeug/local.py:223: error: Need type annotation for "rv"
+ src/werkzeug/local.py:226: error: unused "type: ignore" comment
+ src/werkzeug/wrappers/request.py:429: error: unused "type: ignore" comment
+ tests/live_apps/run.py:22: error: Need type annotation for "kwargs"

ignite (https://github.com/pytorch/ignite)
- ignite/handlers/checkpoint.py:695: error: Incompatible types in assignment (expression has type "None", variable has type "_TemporaryFileWrapper")  [assignment]
+ ignite/handlers/checkpoint.py:695: error: Incompatible types in assignment (expression has type "None", variable has type "_TemporaryFileWrapper[Any]")  [assignment]
- ignite/handlers/checkpoint.py:697: error: Incompatible types in assignment (expression has type "IO[bytes]", variable has type "_TemporaryFileWrapper")  [assignment]
+ ignite/contrib/handlers/time_profilers.py:640: error: Incompatible return value type (got "List[List[Union[Any, str, float, Tuple[Union[str, float], Union[str, float]]]]]", expected "List[List[Union[str, float]]]")  [return-value]
+ ignite/contrib/handlers/neptune_logger.py:587: error: unused "type: ignore" comment

flake8 (https://github.com/pycqa/flake8.git)
+ src/flake8/plugins/manager.py:505: error: Need type annotation for "plugins"
+ src/flake8/plugins/manager.py:514: error: Need type annotation for "plugins"
+ src/flake8/plugins/manager.py:523: error: Need type annotation for "plugins"

core (https://github.com/home-assistant/core.git)
+ homeassistant/helpers/deprecation.py:29: error: Need type annotation for "warnings"  [var-annotated]
+ homeassistant/components/brother/sensor.py:43: error: Incompatible types (expression has type "Optional[Any]", TypedDict item "sw_version" has type "str")  [typeddict-item]

streamlit (https://github.com/streamlit/streamlit.git)
+ lib/tests/streamlit/config_test.py: note: In member "setUp" of class "ConfigTest":
+ lib/tests/streamlit/config_test.py:45:13: error: "object" has no attribute "start"  [attr-defined]
+ lib/tests/streamlit/config_test.py: note: In member "tearDown" of class "ConfigTest":
+ lib/tests/streamlit/config_test.py:49:13: error: "object" has no attribute "stop"  [attr-defined]
+ lib/tests/streamlit/config_test.py: note: In member "setUp" of class "ConfigLoadingTest":
+ lib/tests/streamlit/config_test.py:590:13: error: "object" has no attribute "start"  [attr-defined]
+ lib/tests/streamlit/config_test.py: note: In member "tearDown" of class "ConfigLoadingTest":
+ lib/tests/streamlit/config_test.py:594:13: error: "object" has no attribute "stop"  [attr-defined]
+ lib/tests/streamlit/scriptrunner/script_runner_test.py: note: In member "get_widget_id" of class "TestScriptRunner":
+ lib/tests/streamlit/scriptrunner/script_runner_test.py:583:24: error: Item "None" of "Optional[Any]" has no attribute "id"  [union-attr]

freqtrade (https://github.com/freqtrade/freqtrade.git)
+ freqtrade/strategy/hyper.py:294: error: Argument 1 to "_load_params" of "HyperStrategyMixin" has incompatible type "Optional[Any]"; expected "Dict[Any, Any]"
+ freqtrade/strategy/hyper.py:295: error: Argument 1 to "_load_params" of "HyperStrategyMixin" has incompatible type "Optional[Any]"; expected "Dict[Any, Any]"

pydantic (https://github.com/samuelcolvin/pydantic.git)
+ pydantic/typing.py:123: error: Incompatible return value type (got "Optional[Any]", expected "Type[Any]")  [return-value]
+ pydantic/datetime_parse.py:248: error: unused "type: ignore" comment
+ pydantic/annotated_types.py:46: error: Value expression in dictionary comprehension has incompatible type "object"; expected type "Type[Any]"  [misc]

sphinx (https://github.com/sphinx-doc/sphinx.git)
+ sphinx/util/requests.py: note: In function "is_ssl_error":
+ sphinx/util/requests.py:54:16: error: Need type annotation for "args"
+ sphinx/ext/napoleon/docstring.py: note: In member "_lookup_annotation" of class "GoogleDocstring":
+ sphinx/ext/napoleon/docstring.py:864:31: error: Need type annotation for "localns"
+ sphinx/ext/viewcode.py: note: In function "env_purge_doc":
+ sphinx/ext/viewcode.py:161:15: error: Need type annotation for "modules"

starlette (https://github.com/encode/starlette.git)
+ starlette/routing.py:340: error: Incompatible return value type (got "Optional[Any]", expected "List[BaseRoute]")
+ starlette/routing.py:418: error: Incompatible return value type (got "Optional[Any]", expected "List[BaseRoute]")

pandas (https://github.com/pandas-dev/pandas.git)
+ pandas/io/stata.py:2459: error: Need type annotation for "convert_strl"  [var-annotated]
+ pandas/io/pytables.py:3340: error: Argument 1 to "enumerate" has incompatible type "Optional[Any]"; expected "Iterable[Any]"  [arg-type]
+ pandas/io/pytables.py:3341: error: Value of type "Optional[Any]" is not indexable  [index]
+ pandas/io/pytables.py:3588: error: Argument 1 to "_dtype_to_kind" has incompatible type "Optional[Any]"; expected "str"  [arg-type]
+ pandas/core/window/rolling.py:990: error: "None" not callable  [misc]
+ pandas/compat/pickle_compat.py:201: error: unused "type: ignore" comment
+ pandas/compat/pickle_compat.py:272: error: "Unpickler" has no attribute "is_verbose"  [attr-defined]

paasta (https://github.com/yelp/paasta.git)
+ paasta_tools/kubernetes_tools.py:2040: error: Need type annotation for "stream_lines"

aiohttp (https://github.com/aio-libs/aiohttp.git)
+ aiohttp/web_urldispatcher.py:930: error: Incompatible types in assignment (expression has type "Optional[Any]", variable has type "Callable[[], Awaitable[StreamResponse]]")  [assignment]

graphql-core (https://github.com/graphql-python/graphql-core.git)
+ src/graphql/language/visitor.py:204: error: Incompatible return value type (got "Optional[Any]", expected "Callable[..., Any]")
+ src/graphql/validation/rules/unique_directives_per_location.py:56: error: Incompatible types in assignment (expression has type "Optional[Any]", variable has type "List[DirectiveNode]")

anyio (https://github.com/agronholm/anyio.git)
+ src/anyio/_core/_typedattr.py:29: error: Need type annotation for "annotations"

rich (https://github.com/willmcgugan/rich.git)
+ rich/measure.py:105: error: Incompatible types in assignment (expression has type "Optional[Any]", variable has type "Callable[[Console, ConsoleOptions], Measurement]")

janus (https://github.com/aio-libs/janus.git)
+ janus/__init__.py:26: error: "None" not callable

pyppeteer (https://github.com/pyppeteer/pyppeteer.git)
+ pyppeteer/network_manager.py:157: error: No overload variant of "get" of "Mapping" matches argument type "str"
+ pyppeteer/network_manager.py:157: note:     <1 more non-matching overload not shown>
+ pyppeteer/network_manager.py:157: note:     def get(self, key: <nothing>) -> None
+ pyppeteer/network_manager.py:157: note: Possible overload variant:
+ pyppeteer/network_manager.py:158: error: No overload variant of "get" of "Mapping" matches argument type "str"
+ pyppeteer/network_manager.py:158: note:     <1 more non-matching overload not shown>
+ pyppeteer/network_manager.py:158: note:     def get(self, key: <nothing>) -> None
+ pyppeteer/network_manager.py:158: note: Possible overload variant:

tornado (https://github.com/tornadoweb/tornado.git)
+ tornado/httputil.py:411: error: Unsupported operand types for + ("str" and "None")
+ tornado/httputil.py:411: note: Both left and right operands are unions
+ tornado/wsgi.py:194: error: Unsupported operand types for + ("str" and "None")
+ tornado/wsgi.py:194: note: Right operand is of type "Optional[Any]"
+ tornado/auth.py:323: error: Argument 3 to "getattr" has incompatible type "bool"; expected "Optional[str]"

pytest (https://github.com/pytest-dev/pytest.git)
+ src/_pytest/config/__init__.py:1057: error: Argument 3 to "getattr" has incompatible type "bool"; expected "Optional[Namespace]"  [arg-type]
+ src/_pytest/mark/structures.py:371: error: Need type annotation for "mark_list"  [var-annotated]
+ src/_pytest/terminal.py:1329: error: Need type annotation for "keywords"  [var-annotated]
+ src/_pytest/python.py:411: error: Need type annotation for "dicts"  [var-annotated]
+ src/_pytest/junitxml.py:629: error: Argument 3 to "getattr" has incompatible type "float"; expected "int"  [arg-type]