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

PyCharm indicates wrong type for lambda #928

Closed
michaeloliverx opened this issue Aug 28, 2020 · 3 comments
Closed

PyCharm indicates wrong type for lambda #928

michaeloliverx opened this issue Aug 28, 2020 · 3 comments
Assignees
Labels
bug Unexpected behaviour and bugs

Comments

@michaeloliverx
Copy link
Contributor

Bug report

What's wrong

While using PyCharm, lambda type in Schema results in Expected type 'FunctionType', got '() -> Dict[str, Union[str, Any]]' instead
Screenshot 2020-08-28 at 07 59 37

How is that should be

Is this warning correct? The code runs perfectly fine but maybe the Type maybe be wrong here. On this SO post they mentioned using the from typing import Callable for type hinting a lambda.

System information

❯ python3 --version
Python 3.8.5

❯ sw_vers
ProductName:	macOS
ProductVersion:	11.0
BuildVersion:	20A5354i

PyCharm 2020.2.1

@lk-geimfari
Copy link
Owner

lk-geimfari commented Aug 28, 2020

I've noticed this behavior too. I think this happens since one of the last releases of mypy. We can use Callable.

@lk-geimfari lk-geimfari self-assigned this Aug 28, 2020
@lk-geimfari lk-geimfari added the bug Unexpected behaviour and bugs label Aug 28, 2020
@lk-geimfari
Copy link
Owner

If you have free time then you can create a PR, of course.

lk-geimfari added a commit that referenced this issue Aug 28, 2020
@michaeloliverx
Copy link
Contributor Author

Sorry I didn't get time, I see you have started now :)
Maybe next time !

lk-geimfari added a commit that referenced this issue Aug 29, 2020
* Fix #928

* Fix type for schema

* Add setup.py to mypy ignore

* Add alias SchemaType
lk-geimfari added a commit that referenced this issue Sep 7, 2020
* Fix #928

* Fix type for schema

* Add setup.py to mypy ignore

* Add alias SchemaType

* Add thanks for JetBrains
lk-geimfari added a commit that referenced this issue Nov 14, 2020
* Fix #928

* Fix type for schema

* Add setup.py to mypy ignore

* Add alias SchemaType

* Add thanks for JetBrains

* Fix #968
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Unexpected behaviour and bugs
Projects
None yet
Development

No branches or pull requests

2 participants