basedmypy
basedmypy copied to clipboard
Allow `Typevar`s in the `bound`s of `TypeVar`s
TODO: tests, documentation
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉
TODO: constraints
in this PR or a seperate one? is there an issue for ir
Diff from mypy_primer, showing the effect of this PR on open source code:
materialize (https://github.com/MaterializeInc/materialize)
- misc/python/materialize/cli/optbench.py:92:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any | Command] (FC) -> FC") [no-any-expr]
+ misc/python/materialize/cli/optbench.py:92:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any] (FC) -> FC") [no-any-expr]
- misc/python/materialize/cli/optbench.py:93:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any | Command] (FC) -> FC") [no-any-expr]
+ misc/python/materialize/cli/optbench.py:93:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any] (FC) -> FC") [no-any-expr]
- misc/python/materialize/cli/optbench.py:94:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any | Command] (FC) -> FC") [no-any-expr]
+ misc/python/materialize/cli/optbench.py:94:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any] (FC) -> FC") [no-any-expr]
- misc/python/materialize/cli/optbench.py:119:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any | Command] (FC) -> FC") [no-any-expr]
+ misc/python/materialize/cli/optbench.py:119:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any] (FC) -> FC") [no-any-expr]
- misc/python/materialize/cli/optbench.py:120:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any | Command] (FC) -> FC") [no-any-expr]
+ misc/python/materialize/cli/optbench.py:120:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any] (FC) -> FC") [no-any-expr]
- misc/python/materialize/cli/optbench.py:121:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any | Command] (FC) -> FC") [no-any-expr]
+ misc/python/materialize/cli/optbench.py:121:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any] (FC) -> FC") [no-any-expr]
- misc/python/materialize/cli/optbench.py:122:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any | Command] (FC) -> FC") [no-any-expr]
+ misc/python/materialize/cli/optbench.py:122:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any] (FC) -> FC") [no-any-expr]
- misc/python/materialize/cli/optbench.py:123:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any | Command] (FC) -> FC") [no-any-expr]
+ misc/python/materialize/cli/optbench.py:123:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any] (FC) -> FC") [no-any-expr]
- misc/python/materialize/cli/optbench.py:124:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any | Command] (FC) -> FC") [no-any-expr]
+ misc/python/materialize/cli/optbench.py:124:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any] (FC) -> FC") [no-any-expr]
- misc/python/materialize/cli/crate_diagram.py:45:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any | Command] (FC) -> FC") [no-any-expr]
+ misc/python/materialize/cli/crate_diagram.py:45:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any] (FC) -> FC") [no-any-expr]
- misc/python/materialize/cli/crate_diagram.py:51:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any | Command] (FC) -> FC") [no-any-expr]
+ misc/python/materialize/cli/crate_diagram.py:51:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any] (FC) -> FC") [no-any-expr]
- misc/python/materialize/cli/crate_diagram.py:56:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any | Command] (FC) -> FC") [no-any-expr]
+ misc/python/materialize/cli/crate_diagram.py:56:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any] (FC) -> FC") [no-any-expr]
jax (https://github.com/google/jax)
- jax/_src/config.py:520:9: error: Invalid self argument "_ThreadLocalExtraJitContext" to attribute function "_replace" with type "[_NT: (Any | None, Hashable | None, str | None, str | None, Any | None, bool)] (_NT, DefaultNamedArg(Any | None, 'dynamic_trace_state'), DefaultNamedArg(Hashable, 'axis_env_state'), DefaultNamedArg(str | None, 'numpy_rank_promotion'), DefaultNamedArg(str | None, 'numpy_dtype_promotion'), DefaultNamedArg(Any | None, 'default_matmul_precision'), DefaultNamedArg(bool, 'dynamic_shapes')) -> _NT" [misc]
+ jax/_src/config.py:520:9: error: Invalid self argument "_ThreadLocalExtraJitContext" to attribute function "_replace" with type "[_NT: (Any | None, Hashable, str | None, str | None, Any | None, bool)] (_NT, DefaultNamedArg(Any | None, 'dynamic_trace_state'), DefaultNamedArg(Hashable, 'axis_env_state'), DefaultNamedArg(str | None, 'numpy_rank_promotion'), DefaultNamedArg(str | None, 'numpy_dtype_promotion'), DefaultNamedArg(Any | None, 'default_matmul_precision'), DefaultNamedArg(bool, 'dynamic_shapes')) -> _NT" [misc]
TODO: constraints
in this PR or a seperate one? is there an issue for ir
sorry about that, I've got some eggs of constraints and I'll working though them now.
Diff from mypy_primer, showing the effect of this PR on open source code:
materialize (https://github.com/MaterializeInc/materialize)
- misc/python/materialize/cli/optbench.py:92:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any | Command] (FC) -> FC") [no-any-expr]
+ misc/python/materialize/cli/optbench.py:92:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any] (FC) -> FC") [no-any-expr]
- misc/python/materialize/cli/optbench.py:93:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any | Command] (FC) -> FC") [no-any-expr]
+ misc/python/materialize/cli/optbench.py:93:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any] (FC) -> FC") [no-any-expr]
- misc/python/materialize/cli/optbench.py:94:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any | Command] (FC) -> FC") [no-any-expr]
+ misc/python/materialize/cli/optbench.py:94:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any] (FC) -> FC") [no-any-expr]
- misc/python/materialize/cli/optbench.py:119:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any | Command] (FC) -> FC") [no-any-expr]
+ misc/python/materialize/cli/optbench.py:119:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any] (FC) -> FC") [no-any-expr]
- misc/python/materialize/cli/optbench.py:120:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any | Command] (FC) -> FC") [no-any-expr]
+ misc/python/materialize/cli/optbench.py:120:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any] (FC) -> FC") [no-any-expr]
- misc/python/materialize/cli/optbench.py:121:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any | Command] (FC) -> FC") [no-any-expr]
+ misc/python/materialize/cli/optbench.py:121:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any] (FC) -> FC") [no-any-expr]
- misc/python/materialize/cli/optbench.py:122:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any | Command] (FC) -> FC") [no-any-expr]
+ misc/python/materialize/cli/optbench.py:122:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any] (FC) -> FC") [no-any-expr]
- misc/python/materialize/cli/optbench.py:123:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any | Command] (FC) -> FC") [no-any-expr]
+ misc/python/materialize/cli/optbench.py:123:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any] (FC) -> FC") [no-any-expr]
- misc/python/materialize/cli/optbench.py:124:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any | Command] (FC) -> FC") [no-any-expr]
+ misc/python/materialize/cli/optbench.py:124:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any] (FC) -> FC") [no-any-expr]
- misc/python/materialize/cli/crate_diagram.py:45:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any | Command] (FC) -> FC") [no-any-expr]
+ misc/python/materialize/cli/crate_diagram.py:45:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any] (FC) -> FC") [no-any-expr]
- misc/python/materialize/cli/crate_diagram.py:51:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any | Command] (FC) -> FC") [no-any-expr]
+ misc/python/materialize/cli/crate_diagram.py:51:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any] (FC) -> FC") [no-any-expr]
- misc/python/materialize/cli/crate_diagram.py:56:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any | Command] (FC) -> FC") [no-any-expr]
+ misc/python/materialize/cli/crate_diagram.py:56:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any] (FC) -> FC") [no-any-expr]
jax (https://github.com/google/jax)
- jax/_src/config.py:520:9: error: Invalid self argument "_ThreadLocalExtraJitContext" to attribute function "_replace" with type "[_NT: (Any | None, Hashable | None, str | None, str | None, Any | None, bool)] (_NT, DefaultNamedArg(Any | None, 'dynamic_trace_state'), DefaultNamedArg(Hashable, 'axis_env_state'), DefaultNamedArg(str | None, 'numpy_rank_promotion'), DefaultNamedArg(str | None, 'numpy_dtype_promotion'), DefaultNamedArg(Any | None, 'default_matmul_precision'), DefaultNamedArg(bool, 'dynamic_shapes')) -> _NT" [misc]
+ jax/_src/config.py:520:9: error: Invalid self argument "_ThreadLocalExtraJitContext" to attribute function "_replace" with type "[_NT: (Any | None, Hashable, str | None, str | None, Any | None, bool)] (_NT, DefaultNamedArg(Any | None, 'dynamic_trace_state'), DefaultNamedArg(Hashable, 'axis_env_state'), DefaultNamedArg(str | None, 'numpy_rank_promotion'), DefaultNamedArg(str | None, 'numpy_dtype_promotion'), DefaultNamedArg(Any | None, 'default_matmul_precision'), DefaultNamedArg(bool, 'dynamic_shapes')) -> _NT" [misc]
Actually, it's MVP now, constraints might be much harder.
The primer diff is due to some new calls that are simplifying the union in the upper bound, i.e. object | int becomes object.
Diff from mypy_primer, showing the effect of this PR on open source code:
materialize (https://github.com/MaterializeInc/materialize)
- misc/python/materialize/cli/optbench.py:92:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any | Command] (FC) -> FC") [no-any-expr]
+ misc/python/materialize/cli/optbench.py:92:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any] (FC) -> FC") [no-any-expr]
- misc/python/materialize/cli/optbench.py:93:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any | Command] (FC) -> FC") [no-any-expr]
+ misc/python/materialize/cli/optbench.py:93:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any] (FC) -> FC") [no-any-expr]
- misc/python/materialize/cli/optbench.py:94:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any | Command] (FC) -> FC") [no-any-expr]
+ misc/python/materialize/cli/optbench.py:94:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any] (FC) -> FC") [no-any-expr]
- misc/python/materialize/cli/optbench.py:119:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any | Command] (FC) -> FC") [no-any-expr]
+ misc/python/materialize/cli/optbench.py:119:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any] (FC) -> FC") [no-any-expr]
- misc/python/materialize/cli/optbench.py:120:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any | Command] (FC) -> FC") [no-any-expr]
+ misc/python/materialize/cli/optbench.py:120:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any] (FC) -> FC") [no-any-expr]
- misc/python/materialize/cli/optbench.py:121:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any | Command] (FC) -> FC") [no-any-expr]
+ misc/python/materialize/cli/optbench.py:121:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any] (FC) -> FC") [no-any-expr]
- misc/python/materialize/cli/optbench.py:122:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any | Command] (FC) -> FC") [no-any-expr]
+ misc/python/materialize/cli/optbench.py:122:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any] (FC) -> FC") [no-any-expr]
- misc/python/materialize/cli/optbench.py:123:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any | Command] (FC) -> FC") [no-any-expr]
+ misc/python/materialize/cli/optbench.py:123:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any] (FC) -> FC") [no-any-expr]
- misc/python/materialize/cli/optbench.py:124:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any | Command] (FC) -> FC") [no-any-expr]
+ misc/python/materialize/cli/optbench.py:124:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any] (FC) -> FC") [no-any-expr]
- misc/python/materialize/cli/crate_diagram.py:45:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any | Command] (FC) -> FC") [no-any-expr]
+ misc/python/materialize/cli/crate_diagram.py:45:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any] (FC) -> FC") [no-any-expr]
- misc/python/materialize/cli/crate_diagram.py:51:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any | Command] (FC) -> FC") [no-any-expr]
+ misc/python/materialize/cli/crate_diagram.py:51:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any] (FC) -> FC") [no-any-expr]
- misc/python/materialize/cli/crate_diagram.py:56:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any | Command] (FC) -> FC") [no-any-expr]
+ misc/python/materialize/cli/crate_diagram.py:56:2: error: Expression type contains "Any" (has type "[FC: (...) -> Any] (FC) -> FC") [no-any-expr]
jax (https://github.com/google/jax)
- jax/_src/config.py:520:9: error: Invalid self argument "_ThreadLocalExtraJitContext" to attribute function "_replace" with type "[_NT: (Any | None, Hashable | None, str | None, str | None, Any | None, bool)] (_NT, DefaultNamedArg(Any | None, 'dynamic_trace_state'), DefaultNamedArg(Hashable, 'axis_env_state'), DefaultNamedArg(str | None, 'numpy_rank_promotion'), DefaultNamedArg(str | None, 'numpy_dtype_promotion'), DefaultNamedArg(Any | None, 'default_matmul_precision'), DefaultNamedArg(bool, 'dynamic_shapes')) -> _NT" [misc]
+ jax/_src/config.py:520:9: error: Invalid self argument "_ThreadLocalExtraJitContext" to attribute function "_replace" with type "[_NT: (Any | None, Hashable, str | None, str | None, Any | None, bool)] (_NT, DefaultNamedArg(Any | None, 'dynamic_trace_state'), DefaultNamedArg(Hashable, 'axis_env_state'), DefaultNamedArg(str | None, 'numpy_rank_promotion'), DefaultNamedArg(str | None, 'numpy_dtype_promotion'), DefaultNamedArg(Any | None, 'default_matmul_precision'), DefaultNamedArg(bool, 'dynamic_shapes')) -> _NT" [misc]