mypy
mypy copied to clipboard
fix misleading error message: MyPy should not suggest a syntactic error when function calls are included in type annotations
#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(...)
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