Revert disabling mypy call-overload#1374
Conversation
Signed-off-by: zhen0427 <Zhen.Wang@alliander.com>
figueroa1395
left a comment
There was a problem hiding this comment.
@zhen0427 after a bit of reading (cfr. python/mypy#9003 (comment)), the CI seems to be failing because of a known bug. My understanding is that mypy has trouble understanding the types when you have signatures with Unions of Literal types, specially if they are complex. This is my understanding of this complaint:
src/power_grid_model/_core/power_grid_model.py:265:16: error: No overload variant of "create_output_data" matches argument types "set[Any] | list[Any] | ComponentAttributeFilterOptions | dict[ComponentType, set[Any] | list[Any] | ComponentAttributeFilterOptions | None] | None", "DatasetType", "Any", "bool", "int" [call-overload]
So for this one my recommendation would be to just silence it via (line 265)
all_component_count = self._get_output_component_count(calculation_type=calculation_type)
return create_output_data( # type: ignore[call-overload]
...For the other CI complaint:
tests/unit/test_power_grid_model.py:254:13: error: No overload variant of "calculate_short_circuit" of "PowerGridModel" matches argument type "str" [call-overload]
I think the issue is that the _calculate_short_circuit definition has a default value for its argument short_circuit_voltage_scaling, which isn't reflected on the @overloads. To fix this you need to make sure the overloads have short_circuit_voltage_scaling: some_type = .... Note that = ... is what's missing after the type hint.
These should make CI happy.
the real problem with the first one is a little bit more subtle. i've already found a fix and i'm running tests as we speak. the second one is an actual bug in our overload statements |
|



Revert #863
Issue #867 (The mentioned test is done, no issue found with current mypy version)