[_operator] Remove Anys that can be improved#15598
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
AlexWaygood
left a comment
There was a problem hiding this comment.
Makes sense to me, though I haven't checked the primer report
This comment has been minimized.
This comment has been minimized.
|
Diff from mypy_primer, showing the effect of this PR on open source code: rotki (https://github.com/rotki/rotki)
+ rotkehlchen/chain/ethereum/oracles/uniswap.py:326: error: Argument 1 to "reduce" has incompatible type overloaded function; expected "Callable[[int, FVal], int]" [arg-type]
sympy (https://github.com/sympy/sympy)
+ sympy/polys/matrices/dense.py:104: error: Incompatible types in assignment (expression has type "RingElement", target has type "R") [assignment]
jax (https://github.com/google/jax)
+ jax/experimental/mosaic/gpu/dialect_lowering.py:1365: error: Argument "impl" to "_binary_op_lowering_rule" has incompatible type "function"; expected "Callable[[FragmentedArray, FragmentedArray], FragmentedArray]" [arg-type]
+ jax/_src/pallas/mosaic_gpu/lowering.py:1088: error: Argument "grid" to "_lower_as_gpu_kernel" has incompatible type "tuple[int, ...]"; expected "tuple[int, int, int]" [arg-type]
|
|
Looking at the primer output: rotki: Some price = FVal(reduce(mul, [item.price for item in prices_and_tokens], 1))
@overload
def reduce(function: Callable[[_T, _S], _T], iterable: Iterable[_S], initial: _T, /) -> _T: ...That is consistent with the error message, which expects I blame some kind of mypy bug. sympy: Unclear problem. The line in question: ai[j] = sum(map(mul, bi, cTj), ai[j])
def __mul__(self, other: Self | int, /) -> Self: ...So, according to I (again) blame some kind of mypy bug. jax #1: Type is inferred from a list of different functions. Previously, due to arguments being jax #2: Previously Overall I'm not too worried about the hits, looks to be either mypy bugs or complicated situations that were previously not flagged due to (imprecisely) inferred |
No description provided.