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

fix misleading error message: MyPy should not suggest a syntactic error when function calls are included in type annotations #17160

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dexterkennedy
Copy link
Contributor

#16506

This Pull request makes it obvious that function calls in type annotations are not allowed and gets rid of the previous misleading error that the function called should be changed too foo[...] instead of foo(...)

Copy link
Contributor

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

ibis (https://github.com/ibis-project/ibis)
- ibis/expr/tests/test_schema.py:292: note: Suggestion: use dt.Array[...] instead of dt.Array(...)
+ ibis/expr/tests/test_schema.py:292: note: Suggestion: Don't use function calls in type annotations
- ibis/expr/datatypes/tests/test_core.py:114: note: Suggestion: use dt.Timestamp[...] instead of dt.Timestamp(...)
+ ibis/expr/datatypes/tests/test_core.py:114: note: Suggestion: Don't use function calls in type annotations
- ibis/expr/datatypes/tests/test_core.py:115: note: Suggestion: use dt.Timestamp[...] instead of dt.Timestamp(...)
+ ibis/expr/datatypes/tests/test_core.py:115: note: Suggestion: Don't use function calls in type annotations
- ibis/expr/datatypes/tests/test_core.py:116: note: Suggestion: use dt.Interval[...] instead of dt.Interval(...)
+ ibis/expr/datatypes/tests/test_core.py:116: note: Suggestion: Don't use function calls in type annotations
- ibis/expr/datatypes/tests/test_core.py:118: note: Suggestion: use dt.Decimal[...] instead of dt.Decimal(...)
+ ibis/expr/datatypes/tests/test_core.py:118: note: Suggestion: Don't use function calls in type annotations
- ibis/expr/datatypes/tests/test_core.py:119: note: Suggestion: use dt.Array[...] instead of dt.Array(...)
+ ibis/expr/datatypes/tests/test_core.py:119: note: Suggestion: Don't use function calls in type annotations
- ibis/expr/datatypes/tests/test_core.py:120: note: Suggestion: use dt.Map[...] instead of dt.Map(...)
+ ibis/expr/datatypes/tests/test_core.py:120: note: Suggestion: Don't use function calls in type annotations
- ibis/backends/datafusion/udfs.py:22: note: Suggestion: use dt.Timestamp[...] instead of dt.Timestamp(...)
+ ibis/backends/datafusion/udfs.py:22: note: Suggestion: Don't use function calls in type annotations
- ibis/backends/datafusion/udfs.py:30: note: Suggestion: use dt.Timestamp[...] instead of dt.Timestamp(...)
+ ibis/backends/datafusion/udfs.py:30: note: Suggestion: Don't use function calls in type annotations
- ibis/backends/datafusion/udfs.py:42: note: Suggestion: use dt.Timestamp[...] instead of dt.Timestamp(...)
+ ibis/backends/datafusion/udfs.py:42: note: Suggestion: Don't use function calls in type annotations
- ibis/backends/datafusion/udfs.py:50: note: Suggestion: use dt.Timestamp[...] instead of dt.Timestamp(...)
+ ibis/backends/datafusion/udfs.py:50: note: Suggestion: Don't use function calls in type annotations
- ibis/backends/datafusion/udfs.py:111: note: Suggestion: use dt.Timestamp[...] instead of dt.Timestamp(...)
+ ibis/backends/datafusion/udfs.py:111: note: Suggestion: Don't use function calls in type annotations

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.

1 participant