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 #12663

Merged
merged 2 commits into from
Apr 23, 2022
Merged

Sync typeshed #12663

merged 2 commits into from
Apr 23, 2022

Conversation

hauntsaninja
Copy link
Collaborator

Source commit:
python/typeshed@5dad506

hauntsaninja added 2 commits April 23, 2022 13:46
@github-actions

This comment has been minimized.

JelleZijlstra added a commit to JelleZijlstra/werkzeug that referenced this pull request Apr 23, 2022
If you don't care what the callable returns, it's better to use `object` so users can pass a callable that returns something else. For example, some `.write()` methods return the number of bytes written.

Noticed this in python/mypy#12663.
@hauntsaninja
Copy link
Collaborator Author

and you checked the kornia ones in python/typeshed#7655 (comment)

@github-actions
Copy link
Contributor

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

rclip (https://github.com/yurijmikhalevich/rclip)
+ rclip/db.py:70: error: Argument 1 to "update" of "MutableMapping" has incompatible type "NewImage"; expected "SupportsKeysAndGetItem[str, None]"
+ rclip/db.py:70: note:         def __getitem__(self, str) -> None
- rclip/db.py:70: error: Argument 1 to "update" of "MutableMapping" has incompatible type "NewImage"; expected "SupportsKeysAndGetItem[Any, None]"
- rclip/db.py:70: note:         def __getitem__(self, Any) -> None

kornia (https://github.com/kornia/kornia)
+ kornia/augmentation/container/image.py:331: error: Invalid index type "Union[str, Any]" for "List[ParamItem]"; expected type "SupportsIndex"  [index]
+ kornia/augmentation/container/image.py:340: error: Item "None" of "Union[ParamItem, Any, None]" has no attribute "data"  [union-attr]
+ kornia/augmentation/container/image.py:340: error: Argument 2 to "inverse" of "ImageSequential" has incompatible type "Union[Dict[Any, Any], List[Any], None, Any]"; expected "Optional[List[ParamItem]]"  [arg-type]
+ kornia/augmentation/container/augment.py:221: error: Invalid index type "Union[str, Any]" for "List[ParamItem]"; expected type "SupportsIndex"  [index]

werkzeug (https://github.com/pallets/werkzeug)
+ src/werkzeug/middleware/lint.py:414: error: Argument 1 to "GuardedWrite" has incompatible type "Callable[[bytes], object]"; expected "Callable[[bytes], None]"  [arg-type]
- tests/test_wrappers.py:1109: error: Function is missing a return type annotation  [no-untyped-def]

core (https://github.com/home-assistant/core)
- homeassistant/components/sonos/media.py:138: error: Argument 1 to "int" has incompatible type "Optional[Any]"; expected "Union[str, bytes, SupportsInt, SupportsIndex, SupportsTrunc]"  [arg-type]
+ homeassistant/components/sonos/media.py:138: error: Argument 1 to "int" has incompatible type "Optional[Any]"; expected "Union[str, bytes, array[Any], mmap, _CData, SupportsInt, SupportsIndex, SupportsTrunc]"  [arg-type]

@hauntsaninja hauntsaninja merged commit 40bbfb5 into python:master Apr 23, 2022
@hauntsaninja hauntsaninja deleted the sync branch April 23, 2022 21:45
davidism pushed a commit to JelleZijlstra/werkzeug that referenced this pull request Apr 24, 2022
If you don't care what the callable returns, it's better to use `object` so users can pass a callable that returns something else. For example, some `.write()` methods return the number of bytes written.

Noticed this in python/mypy#12663.
DamianZaremba added a commit to DamianZaremba/django-stubs that referenced this pull request May 25, 2022
- Updates test_model_field_classes_from_existing_locations to account
  for the behaviour change in python/mypy#12663
- Bumps the version of django-stubs for a new release
sobolevn pushed a commit to typeddjango/django-stubs that referenced this pull request May 25, 2022
- Updates test_model_field_classes_from_existing_locations to account
  for the behaviour change in python/mypy#12663
- Bumps the version of django-stubs for a new release
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.

2 participants