Skip to content

Fix wrong names listed in "too few arguments" message #19354

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

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

sterliakov
Copy link
Collaborator

Fixes #12755. When some arguments are passed as keywords, only report everything before them as positional, report per-item missing kwargs for the rest. This logic craves for more tests, let's see if I got the idea right first.

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/datatypes/core.py:284: error: Too few arguments for "Struct"  [call-arg]
+ ibis/expr/datatypes/core.py:284: error: Missing named argument "fields" for "Struct"  [call-arg]
- ibis/expr/datatypes/core.py:959: error: Too few arguments for "Struct"  [call-arg]
+ ibis/expr/datatypes/core.py:959: error: Missing named argument "fields" for "Struct"  [call-arg]
- ibis/backends/sql/datatypes.py:208: error: Too few arguments for "Array"  [call-arg]
+ ibis/backends/sql/datatypes.py:208: error: Missing named argument "value_type" for "Array"  [call-arg]
- ibis/backends/sql/datatypes.py:254: error: Too few arguments for "Map"  [call-arg]
+ ibis/backends/sql/datatypes.py:254: error: Missing named argument "value_type" for "Map"  [call-arg]
- ibis/backends/sql/datatypes.py:272: error: Too few arguments for "Struct"  [call-arg]
+ ibis/backends/sql/datatypes.py:272: error: Missing named argument "fields" for "Struct"  [call-arg]
- ibis/backends/sql/datatypes.py:319: error: Too few arguments for "Interval"  [call-arg]
+ ibis/backends/sql/datatypes.py:319: error: Missing named argument "unit" for "Interval"  [call-arg]
- ibis/backends/sql/datatypes.py:866: error: Too few arguments for "Array"  [call-arg]
+ ibis/backends/sql/datatypes.py:866: error: Missing named argument "value_type" for "Array"  [call-arg]
- ibis/backends/sql/datatypes.py:1253: error: Too few arguments for "Array"  [call-arg]
+ ibis/backends/sql/datatypes.py:1253: error: Missing named argument "value_type" for "Array"  [call-arg]
- ibis/backends/sql/datatypes.py:1254: error: Too few arguments for "Array"  [call-arg]
+ ibis/backends/sql/datatypes.py:1254: error: Missing named argument "value_type" for "Array"  [call-arg]
- ibis/backends/sql/datatypes.py:1318: error: Too few arguments for "Array"  [call-arg]
+ ibis/backends/sql/datatypes.py:1318: error: Missing named argument "value_type" for "Array"  [call-arg]
- ibis/backends/sql/datatypes.py:1321: error: Too few arguments for "Struct"  [call-arg]
+ ibis/backends/sql/datatypes.py:1321: error: Missing named argument "fields" for "Struct"  [call-arg]
- ibis/formats/pyarrow.py:90: error: Too few arguments for "Interval"  [call-arg]
+ ibis/formats/pyarrow.py:90: error: Missing named argument "unit" for "Interval"  [call-arg]
- ibis/formats/pyarrow.py:95: error: Too few arguments for "Array"  [call-arg]
+ ibis/formats/pyarrow.py:95: error: Missing named argument "value_type" for "Array"  [call-arg]
- ibis/formats/pyarrow.py:98: error: Too few arguments for "Array"  [call-arg]
+ ibis/formats/pyarrow.py:98: error: Missing named argument "value_type" for "Array"  [call-arg]
- ibis/formats/pyarrow.py:103: error: Too few arguments for "Struct"  [call-arg]
+ ibis/formats/pyarrow.py:103: error: Missing named argument "fields" for "Struct"  [call-arg]
- ibis/formats/pyarrow.py:108: error: Too few arguments for "Map"  [call-arg]
+ ibis/formats/pyarrow.py:108: error: Missing named argument "value_type" for "Map"  [call-arg]
- ibis/formats/polars.py:70: error: Too few arguments for "Array"  [call-arg]
+ ibis/formats/polars.py:70: error: Missing named argument "value_type" for "Array"  [call-arg]
- ibis/formats/numpy.py:54: error: Too few arguments for "Interval"  [call-arg]
+ ibis/formats/numpy.py:54: error: Missing named argument "unit" for "Interval"  [call-arg]
- ibis/expr/types/generic.py:1252: error: Missing positional argument "arg" in call to "GroupConcat"  [call-arg]
+ ibis/expr/types/generic.py:1252: error: Missing named argument "arg" for "GroupConcat"  [call-arg]
- ibis/expr/types/generic.py:1809: error: Too few arguments for "ApproxCountDistinct"  [call-arg]
+ ibis/expr/types/generic.py:1809: error: Missing named argument "arg" for "ApproxCountDistinct"  [call-arg]
- ibis/expr/types/generic.py:1851: error: Too few arguments for "ApproxMedian"  [call-arg]
+ ibis/expr/types/generic.py:1851: error: Missing named argument "arg" for "ApproxMedian"  [call-arg]
- ibis/expr/types/generic.py:1880: error: Too few arguments for "Mode"  [call-arg]
+ ibis/expr/types/generic.py:1880: error: Missing named argument "arg" for "Mode"  [call-arg]
- ibis/expr/types/generic.py:1909: error: Too few arguments for "Max"  [call-arg]
+ ibis/expr/types/generic.py:1909: error: Missing named argument "arg" for "Max"  [call-arg]
- ibis/expr/types/generic.py:1938: error: Too few arguments for "Min"  [call-arg]
+ ibis/expr/types/generic.py:1938: error: Missing named argument "arg" for "Min"  [call-arg]
- ibis/expr/types/generic.py:1972: error: Missing positional argument "arg" in call to "ArgMax"  [call-arg]
+ ibis/expr/types/generic.py:1972: error: Missing named argument "arg" for "ArgMax"  [call-arg]
- ibis/expr/types/generic.py:2011: error: Missing positional argument "arg" in call to "ArgMin"  [call-arg]
+ ibis/expr/types/generic.py:2011: error: Missing named argument "arg" for "ArgMin"  [call-arg]
- ibis/expr/types/generic.py:2072: error: Too few arguments for "Median"  [call-arg]
+ ibis/expr/types/generic.py:2072: error: Missing named argument "arg" for "Median"  [call-arg]
- ibis/expr/types/generic.py:2145: error: Too few arguments  [call-arg]
+ ibis/expr/types/generic.py:2145: error: Missing named argument "quantile"  [call-arg]
- ibis/expr/types/generic.py:2174: error: Too few arguments for "CountDistinct"  [call-arg]
+ ibis/expr/types/generic.py:2174: error: Missing named argument "arg" for "CountDistinct"  [call-arg]
- ibis/expr/types/generic.py:2326: error: Too few arguments for "Arbitrary"  [call-arg]
+ ibis/expr/types/generic.py:2326: error: Missing named argument "arg" for "Arbitrary"  [call-arg]
- ibis/expr/types/generic.py:2360: error: Too few arguments for "Count"  [call-arg]
+ ibis/expr/types/generic.py:2360: error: Missing named argument "arg" for "Count"  [call-arg]
- ibis/expr/types/generic.py:2473: error: Too few arguments for "First"  [call-arg]
+ ibis/expr/types/generic.py:2473: error: Missing named argument "arg" for "First"  [call-arg]
- ibis/expr/types/generic.py:2527: error: Too few arguments for "Last"  [call-arg]
+ ibis/expr/types/generic.py:2527: error: Missing named argument "arg" for "Last"  [call-arg]
- ibis/expr/types/numeric.py:814: error: Missing positional argument "arg" in call to "Kurtosis"  [call-arg]
+ ibis/expr/types/numeric.py:814: error: Missing named argument "arg" for "Kurtosis"  [call-arg]
- ibis/expr/types/numeric.py:865: error: Missing positional argument "arg" in call to "StandardDev"  [call-arg]
+ ibis/expr/types/numeric.py:865: error: Missing named argument "arg" for "StandardDev"  [call-arg]
- ibis/expr/types/numeric.py:916: error: Missing positional argument "arg" in call to "Variance"  [call-arg]
+ ibis/expr/types/numeric.py:916: error: Missing named argument "arg" for "Variance"  [call-arg]
- ibis/expr/types/numeric.py:972: error: Too few arguments for "Correlation"  [call-arg]
+ ibis/expr/types/numeric.py:972: error: Missing named argument "right" for "Correlation"  [call-arg]
- ibis/expr/types/numeric.py:1035: error: Missing positional argument "right" in call to "Covariance"  [call-arg]
+ ibis/expr/types/numeric.py:1035: error: Missing named argument "right" for "Covariance"  [call-arg]
- ibis/expr/types/numeric.py:1096: error: Too few arguments for "Mean"  [call-arg]
+ ibis/expr/types/numeric.py:1096: error: Missing named argument "arg" for "Mean"  [call-arg]
- ibis/expr/types/numeric.py:1198: error: Too few arguments for "Sum"  [call-arg]
+ ibis/expr/types/numeric.py:1198: error: Missing named argument "arg" for "Sum"  [call-arg]
- ibis/expr/types/numeric.py:1467: error: Too few arguments  [call-arg]
+ ibis/expr/types/numeric.py:1467: error: Missing named argument "quantile"  [call-arg]
- ibis/expr/types/numeric.py:1670: error: Too few arguments for "BitAnd"  [call-arg]
+ ibis/expr/types/numeric.py:1670: error: Missing named argument "arg" for "BitAnd"  [call-arg]
- ibis/expr/types/numeric.py:1689: error: Too few arguments for "BitOr"  [call-arg]
+ ibis/expr/types/numeric.py:1689: error: Missing named argument "arg" for "BitOr"  [call-arg]
- ibis/expr/types/numeric.py:1708: error: Too few arguments for "BitXor"  [call-arg]
+ ibis/expr/types/numeric.py:1708: error: Missing named argument "arg" for "BitXor"  [call-arg]
- ibis/expr/types/relations.py:2581: error: Too few arguments for "CountDistinctStar"  [call-arg]
+ ibis/expr/types/relations.py:2581: error: Missing named argument "arg" for "CountDistinctStar"  [call-arg]
- ibis/expr/types/relations.py:2626: error: Too few arguments for "CountStar"  [call-arg]
+ ibis/expr/types/relations.py:2626: error: Missing named argument "arg" for "CountStar"  [call-arg]
- ibis/expr/types/logical.py:411: error: Too few arguments for "All"  [call-arg]
+ ibis/expr/types/logical.py:411: error: Missing named argument "arg" for "All"  [call-arg]
- ibis/expr/types/geospatial.py:1665: error: Too few arguments for "GeoUnaryUnion"  [call-arg]
+ ibis/expr/types/geospatial.py:1665: error: Missing named argument "arg" for "GeoUnaryUnion"  [call-arg]
- ibis/formats/tests/test_pyarrow.py:78: error: Too few arguments for "Array"  [call-arg]
+ ibis/formats/tests/test_pyarrow.py:78: error: Missing named argument "value_type" for "Array"  [call-arg]
- ibis/backends/flink/datatypes.py:74: error: Too few arguments for "Struct"  [call-arg]
+ ibis/backends/flink/datatypes.py:74: error: Missing named argument "fields" for "Struct"  [call-arg]
- ibis/backends/databricks/__init__.py:47: error: Too few arguments for "Array"  [call-arg]
+ ibis/backends/databricks/__init__.py:47: error: Missing named argument "value_type" for "Array"  [call-arg]
- ibis/backends/databricks/__init__.py:62: error: Too few arguments for "Struct"  [call-arg]
+ ibis/backends/databricks/__init__.py:62: error: Missing named argument "fields" for "Struct"  [call-arg]
- ibis/backends/clickhouse/tests/test_datatypes.py:73: error: Too few arguments for "Array"  [call-arg]
+ ibis/backends/clickhouse/tests/test_datatypes.py:73: error: Missing named argument "value_type" for "Array"  [call-arg]
- ibis/backends/clickhouse/tests/test_datatypes.py:78: error: Too few arguments for "Array"  [call-arg]
+ ibis/backends/clickhouse/tests/test_datatypes.py:78: error: Missing named argument "value_type" for "Array"  [call-arg]
- ibis/backends/clickhouse/tests/test_datatypes.py:83: error: Too few arguments for "Array"  [call-arg]
+ ibis/backends/clickhouse/tests/test_datatypes.py:83: error: Missing named argument "value_type" for "Array"  [call-arg]
- ibis/backends/clickhouse/tests/test_datatypes.py:88: error: Too few arguments for "Array"  [call-arg]
+ ibis/backends/clickhouse/tests/test_datatypes.py:88: error: Missing named argument "value_type" for "Array"  [call-arg]
- ibis/backends/clickhouse/tests/test_datatypes.py:93: error: Too few arguments for "Array"  [call-arg]
+ ibis/backends/clickhouse/tests/test_datatypes.py:93: error: Missing named argument "value_type" for "Array"  [call-arg]
- ibis/backends/clickhouse/tests/test_datatypes.py:98: error: Too few arguments for "Array"  [call-arg]
+ ibis/backends/clickhouse/tests/test_datatypes.py:98: error: Missing named argument "value_type" for "Array"  [call-arg]
- ibis/backends/clickhouse/tests/test_datatypes.py:103: error: Too few arguments for "Array"  [call-arg]
+ ibis/backends/clickhouse/tests/test_datatypes.py:103: error: Missing named argument "value_type" for "Array"  [call-arg]
- ibis/backends/clickhouse/tests/test_datatypes.py:108: error: Too few arguments for "Array"  [call-arg]
+ ibis/backends/clickhouse/tests/test_datatypes.py:108: error: Missing named argument "value_type" for "Array"  [call-arg]
- ibis/backends/clickhouse/tests/test_datatypes.py:113: error: Too few arguments for "Array"  [call-arg]
+ ibis/backends/clickhouse/tests/test_datatypes.py:113: error: Missing named argument "value_type" for "Array"  [call-arg]
- ibis/backends/clickhouse/tests/test_datatypes.py:118: error: Too few arguments for "Array"  [call-arg]
+ ibis/backends/clickhouse/tests/test_datatypes.py:118: error: Missing named argument "value_type" for "Array"  [call-arg]
- ibis/backends/clickhouse/tests/test_datatypes.py:123: error: Too few arguments for "Array"  [call-arg]
+ ibis/backends/clickhouse/tests/test_datatypes.py:123: error: Missing named argument "value_type" for "Array"  [call-arg]
- ibis/backends/clickhouse/tests/test_datatypes.py:128: error: Too few arguments for "Array"  [call-arg]
+ ibis/backends/clickhouse/tests/test_datatypes.py:128: error: Missing named argument "value_type" for "Array"  [call-arg]
- ibis/backends/clickhouse/tests/test_datatypes.py:133: error: Too few arguments for "Array"  [call-arg]
+ ibis/backends/clickhouse/tests/test_datatypes.py:133: error: Missing named argument "value_type" for "Array"  [call-arg]
- ibis/backends/clickhouse/tests/test_datatypes.py:138: error: Too few arguments for "Array"  [call-arg]
+ ibis/backends/clickhouse/tests/test_datatypes.py:138: error: Missing named argument "value_type" for "Array"  [call-arg]
- ibis/backends/clickhouse/tests/test_datatypes.py:143: error: Too few arguments for "Array"  [call-arg]
+ ibis/backends/clickhouse/tests/test_datatypes.py:143: error: Missing named argument "value_type" for "Array"  [call-arg]
- ibis/backends/clickhouse/tests/test_datatypes.py:146: error: Too few arguments for "Array"  [call-arg]
+ ibis/backends/clickhouse/tests/test_datatypes.py:146: error: Missing named argument "value_type" for "Array"  [call-arg]
- ibis/backends/clickhouse/tests/test_datatypes.py:147: error: Too few arguments for "Array"  [call-arg]
+ ibis/backends/clickhouse/tests/test_datatypes.py:147: error: Missing named argument "value_type" for "Array"  [call-arg]
- ibis/backends/clickhouse/tests/test_datatypes.py:150: error: Too few arguments for "Array"  [call-arg]
+ ibis/backends/clickhouse/tests/test_datatypes.py:150: error: Missing named argument "value_type" for "Array"  [call-arg]
- ibis/backends/clickhouse/tests/test_datatypes.py:151: error: Too few arguments for "Array"  [call-arg]
+ ibis/backends/clickhouse/tests/test_datatypes.py:151: error: Missing named argument "value_type" for "Array"  [call-arg]
- ibis/backends/clickhouse/tests/test_datatypes.py:158: error: Too few arguments for "Array"  [call-arg]
+ ibis/backends/clickhouse/tests/test_datatypes.py:158: error: Missing named argument "value_type" for "Array"  [call-arg]
- ibis/backends/clickhouse/tests/test_datatypes.py:159: error: Too few arguments for "Array"  [call-arg]
+ ibis/backends/clickhouse/tests/test_datatypes.py:159: error: Missing named argument "value_type" for "Array"  [call-arg]
- ibis/backends/clickhouse/tests/test_datatypes.py:160: error: Too few arguments for "Array"  [call-arg]
+ ibis/backends/clickhouse/tests/test_datatypes.py:160: error: Missing named argument "value_type" for "Array"  [call-arg]
- ibis/backends/clickhouse/tests/test_datatypes.py:169: error: Too few arguments for "Array"  [call-arg]
+ ibis/backends/clickhouse/tests/test_datatypes.py:169: error: Missing named argument "value_type" for "Array"  [call-arg]
- ibis/backends/clickhouse/tests/test_datatypes.py:170: error: Too few arguments for "Array"  [call-arg]
+ ibis/backends/clickhouse/tests/test_datatypes.py:170: error: Missing named argument "value_type" for "Array"  [call-arg]
- ibis/backends/clickhouse/tests/test_datatypes.py:171: error: Too few arguments for "Array"  [call-arg]
+ ibis/backends/clickhouse/tests/test_datatypes.py:171: error: Missing named argument "value_type" for "Array"  [call-arg]
- ibis/backends/clickhouse/tests/test_datatypes.py:172: error: Too few arguments for "Array"  [call-arg]
+ ibis/backends/clickhouse/tests/test_datatypes.py:172: error: Missing named argument "value_type" for "Array"  [call-arg]
- ibis/backends/clickhouse/tests/test_datatypes.py:183: error: Too few arguments for "Map"  [call-arg]
+ ibis/backends/clickhouse/tests/test_datatypes.py:183: error: Missing named argument "value_type" for "Map"  [call-arg]
- ibis/backends/clickhouse/tests/test_datatypes.py:189: error: Too few arguments for "Struct"  [call-arg]
+ ibis/backends/clickhouse/tests/test_datatypes.py:189: error: Missing named argument "fields" for "Struct"  [call-arg]
- ibis/backends/clickhouse/tests/test_datatypes.py:192: error: Too few arguments for "Array"  [call-arg]
+ ibis/backends/clickhouse/tests/test_datatypes.py:192: error: Missing named argument "value_type" for "Array"  [call-arg]
- ibis/backends/clickhouse/tests/test_datatypes.py:205: error: Too few arguments for "Struct"  [call-arg]
+ ibis/backends/clickhouse/tests/test_datatypes.py:205: error: Missing named argument "fields" for "Struct"  [call-arg]

... (truncated 12 lines) ...

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.

Incorrect error when argument missing from function call unpacking TypedDict
1 participant