Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync typeshed #10537

Merged
merged 3 commits into from
Jun 11, 2021
Merged

Sync typeshed #10537

merged 3 commits into from
Jun 11, 2021

Conversation

hauntsaninja
Copy link
Collaborator

Source commit:
python/typeshed@c4da375

Recent typeshed commit broke mypy tests, syncing here so I can fix

@JelleZijlstra
Copy link
Member

I think @JukkaL avoided bringing in the most recent typeshed changes so he didn't have to redo internal testing; let's wait for him to confirm it's OK to merge this.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions
Copy link
Contributor

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]

@dfoerster-athene
Copy link

Is this change expected to be released soon? mypy 0.910 doesn't appear to have included it, so stable API items like StrOrBytesPath have been missing from mypy for over five months now. This is producing API conflicts with other typecheckers like Pylance.

@hauntsaninja
Copy link
Collaborator Author

Hopefully! #11158 is the issue for that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants