Repository navigation
Use both sides of type context for generic type inference (part 1) - #22286
ilevkivskyi wants to merge 12 commits into
Conversation
|
I will also run the primer with performance impact reported, I skimmed through logs and found that |
|
After quick look at |
This comment has been minimized.
This comment has been minimized.
|
Oh, it looks like I forgot to refresh |
|
Btw, it looks like |
|
The error is |
Otherwise mypy plugin crashes, see python/mypy#22286
|
Diff from mypy_primer, showing the effect of this PR on open source code: kornia (https://github.com/kornia/kornia)
- kornia/models/efficient_vit/nn/act.py:36: error: Dict entry 4 has incompatible type "str": "partial[Any]"; expected "str": "type[Any]" [dict-item]
psycopg (https://github.com/psycopg/psycopg)
+ tests/types/test_string.py:259: error: List item 3 has incompatible type "type[Binary]"; expected "ABCMeta" [list-item]
+ tests/types/test_string.py:272: error: List item 3 has incompatible type "type[Binary]"; expected "ABCMeta" [list-item]
prefect (https://github.com/PrefectHQ/prefect)
- src/prefect/utilities/callables/__init__.py:768: error: Incompatible types in assignment (expression has type "list[None]", variable has type "list[expr | None]") [assignment]
- src/prefect/utilities/callables/__init__.py:768: note: "list" is invariant -- see https://mypy.readthedocs.io/en/stable/common_issues.html#variance
- src/prefect/utilities/callables/__init__.py:768: note: Consider using "Sequence" instead, which is covariant
- src/prefect/utilities/callables/__init__.py:770: error: Unsupported operand types for + ("list[None]" and "list[expr | None]") [operator]
+ src/prefect/client/orchestration/__init__.py:1186: error: Function does not return a value (it only ever returns None) [func-returns-value]
+ src/prefect/server/events/jinja_filters.py:86: error: Unused "type: ignore" comment [unused-ignore]
- src/prefect/flow_engine.py:2402: error: Unsupported operand types for | ("dict[str, str]" and "dict[str, str | None]") [operator]
- src/prefect/cli/deploy/_core.py:402: error: Incompatible types in assignment (expression has type "Any | None", variable has type "bool") [assignment]
optuna (https://github.com/optuna/optuna): 1.06x slower (138.4s -> 146.5s in single noisy sample)
spark (https://github.com/apache/spark)
- python/pyspark/pandas/groupby.py:3530: error: Argument 2 to "zip" has incompatible type "list[Any | tuple[Any, ...]] | Hashable"; expected "Iterable[Any | tuple[Any, ...]]" [arg-type]
+ python/pyspark/pandas/groupby.py:3530: error: Argument 2 to "zip" has incompatible type "list[Hashable | Any] | Hashable | list[Any | tuple[Any, ...]]"; expected "Iterable[Hashable | Any]" [arg-type]
+ python/pyspark/ml/util.py:1169: error: Unused "type: ignore" comment [unused-ignore]
+ python/pyspark/ml/classification.py:3990: error: Unused "type: ignore" comment [unused-ignore]
operator (https://github.com/canonical/operator)
- ops/model.py:2985: error: Argument 2 to "_list_recursive" of "Container" has incompatible type "str | Path"; expected "Path" [arg-type]
- ops/model.py:3068: error: Argument 2 to "_list_recursive" of "Container" has incompatible type "str | Path"; expected "Path" [arg-type]
- ops/_private/harness.py:4051: error: Argument 3 to "_notice_matches" of "_TestingPebbleClient" has incompatible type "set[NoticeType | str] | None"; expected "set[str] | None" [arg-type]
altair (https://github.com/vega/altair): 1.13x slower (253.4s -> 286.1s in single noisy sample)
zulip (https://github.com/zulip/zulip): 1.09x slower (196.0s -> 213.9s in single noisy sample)
- zerver/lib/display_recipient.py:84: error: Argument 1 to "list" has incompatible type "QuerySet[Any, dict[str, Any]]"; expected "Iterable[UserDisplayRecipient]" [arg-type]
+ zerver/lib/display_recipient.py:84: error: Argument 1 to "list" has incompatible type "QuerySet[Any, dict[str, Any]]"; expected "Iterable[TypedDict({'email': str, 'full_name': str, 'id': int, 'is_mirror_dummy': bool})]" [arg-type]
scrapy (https://github.com/scrapy/scrapy)
+ tests/test_pipeline_files.py:1033: error: Unused "type: ignore" comment [unused-ignore]
+ scrapy/commands/parse.py:159: error: Returning Any from function declared to return "Iterable[Any] | Deferred[Any]" [no-any-return]
+ scrapy/commands/parse.py:160: error: Returning Any from function declared to return "Iterable[Any] | Deferred[Any]" [no-any-return]
antidote (https://github.com/Finistere/antidote)
+ tests/lib/interface/test_custom.py:434: error: Unused "type: ignore" comment [unused-ignore]
+ tests/lib/interface/test_custom.py:437: error: Unused "type: ignore" comment [unused-ignore]
+ tests/lib/interface/test_custom.py:440: error: Unused "type: ignore" comment [unused-ignore]
+ tests/lib/interface/test_custom.py:443: error: Unused "type: ignore" comment [unused-ignore]
+ tests/lib/interface/test_custom.py:446: error: Unused "type: ignore" comment [unused-ignore]
+ tests/lib/interface/test_custom.py:449: error: Unused "type: ignore" comment [unused-ignore]
core (https://github.com/home-assistant/core): 1.09x slower (468.3s -> 512.0s in single noisy sample)
- homeassistant/components/energieleser/const.py:25: error: Returning Any from function declared to return "str" [no-any-return]
+ homeassistant/components/mijn_farmad_apotheek/services.py:248: error: Dict entry 0 has incompatible type "str": "list[dict[str, Any]]"; expected "str": "list[dict[str, Any] | dict[str, JsonValueType] | list[JsonValueType] | str | int | float | None] | dict[str, JsonValueType] | list[JsonValueType] | str | int | float | None" [dict-item]
- homeassistant/components/zonneplan/coordinator.py:179: error: Returning Any from function declared to return "tuple[Any | None, Any | None]" [no-any-return]
- homeassistant/components/zonneplan/coordinator.py:192: error: Returning Any from function declared to return "tuple[Any | None, Any | None]" [no-any-return]
+ homeassistant/components/peblar/services.py:182: error: Dict entry 0 has incompatible type "str": "list[dict[str, Any | Any]]"; expected "str": "list[dict[str, Any | Any | dict[str, JsonValueType] | list[JsonValueType] | str | int | float | None] | dict[str, JsonValueType] | list[JsonValueType] | str | int | float | None] | dict[str, JsonValueType] | list[JsonValueType] | str | int | float | None" [dict-item]
+ homeassistant/components/peblar/services.py:221: error: Dict entry 0 has incompatible type "str": "list[dict[str, Any | Any]]"; expected "str": "list[dict[str, Any | Any | dict[str, JsonValueType] | list[JsonValueType] | str | int | float | None] | dict[str, JsonValueType] | list[JsonValueType] | str | int | float | None] | dict[str, JsonValueType] | list[JsonValueType] | str | int | float | None" [dict-item]
+ homeassistant/components/device_automation/__init__.py:245: error: Unused "type: ignore" comment [unused-ignore]
+ homeassistant/components/device_automation/__init__.py:245: error: Incompatible return value type (got "list[Any | BaseException]", expected "list[list[dict[str, Any]] | Exception]") [return-value]
+ homeassistant/components/device_automation/__init__.py:245: note: Error code "return-value" not covered by "type: ignore[no-any-return]" comment
+ homeassistant/components/heos/media_player.py:252: error: Dict entry 0 has incompatible type "str": "list[dict[str, Any]]"; expected "str": "list[dict[str, Any] | dict[str, JsonValueType] | list[JsonValueType] | str | int | float | None] | dict[str, JsonValueType] | list[JsonValueType] | str | int | float | None" [dict-item]
+ homeassistant/components/miele/services.py:172: error: Dict entry 0 has incompatible type "str": "list[dict[str, Any | Any | dict[str, dict[str, Any | Any | Any | Any] | dict[str, dict[str, Any | Any] | Any]]]]"; expected "str": "list[dict[str, Any | Any | dict[str, dict[str, Any | Any | Any | Any | dict[str, JsonValueType] | list[JsonValueType] | str | int | float | None] | dict[str, dict[str, JsonValueType] | list[JsonValueType] | str | int | float | None] | dict[str, dict[str, Any | Any | dict[str, JsonValueType] | list[JsonValueType] | str | int | float | None] | Any | dict[str, JsonValueType] | list[JsonValueType] | str | int | float | None] | dict[str, JsonValueType] | list[JsonValueType] | str | int | float | None] | dict[str, dict[str, JsonValueType] | list[JsonValueType] | str | int | float | None] | dict[str, JsonValueType] | list[JsonValueType] | str | int | float | None] | dict[str, JsonValueType] | list[JsonValueType] | str | int | float | None] | dict[str, JsonValueType] | list[JsonValueType] | str | int | float | None" [dict-item]
+ homeassistant/components/energyzero/services.py:103: error: Dict entry 0 has incompatible type "str": "list[dict[str, Any | str]]"; expected "str": "list[dict[str, Any | str | dict[str, JsonValueType] | list[JsonValueType] | int | float | None] | dict[str, JsonValueType] | list[JsonValueType] | str | int | float | None] | dict[str, JsonValueType] | list[JsonValueType] | str | int | float | None" [dict-item]
+ homeassistant/components/mealie/services.py:228: error: Dict entry 0 has incompatible type "str": "list[dict[str, Any]]"; expected "str": "list[dict[str, Any] | dict[str, JsonValueType] | list[JsonValueType] | str | int | float | None] | dict[str, JsonValueType] | list[JsonValueType] | str | int | float | None" [dict-item]
+ homeassistant/components/tplink_omada/diagnostics.py:73: error: Returning Any from function declared to return "dict[str, Any]" [no-any-return]
+ homeassistant/components/airos/coordinator.py:128: error: Returning Any from function declared to return "dict[str, Any]" [no-any-return]
+ homeassistant/components/onedrive/services.py:239: error: Dict entry 0 has incompatible type "str": "list[dict[str, Any]]"; expected "str": "list[dict[str, Any] | dict[str, JsonValueType] | list[JsonValueType] | str | int | float | None] | dict[str, JsonValueType] | list[JsonValueType] | str | int | float | None" [dict-item]
+ homeassistant/components/google_photos/services.py:136: error: Dict entry 0 has incompatible type "str": "list[dict[str, Any]]"; expected "str": "list[dict[str, Any | dict[str, JsonValueType] | list[JsonValueType] | str | int | float | None] | dict[str, JsonValueType] | list[JsonValueType] | str | int | float | None] | dict[str, JsonValueType] | list[JsonValueType] | str | int | float | None" [dict-item]
+ homeassistant/components/seventeentrack/services.py:87: error: Dict entry 0 has incompatible type "str": "list[dict[str, Any]]"; expected "str": "list[dict[str, Any] | dict[str, JsonValueType] | list[JsonValueType] | str | int | float | None] | dict[str, JsonValueType] | list[JsonValueType] | str | int | float | None" [dict-item]
+ homeassistant/components/amcrest/camera.py:156: error: Returning Any from function declared to return "bytes | None" [no-any-return]
+ homeassistant/components/knx/storage/entity_store_validation.py:68: error: Returning Any from function declared to return "dict[Any, Any]" [no-any-return]
+ homeassistant/components/roborock/vacuum.py:349: error: Dict entry 0 has incompatible type "str": "list[dict[str, Any | Any | dict[Any, Any]]]"; expected "str": "list[dict[str, Any | Any | dict[Any | str, Any | dict[str, JsonValueType] | list[JsonValueType] | str | int | float | None] | dict[str, JsonValueType] | list[JsonValueType] | str | int | float | None] | dict[str, JsonValueType] | list[JsonValueType] | str | int | float | None] | dict[str, JsonValueType] | list[JsonValueType] | str | int | float | None" [dict-item]
+ homeassistant/components/roborock/vacuum.py:599: error: Dict entry 0 has incompatible type "str": "list[dict[str, Any | str | dict[str, str]]]"; expected "str": "list[dict[str, Any | str | dict[str, dict[str, JsonValueType] | list[JsonValueType] | str | int | float | None] | dict[str, JsonValueType] | list[JsonValueType] | int | float | None] | dict[str, JsonValueType] | list[JsonValueType] | str | int | float | None] | dict[str, JsonValueType] | list[JsonValueType] | str | int | float | None" [dict-item]
+ homeassistant/components/google_assistant_sdk/services.py:45: error: Dict entry 0 has incompatible type "str": "list[dict[str, Any]]"; expected "str": "list[dict[str, Any] | dict[str, JsonValueType] | list[JsonValueType] | str | int | float | None] | dict[str, JsonValueType] | list[JsonValueType] | str | int | float | None" [dict-item]
+ homeassistant/components/husqvarna_automower/diagnostics.py:48: error: Returning Any from function declared to return "dict[str, Any]" [no-any-return]
+ homeassistant/components/airzone_cloud/diagnostics.py:132: error: Returning Any from function declared to return "dict[str, Any]" [no-any-return]
+ homeassistant/components/motioneye/media_source.py:229: error: Unused "type: ignore" comment [unused-ignore]
- homeassistant/components/esphome/serial_proxy.py:107: error: Item "None" of "Any | None" has no attribute "_loop" [union-attr]
- homeassistant/components/uptimerobot/sensor.py:73: error: Returning Any from function declared to return "str | None" [no-any-return]
+ homeassistant/components/lametric/diagnostics.py:26: error: Returning Any from function declared to return "dict[str, Any]" [no-any-return]
+ homeassistant/components/open_meteo/diagnostics.py:22: error: Returning Any from function declared to return "dict[str, Any]" [no-any-return]
+ homeassistant/components/velux/cover.py:111: error: Item "None" of "str | None" has no attribute "upper" [union-attr]
pytest-robotframework (https://github.com/detachhead/pytest-robotframework): 1.34x slower (17.4s -> 23.3s in single noisy sample)
- pytest_robotframework/_internal/robot/utils.py:249: error: Argument 1 to "reduce" has incompatible type "Callable[[Mapping[str, object], Mapping[str, object]], dict[str, object]]"; expected "Callable[[SupportsKeysAndGetItem[str, object], Mapping[str, object]], SupportsKeysAndGetItem[str, object]]" [arg-type]
AutoSplit (https://github.com/Toufool/AutoSplit): 1.07x slower (63.7s -> 68.5s in single noisy sample)
django-stubs (https://github.com/typeddjango/django-stubs)
error: INTERNAL ERROR -- Please try using mypy master on GitHub:
- version: 2.5.0+dev.62dad9ad6e6916da191a4478290a0b2c333ee9e5
+ version: 2.5.0+dev.1d48bf05a129ca37c93f91efc39eb713f460f47f
egglog-python (https://github.com/egraphs-good/egglog-python): 1.08x slower (116.9s -> 126.1s in single noisy sample)
pandera (https://github.com/pandera-dev/pandera): 1.06x slower (90.9s -> 96.3s in single noisy sample)
- tests/ibis/test_ibis_dtypes.py:81: error: Unsupported operand types for + ("list[type[String] | type[_PhysicalNumber]]" and "list[type[Map]]") [operator]
- tests/ibis/test_ibis_dtypes.py:92: error: Unsupported operand types for + ("list[type[String] | type[_PhysicalNumber]]" and "list[type[Map]]") [operator]
werkzeug (https://github.com/pallets/werkzeug)
+ src/werkzeug/local.py:59: error: Returning Any from function declared to return "Iterator[tuple[str, Any]]" [no-any-return]
+ tests/test_exceptions.py:123: error: Unused "type: ignore" comment [unused-ignore]
pydantic (https://github.com/pydantic/pydantic)
- pydantic/fields.py:844: note: def Field(default, default: EllipsisType, *, alias: str | None = ..., alias_priority: int | None = ..., validation_alias: str | AliasPath | AliasChoices | None = ..., serialization_alias: str | None = ..., title: str | None = ..., field_title_generator: Callable[[str, FieldInfo], str] | None = ..., description: str | None = ..., examples: list[Any] | None = ..., exclude: bool | None = ..., exclude_if: Callable[[Any], bool] | None = ..., discriminator: str | Discriminator | None = ..., deprecated: deprecated | str | bool | None = ..., json_schema_extra: JsonDict | Callable[[JsonDict], None] | None = ..., frozen: bool | None = ..., validate_default: bool | None = ..., repr: bool = ..., init: bool | None = ..., init_var: bool | None = ..., kw_only: bool | None = ..., pattern: str | Pattern[str] | None = ..., strict: bool | None = ..., coerce_numbers_to_str: bool | None = ..., gt: SupportsGt | None = ..., ge: SupportsGe | None = ..., lt: SupportsLt | None = ..., le: SupportsLe | None = ..., multiple_of: float | None = ..., allow_inf_nan: bool | None = ..., max_digits: int | None = ..., decimal_places: int | None = ..., min_length: int | None = ..., max_length: int | None = ..., union_mode: Literal['smart', 'left_to_right'] = ..., fail_fast: bool | None = ...) -> Any
+ pydantic/fields.py:844: note: def Field(default: EllipsisType, *, alias: str | None = ..., alias_priority: int | None = ..., validation_alias: str | AliasPath | AliasChoices | None = ..., serialization_alias: str | None = ..., title: str | None = ..., field_title_generator: Callable[[str, FieldInfo], str] | None = ..., description: str | None = ..., examples: list[Any] | None = ..., exclude: bool | None = ..., exclude_if: Callable[[Any], bool] | None = ..., discriminator: str | Discriminator | None = ..., deprecated: deprecated | str | bool | None = ..., json_schema_extra: JsonDict | Callable[[JsonDict], None] | None = ..., frozen: bool | None = ..., validate_default: bool | None = ..., repr: bool = ..., init: bool | None = ..., init_var: bool | None = ..., kw_only: bool | None = ..., pattern: str | Pattern[str] | None = ..., strict: bool | None = ..., coerce_numbers_to_str: bool | None = ..., gt: SupportsGt | None = ..., ge: SupportsGe | None = ..., lt: SupportsLt | None = ..., le: SupportsLe | None = ..., multiple_of: float | None = ..., allow_inf_nan: bool | None = ..., max_digits: int | None = ..., decimal_places: int | None = ..., min_length: int | None = ..., max_length: int | None = ..., union_mode: Literal['smart', 'left_to_right'] = ..., fail_fast: bool | None = ...) -> Any
- pydantic/fields.py:844: note: def Field(default, default: Any, *, alias: str | None = ..., alias_priority: int | None = ..., validation_alias: str | AliasPath | AliasChoices | None = ..., serialization_alias: str | None = ..., title: str | None = ..., field_title_generator: Callable[[str, FieldInfo], str] | None = ..., description: str | None = ..., examples: list[Any] | None = ..., exclude: bool | None = ..., exclude_if: Callable[[Any], bool] | None = ..., discriminator: str | Discriminator | None = ..., deprecated: deprecated | str | bool | None = ..., json_schema_extra: JsonDict | Callable[[JsonDict], None] | None = ..., frozen: bool | None = ..., validate_default: Literal[True], repr: bool = ..., init: bool | None = ..., init_var: bool | None = ..., kw_only: bool | None = ..., pattern: str | Pattern[str] | None = ..., strict: bool | None = ..., coerce_numbers_to_str: bool | None = ..., gt: SupportsGt | None = ..., ge: SupportsGe | None = ..., lt: SupportsLt | None = ..., le: SupportsLe | None = ..., multiple_of: float | None = ..., allow_inf_nan: bool | None = ..., max_digits: int | None = ..., decimal_places: int | None = ..., min_length: int | None = ..., max_length: int | None = ..., union_mode: Literal['smart', 'left_to_right'] = ..., fail_fast: bool | None = ...) -> Any
+ pydantic/fields.py:844: note: def Field(default: Any, *, alias: str | None = ..., alias_priority: int | None = ..., validation_alias: str | AliasPath | AliasChoices | None = ..., serialization_alias: str | None = ..., title: str | None = ..., field_title_generator: Callable[[str, FieldInfo], str] | None = ..., description: str | None = ..., examples: list[Any] | None = ..., exclude: bool | None = ..., exclude_if: Callable[[Any], bool] | None = ..., discriminator: str | Discriminator | None = ..., deprecated: deprecated | str | bool | None = ..., json_schema_extra: JsonDict | Callable[[JsonDict], None] | None = ..., frozen: bool | None = ..., validate_default: Literal[True], repr: bool = ..., init: bool | None = ..., init_var: bool | None = ..., kw_only: bool | None = ..., pattern: str | Pattern[str] | None = ..., strict: bool | None = ..., coerce_numbers_to_str: bool | None = ..., gt: SupportsGt | None = ..., ge: SupportsGe | None = ..., lt: SupportsLt | None = ..., le: SupportsLe | None = ..., multiple_of: float | None = ..., allow_inf_nan: bool | None = ..., max_digits: int | None = ..., decimal_places: int | None = ..., min_length: int | None = ..., max_length: int | None = ..., union_mode: Literal['smart', 'left_to_right'] = ..., fail_fast: bool | None = ...) -> Any
- pydantic/fields.py:844: note: def [_T] Field(default, default: _T, *, alias: str | None = ..., alias_priority: int | None = ..., validation_alias: str | AliasPath | AliasChoices | None = ..., serialization_alias: str | None = ..., title: str | None = ..., field_title_generator: Callable[[str, FieldInfo], str] | None = ..., description: str | None = ..., examples: list[Any] | None = ..., exclude: bool | None = ..., exclude_if: Callable[[Any], bool] | None = ..., discriminator: str | Discriminator | None = ..., deprecated: deprecated | str | bool | None = ..., json_schema_extra: JsonDict | Callable[[JsonDict], None] | None = ..., frozen: bool | None = ..., validate_default: Literal[False] = ..., repr: bool = ..., init: bool | None = ..., init_var: bool | None = ..., kw_only: bool | None = ..., pattern: str | Pattern[str] | None = ..., strict: bool | None = ..., coerce_numbers_to_str: bool | None = ..., gt: SupportsGt | None = ..., ge: SupportsGe | None = ..., lt: SupportsLt | None = ..., le: SupportsLe | None = ..., multiple_of: float | None = ..., allow_inf_nan: bool | None = ..., max_digits: int | None = ..., decimal_places: int | None = ..., min_length: int | None = ..., max_length: int | None = ..., union_mode: Literal['smart', 'left_to_right'] = ..., fail_fast: bool | None = ...) -> _T
+ pydantic/fields.py:844: note: def [_T] Field(default: _T, *, alias: str | None = ..., alias_priority: int | None = ..., validation_alias: str | AliasPath | AliasChoices | None = ..., serialization_alias: str | None = ..., title: str | None = ..., field_title_generator: Callable[[str, FieldInfo], str] | None = ..., description: str | None = ..., examples: list[Any] | None = ..., exclude: bool | None = ..., exclude_if: Callable[[Any], bool] | None = ..., discriminator: str | Discriminator | None = ..., deprecated: deprecated | str | bool | None = ..., json_schema_extra: JsonDict | Callable[[JsonDict], None] | None = ..., frozen: bool | None = ..., validate_default: Literal[False] = ..., repr: bool = ..., init: bool | None = ..., init_var: bool | None = ..., kw_only: bool | None = ..., pattern: str | Pattern[str] | None = ..., strict: bool | None = ..., coerce_numbers_to_str: bool | None = ..., gt: SupportsGt | None = ..., ge: SupportsGe | None = ..., lt: SupportsLt | None = ..., le: SupportsLe | None = ..., multiple_of: float | None = ..., allow_inf_nan: bool | None = ..., max_digits: int | None = ..., decimal_places: int | None = ..., min_length: int | None = ..., max_length: int | None = ..., union_mode: Literal['smart', 'left_to_right'] = ..., fail_fast: bool | None = ...) -> _T
- pydantic/fields.py:844: note: def Field(default_factory, *, default_factory: Callable[[], Any] | Callable[[dict[str, Any]], Any], alias: str | None = ..., alias_priority: int | None = ..., validation_alias: str | AliasPath | AliasChoices | None = ..., serialization_alias: str | None = ..., title: str | None = ..., field_title_generator: Callable[[str, FieldInfo], str] | None = ..., description: str | None = ..., examples: list[Any] | None = ..., exclude: bool | None = ..., exclude_if: Callable[[Any], bool] | None = ..., discriminator: str | Discriminator | None = ..., deprecated: deprecated | str | bool | None = ..., json_schema_extra: JsonDict | Callable[[JsonDict], None] | None = ..., frozen: bool | None = ..., validate_default: Literal[True], repr: bool = ..., init: bool | None = ..., init_var: bool | None = ..., kw_only: bool | None = ..., pattern: str | Pattern[str] | None = ..., strict: bool | None = ..., coerce_numbers_to_str: bool | None = ..., gt: SupportsGt | None = ..., ge: SupportsGe | None = ..., lt: SupportsLt | None = ..., le: SupportsLe | None = ..., multiple_of: float | None = ..., allow_inf_nan: bool | None = ..., max_digits: int | None = ..., decimal_places: int | None = ..., min_length: int | None = ..., max_length: int | None = ..., union_mode: Literal['smart', 'left_to_right'] = ..., fail_fast: bool | None = ...) -> Any
+ pydantic/fields.py:844: note: def Field(*, default_factory: Callable[[], Any] | Callable[[dict[str, Any]], Any], alias: str | None = ..., alias_priority: int | None = ..., validation_alias: str | AliasPath | AliasChoices | None = ..., serialization_alias: str | None = ..., title: str | None = ..., field_title_generator: Callable[[str, FieldInfo], str] | None = ..., description: str | None = ..., examples: list[Any] | None = ..., exclude: bool | None = ..., exclude_if: Callable[[Any], bool] | None = ..., discriminator: str | Discriminator | None = ..., deprecated: deprecated | str | bool | None = ..., json_schema_extra: JsonDict | Callable[[JsonDict], None] | None = ..., frozen: bool | None = ..., validate_default: Literal[True], repr: bool = ..., init: bool | None = ..., init_var: bool | None = ..., kw_only: bool | None = ..., pattern: str | Pattern[str] | None = ..., strict: bool | None = ..., coerce_numbers_to_str: bool | None = ..., gt: SupportsGt | None = ..., ge: SupportsGe | None = ..., lt: SupportsLt | None = ..., le: SupportsLe | None = ..., multiple_of: float | None = ..., allow_inf_nan: bool | None = ..., max_digits: int | None = ..., decimal_places: int | None = ..., min_length: int | None = ..., max_length: int | None = ..., union_mode: Literal['smart', 'left_to_right'] = ..., fail_fast: bool | None = ...) -> Any
- pydantic/fields.py:844: note: def [_T] Field(default_factory, *, default_factory: Callable[[], _T] | Callable[[dict[str, Any]], _T], alias: str | None = ..., alias_priority: int | None = ..., validation_alias: str | AliasPath | AliasChoices | None = ..., serialization_alias: str | None = ..., title: str | None = ..., field_title_generator: Callable[[str, FieldInfo], str] | None = ..., description: str | None = ..., examples: list[Any] | None = ..., exclude: bool | None = ..., exclude_if: Callable[[Any], bool] | None = ..., discriminator: str | Discriminator | None = ..., deprecated: deprecated | str | bool | None = ..., json_schema_extra: JsonDict | Callable[[JsonDict], None] | None = ..., frozen: bool | None = ..., validate_default: Literal[False] | None = ..., repr: bool = ..., init: bool | None = ..., init_var: bool | None = ..., kw_only: bool | None = ..., pattern: str | Pattern[str] | None = ..., strict: bool | None = ..., coerce_numbers_to_str: bool | None = ..., gt: SupportsGt | None = ..., ge: SupportsGe | None = ..., lt: SupportsLt | None = ..., le: SupportsLe | None = ..., multiple_of: float | None = ..., allow_inf_nan: bool | None = ..., max_digits: int | None = ..., decimal_places: int | None = ..., min_length: int | None = ..., max_length: int | None = ..., union_mode: Literal['smart', 'left_to_right'] = ..., fail_fast: bool | None = ...) -> _T
+ pydantic/fields.py:844: note: def [_T] Field(*, default_factory: Callable[[], _T] | Callable[[dict[str, Any]], _T], alias: str | None = ..., alias_priority: int | None = ..., validation_alias: str | AliasPath | AliasChoices | None = ..., serialization_alias: str | None = ..., title: str | None = ..., field_title_generator: Callable[[str, FieldInfo], str] | None = ..., description: str | None = ..., examples: list[Any] | None = ..., exclude: bool | None = ..., exclude_if: Callable[[Any], bool] | None = ..., discriminator: str | Discriminator | None = ..., deprecated: deprecated | str | bool | None = ..., json_schema_extra: JsonDict | Callable[[JsonDict], None] | None = ..., frozen: bool | None = ..., validate_default: Literal[False] | None = ..., repr: bool = ..., init: bool | None = ..., init_var: bool | None = ..., kw_only: bool | None = ..., pattern: str | Pattern[str] | None = ..., strict: bool | None = ..., coerce_numbers_to_str: bool | None = ..., gt: SupportsGt | None = ..., ge: SupportsGe | None = ..., lt: SupportsLt | None = ..., le: SupportsLe | None = ..., multiple_of: float | None = ..., allow_inf_nan: bool | None = ..., max_digits: int | None = ..., decimal_places: int | None = ..., min_length: int | None = ..., max_length: int | None = ..., union_mode: Literal['smart', 'left_to_right'] = ..., fail_fast: bool | None = ...) -> _T
- pydantic/fields.py:844: note: def Field(alias, *, alias: str | None = ..., alias_priority: int | None = ..., validation_alias: str | AliasPath | AliasChoices | None = ..., serialization_alias: str | None = ..., title: str | None = ..., field_title_generator: Callable[[str, FieldInfo], str] | None = ..., description: str | None = ..., examples: list[Any] | None = ..., exclude: bool | None = ..., exclude_if: Callable[[Any], bool] | None = ..., discriminator: str | Discriminator | None = ..., deprecated: deprecated | str | bool | None = ..., json_schema_extra: JsonDict | Callable[[JsonDict], None] | None = ..., frozen: bool | None = ..., validate_default: bool | None = ..., repr: bool = ..., init: bool | None = ..., init_var: bool | None = ..., kw_only: bool | None = ..., pattern: str | Pattern[str] | None = ..., strict: bool | None = ..., coerce_numbers_to_str: bool | None = ..., gt: SupportsGt | None = ..., ge: SupportsGe | None = ..., lt: SupportsLt | None = ..., le: SupportsLe | None = ..., multiple_of: float | None = ..., allow_inf_nan: bool | None = ..., max_digits: int | None = ..., decimal_places: int | None = ..., min_length: int | None = ..., max_length: int | None = ..., union_mode: Literal['smart', 'left_to_right'] = ..., fail_fast: bool | None = ...) -> Any
+ pydantic/fields.py:844: note: def Field(*, alias: str | None = ..., alias_priority: int | None = ..., validation_alias: str | AliasPath | AliasChoices | None = ..., serialization_alias: str | None = ..., title: str | None = ..., field_title_generator: Callable[[str, FieldInfo], str] | None = ..., description: str | None = ..., examples: list[Any] | None = ..., exclude: bool | None = ..., exclude_if: Callable[[Any], bool] | None = ..., discriminator: str | Discriminator | None = ..., deprecated: deprecated | str | bool | None = ..., json_schema_extra: JsonDict | Callable[[JsonDict], None] | None = ..., frozen: bool | None = ..., validate_default: bool | None = ..., repr: bool = ..., init: bool | None = ..., init_var: bool | None = ..., kw_only: bool | None = ..., pattern: str | Pattern[str] | None = ..., strict: bool | None = ..., coerce_numbers_to_str: bool | None = ..., gt: SupportsGt | None = ..., ge: SupportsGe | None = ..., lt: SupportsLt | None = ..., le: SupportsLe | None = ..., multiple_of: float | None = ..., allow_inf_nan: bool | None = ..., max_digits: int | None = ..., decimal_places: int | None = ..., min_length: int | None = ..., max_length: int | None = ..., union_mode: Literal['smart', 'left_to_right'] = ..., fail_fast: bool | None = ...) -> Any
scipy (https://github.com/scipy/scipy): 1.06x slower (122.8s -> 130.6s in single noisy sample)
- scipy/stats/tests/test_sampling.py:155: error: Unsupported operand types for + ("list[tuple[tuple[int, ...], type[ValueError], str] | tuple[tuple[int, int], type[UNURANError], str]]" and "list[tuple[tuple[float, float], type[ValueError], str]]") [operator]
pandas-stubs (https://github.com/pandas-dev/pandas-stubs): 1.08x slower (390.2s -> 421.0s in single noisy sample)
+ tests/indexes/test_indexes.py:181: error: Unused "type: ignore" comment [unused-ignore]
pytest-autoprofile (https://gitlab.com/TTsangSC/pytest-autoprofile): 1.39x faster (37.3s -> 26.8s in single noisy sample)
rotki (https://github.com/rotki/rotki)
- rotkehlchen/tests/api/test_calendar.py:156: error: Unsupported operand types for | ("dict[str, list[dict[str, str]]]" and "dict[str, int]") [operator]
- rotkehlchen/tests/api/test_calendar.py:168: error: Unsupported operand types for | ("dict[str, str]" and "dict[str, int]") [operator]
- rotkehlchen/tests/api/test_calendar.py:180: error: Unsupported operand types for | ("dict[str, str]" and "dict[str, int]") [operator]
- rotkehlchen/tests/api/test_calendar.py:192: error: Unsupported operand types for | ("dict[str, str]" and "dict[str, int]") [operator]
- rotkehlchen/tests/api/test_calendar.py:229: error: Unsupported operand types for | ("dict[str, list[dict[str, ChecksumAddress]]]" and "dict[str, int]") [operator]
+ rotkehlchen/chain/evm/decoding/stakedao/decoder.py:316: error: Unused "type: ignore" comment [unused-ignore]
cwltool (https://github.com/common-workflow-language/cwltool): 1.48x slower (57.5s -> 85.0s in single noisy sample)
sympy (https://github.com/sympy/sympy)
+ sympy/core/add.py:396: error: Unused "type: ignore" comment [unused-ignore]
+ sympy/polys/compatibility.py:402: error: Unused "type: ignore" comment [unused-ignore]
scikit-learn (https://github.com/scikit-learn/scikit-learn): 1.16x slower (124.8s -> 144.2s in single noisy sample)
- sklearn/externals/array_api_compat/numpy/linalg.py:185: error: Incompatible types in assignment (expression has type "Callable[..., float64]", variable has type overloaded function) [assignment]
- sklearn/preprocessing/tests/test_polynomial.py:663: error: Unsupported operand types for + ("list[ABCMeta | None]" and "list[ABCMeta]") [operator]
- sklearn/preprocessing/tests/test_polynomial.py:734: error: Unsupported operand types for + ("list[ABCMeta | None]" and "list[ABCMeta]") [operator]
- sklearn/preprocessing/tests/test_function_transformer.py:124: error: Unsupported operand types for + ("list[ABCMeta | None]" and "list[ABCMeta]") [operator]
- sklearn/metrics/tests/test_pairwise.py:946: error: Unsupported operand types for + ("list[overloaded function]" and "list[ABCMeta]") [operator]
- sklearn/metrics/tests/test_pairwise.py:951: error: Unsupported operand types for + ("list[overloaded function]" and "list[ABCMeta]") [operator]
- sklearn/metrics/tests/test_pairwise.py:964: error: Unsupported operand types for + ("list[overloaded function]" and "list[ABCMeta]") [operator]
- sklearn/metrics/tests/test_pairwise.py:1052: error: Unsupported operand types for + ("list[overloaded function]" and "list[ABCMeta]") [operator]
- sklearn/metrics/tests/test_pairwise.py:1057: error: Unsupported operand types for + ("list[overloaded function]" and "list[ABCMeta]") [operator]
- sklearn/metrics/tests/test_pairwise.py:1083: error: Unsupported operand types for + ("list[overloaded function]" and "list[ABCMeta]") [operator]
- sklearn/metrics/tests/test_pairwise.py:1107: error: Unsupported operand types for + ("list[overloaded function]" and "list[ABCMeta]") [operator]
- sklearn/metrics/tests/test_pairwise.py:1112: error: Unsupported operand types for + ("list[overloaded function]" and "list[ABCMeta]") [operator]
- sklearn/metrics/tests/test_pairwise.py:1138: error: Unsupported operand types for + ("list[overloaded function]" and "list[ABCMeta]") [operator]
- sklearn/_loss/tests/test_loss.py:224: error: Unsupported operand types for + ("list[tuple[BaseLoss, list[float], list[float]]]" and "list[tuple[BaseLoss, object, list[Any]]]") [operator]
- sklearn/_loss/tests/test_loss.py:236: error: Unsupported operand types for + ("list[tuple[BaseLoss, list[float], list[float]]]" and "list[tuple[BaseLoss, list[float], object]]") [operator]
- sklearn/feature_selection/tests/test_variance_threshold.py:14: error: Unsupported operand types for + ("list[ABCMeta | None]" and "list[ABCMeta]") [operator]
- sklearn/feature_selection/tests/test_variance_threshold.py:31: error: Unsupported operand types for + ("list[None]" and "list[ABCMeta]") [operator]
- sklearn/feature_selection/tests/test_variance_threshold.py:47: error: Unsupported operand types for + ("list[ABCMeta | None]" and "list[ABCMeta]") [operator]
- sklearn/feature_selection/tests/test_variance_threshold.py:61: error: Unsupported operand types for + ("list[ABCMeta | None]" and "list[ABCMeta]") [operator]
- sklearn/utils/tests/test_sparsefuncs.py:451: error: No overload variant of "hstack" matches argument types "list[Any]", "str" [call-overload]
- sklearn/utils/tests/test_sparsefuncs.py:451: note: Possible overload variants:
- sklearn/utils/tests/test_sparsefuncs.py:451: note: def [T] hstack(blocks: Sequence[_CanStack[T]], format: None = ..., dtype: None = ...) -> T
- sklearn/utils/tests/test_sparsefuncs.py:451: note: def [ScalarT: number[Any, Any] | numpy.bool[builtins.bool]] hstack(blocks: Sequence[sparray[ScalarT, tuple[int, int]]], format: Literal['bsr'], dtype: None = ...) -> bsr_array[ScalarT]
- sklearn/utils/tests/test_sparsefuncs.py:451: note: def [ScalarT: number[Any, Any] | numpy.bool[builtins.bool]] hstack(blocks: Sequence[sparray[ScalarT, tuple[int, int]]], format: Literal['coo'], dtype: None = ...) -> coo_array[ScalarT, tuple[int, int]]
- sklearn/utils/tests/test_sparsefuncs.py:451: note: def [ScalarT: number[Any, Any] | numpy.bool[builtins.bool]] hstack(blocks: Sequence[sparray[ScalarT, tuple[int, int]]], format: Literal['csc'], dtype: None = ...) -> csc_array[ScalarT]
- sklearn/utils/tests/test_sparsefuncs.py:451: note: def [ScalarT: number[Any, Any] | numpy.bool[builtins.bool]] hstack(blocks: Sequence[sparray[ScalarT, tuple[int, int]]], format: Literal['csr'], dtype: None = ...) -> csr_array[ScalarT, tuple[int, int]]
- sklearn/utils/tests/test_sparsefuncs.py:451: note: def [ScalarT: number[Any, Any] | numpy.bool[builtins.bool]] hstack(blocks: Sequence[sparray[ScalarT, tuple[int, int]]], format: Literal['dia'], dtype: None = ...) -> dia_array[ScalarT]
- sklearn/utils/tests/test_sparsefuncs.py:451: note: def [ScalarT: number[Any, Any] | numpy.bool[builtins.bool]] hstack(blocks: Sequence[sparray[ScalarT, tuple[int, int]]], format: Literal['dok'], dtype: None = ...) -> dok_array[ScalarT, tuple[int, int]]
- sklearn/utils/tests/test_sparsefuncs.py:451: note: def [ScalarT: number[Any, Any] | numpy.bool[builtins.bool]] hstack(blocks: Sequence[sparray[ScalarT, tuple[int, int]]], format: Literal['lil'], dtype: None = ...) -> lil_array[ScalarT]
- sklearn/utils/tests/test_sparsefuncs.py:451: note: def [T] hstack(blocks: Sequence[_CanStackAs[numpy.bool[builtins.bool], T]], format: None = ..., *, dtype: type[builtins.bool] | type[numpy.bool[builtins.bool]] | dtype[numpy.bool[builtins.bool]] | HasDType[dtype[numpy.bool[builtins.bool]]] | Literal['bool', 'bool_', 'b1', '|b1', '?']) -> T
- sklearn/utils/tests/test_sparsefuncs.py:451: note: def hstack(blocks: Sequence[sparray[Any, tuple[Any, ...]]], format: Literal['bsr'], dtype: type[builtins.bool] | type[numpy.bool[builtins.bool]] | dtype[numpy.bool[builtins.bool]] | HasDType[dtype[numpy.bool[builtins.bool]]] | Literal['bool', 'bool_', 'b1', '|b1', '?']) -> bsr_array[numpy.bool[builtins.bool]]
- sklearn/utils/tests/test_sparsefuncs.py:451: note: def hstack(blocks: Sequence[sparray[Any, tuple[Any, ...]]], format: Literal['coo'], dtype: type[builtins.bool] | type[numpy.bool[builtins.bool]] | dtype[numpy.bool[builtins.bool]] | HasDType[dtype[numpy.bool[builtins.bool]]] | Literal['bool', 'bool_', 'b1', '|b1', '?']) -> coo_array[numpy.bool[builtins.bool], tuple[int, int]]
- sklearn/utils/tests/test_sparsefuncs.py:451: note: def hstack(blocks: Sequence[sparray[Any, tuple[Any, ...]]], format: Literal['csc'], dtype: type[builtins.bool] | type[numpy.bool[builtins.bool]] | dtype[numpy.bool[builtins.bool]] | HasDType[dtype[numpy.bool[builtins.bool]]] | Literal['bool', 'bool_', 'b1', '|b1', '?']) -> csc_array[numpy.bool[builtins.bool]]
- sklearn/utils/tests/test_sparsefuncs.py:451: note: def hstack(blocks: Sequence[sparray[Any, tuple[Any, ...]]], format: Literal['csr'], dtype: type[builtins.bool] | type[numpy.bool[builtins.bool]] | dtype[numpy.bool[builtins.bool]] | HasDType[dtype[numpy.bool[builtins.bool]]] | Literal['bool', 'bool_', 'b1', '|b1', '?']) -> csr_array[numpy.bool[builtins.bool], tuple[int, int]]
- sklearn/utils/tests/test_sparsefuncs.py:451: note: def hstack(blocks: Sequence[sparray[Any, tuple[Any, ...]]], format: Literal['dia'], dtype: type[builtins.bool] | type[numpy.bool[builtins.bool]] | dtype[numpy.bool[builtins.bool]] | HasDType[dtype[numpy.bool[builtins.bool]]] | Literal['bool', 'bool_', 'b1', '|b1', '?']) -> dia_array[numpy.bool[builtins.bool]]
- sklearn/utils/tests/test_sparsefuncs.py:451: note: def hstack(blocks: Sequence[sparray[Any, tuple[Any, ...]]], format: Literal['dok'], dtype: type[builtins.bool] | type[numpy.bool[builtins.bool]] | dtype[numpy.bool[builtins.bool]] | HasDType[dtype[numpy.bool[builtins.bool]]] | Literal['bool', 'bool_', 'b1', '|b1', '?']) -> dok_array[numpy.bool[builtins.bool], tuple[int, int]]
- sklearn/utils/tests/test_sparsefuncs.py:451: note: def hstack(blocks: Sequence[sparray[Any, tuple[Any, ...]]], format: Literal['lil'], dtype: type[builtins.bool] | type[numpy.bool[builtins.bool]] | dtype[numpy.bool[builtins.bool]] | HasDType[dtype[numpy.bool[builtins.bool]]] | Literal['bool', 'bool_', 'b1', '|b1', '?']) -> lil_array[numpy.bool[builtins.bool]]
- sklearn/utils/tests/test_sparsefuncs.py:451: note: def [T] hstack(blocks: Sequence[_CanStackAs[signedinteger[_32Bit | _64Bit], T]], format: None = ..., *, dtype: type[JustInt] | type[signedinteger[_64Bit]] | dtype[signedinteger[_64Bit]] | HasDType[dtype[signedinteger[_64Bit]]] | Literal['int_', 'int', 'intp', 'n', '<n', '>n']) -> T
- sklearn/utils/tests/test_sparsefuncs.py:451: note: def hstack(blocks: Sequence[sparray[Any, tuple[Any, ...]]], format: Literal['bsr'], dtype: type[JustInt] | type[signedinteger[_64Bit]] | dtype[signedinteger[_64Bit]] | HasDType[dtype[signedinteger[_64Bit]]] | Literal['int_', 'int', 'intp', 'n', '<n', '>n']) -> bsr_array[signedinteger[_32Bit | _64Bit]]
- sklearn/utils/tests/test_sparsefuncs.py:451: note: def hstack(blocks: Sequence[sparray[Any, tuple[Any, ...]]], format: Literal['coo'], dtype: type[JustInt] | type[signedinteger[_64Bit]] | dtype[signedinteger[_64Bit]] | HasDType[dtype[signedinteger[_64Bit]]] | Literal['int_', 'int', 'intp', 'n', '<n', '>n']) -> coo_array[signedinteger[_32Bit | _64Bit], tuple[int, int]]
- sklearn/utils/tests/test_sparsefuncs.py:451: note: def hstack(blocks: Sequence[sparray[Any, tuple[Any, ...]]], format: Literal['csc'], dtype: type[JustInt] | type[signedinteger[_64Bit]] | dtype[signedinteger[_64Bit]] | HasDType[dtype[signedinteger[_64Bit]]] | Literal['int_', 'int', 'intp', 'n', '<n', '>n']) -> csc_array[signedinteger[_32Bit | _64Bit]]
- sklearn/utils/tests/test_sparsefuncs.py:451: note: def hstack(blocks: Sequence[sparray[Any, tuple[Any, ...]]], format: Literal['csr'], dtype: type[JustInt] | type[signedinteger[_64Bit]] | dtype[signedinteger[_64Bit]] | HasDType[dtype[signedinteger[_64Bit]]] | Literal['int_', 'int', 'intp', 'n', '<n', '>n']) -> csr_array[signedinteger[_32Bit | _64Bit], tuple[int, int]]
- sklearn/utils/tests/test_sparsefuncs.py:451: note: def hstack(blocks: Sequence[sparray[Any, tuple[Any, ...]]], format: Literal['dia'], dtype: type[JustInt] | type[signedinteger[_64Bit]] | dtype[signedinteger[_64Bit]] | HasDType[dtype[signedinteger[_64Bit]]] | Literal['int_', 'int', 'intp', 'n', '<n', '>n']) -> dia_array[signedinteger[_32Bit | _64Bit]]
- sklearn/utils/tests/test_sparsefuncs.py:451: note: def hstack(blocks: Sequence[sparray[Any, tuple[Any, ...]]], format: Literal['dok'], dtype: type[JustInt] | type[signedinteger[_64Bit]] | dtype[signedinteger[_64Bit]] | HasDType[dtype[signedinteger[_64Bit]]] | Literal['int_', 'int', 'intp', 'n', '<n', '>n']) -> dok_array[signedinteger[_32Bit | _64Bit], tuple[int, int]]
- sklearn/utils/tests/test_sparsefuncs.py:451: note: def hstack(blocks: Sequence[sparray[Any, tuple[Any, ...]]], format: Literal['lil'], dtype: type[JustInt] | type[signedinteger[_64Bit]] | dtype[signedinteger[_64Bit]] | HasDType[dtype[signedinteger[_64Bit]]] | Literal['int_', 'int', 'intp', 'n', '<n', '>n']) -> lil_array[signedinteger[_32Bit | _64Bit]]
- sklearn/utils/tests/test_sparsefuncs.py:451: note: def [T] hstack(blocks: Sequence[_CanStackAs[float64, T]], format: None = ..., *, dtype: type[JustFloat] | type[floating[_64Bit]] | dtype[floating[_64Bit]] | HasDType[dtype[floating[_64Bit]]] | Literal['float64', 'double', 'float', 'f8', '<f8', '>f8', 'd']) -> T
- sklearn/utils/tests/test_sparsefuncs.py:451: note: def hstack(blocks: Sequence[sparray[Any, tuple[Any, ...]]], format: Literal['bsr'], dtype: type[JustFloat] | type[floating[_64Bit]] | dtype[floating[_64Bit]] | HasDType[dtype[floating[_64Bit]]] | Literal['float64', 'double', 'float', 'f8', '<f8', '>f8', 'd']) -> bsr_array[float64]
- sklearn/utils/tests/test_sparsefuncs.py:451: note: def hstack(blocks: Sequence[sparray[Any, tuple[Any, ...]]], format: Literal['coo'], dtype: type[JustFloat] | type[floating[_64Bit]] | dtype[floating[_64Bit]] | HasDType[dtype[floating[_64Bit]]] | Literal['float64', 'double', 'float', 'f8', '<f8', '>f8', 'd']) -> coo_array[float64, tuple[int, int]]
- sklearn/utils/tests/test_sparsefuncs.py:451: note: def hstack(blocks: Sequence[sparray[Any, tuple[Any, ...]]], format: Literal['csc'], dtype: type[JustFloat] | type[floating[_64Bit]] | dtype[floating[_64Bit]] | HasDType[dtype[floating[_64Bit]]] | Literal['float64', 'double', 'float', 'f8', '<f8', '>f8', 'd']) -> csc_array[float64]
- sklearn/utils/tests/test_sparsefuncs.py:451: note: def hstack(blocks: Sequence[sparray[Any, tuple[Any, ...]]], format: Literal['csr'], dtype: type[JustFloat] | type[floating[_64Bit]] | dtype[floating[_64Bit]] | HasDType[dtype[floating[_64Bit]]] | Literal['float64', 'double', 'float', 'f8', '<f8', '>f8', 'd']) -> csr_array[float64, tuple[int, int]]
- sklearn/utils/tests/test_sparsefuncs.py:451: note: def hstack(blocks: Sequence[sparray[Any, tuple[Any, ...]]], format: Literal['dia'], dtype: type[JustFloat] | type[floating[_64Bit]] | dtype[floating[_64Bit]] | HasDType[dtype[floating[_64Bit]]] | Literal['float64', 'double', 'float', 'f8', '<f8', '>f8', 'd']) -> dia_array[float64]
- sklearn/utils/tests/test_sparsefuncs.py:451: note: def hstack(blocks: Sequence[sparray[Any, tuple[Any, ...]]], format: Literal['dok'], dtype: type[JustFloat] | type[floating[_64Bit]] | dtype[floating[_64Bit]] | HasDType[dtype[floating[_64Bit]]] | Literal['float64', 'double', 'float', 'f8', '<f8', '>f8', 'd']) -> dok_array[float64, tuple[int, int]]
- sklearn/utils/tests/test_sparsefuncs.py:451: note: def hstack(blocks: Sequence[sparray[Any, tuple[Any, ...]]], format: Literal['lil'], dtype: type[JustFloat] | type[floating[_64Bit]] | dtype[floating[_64Bit]] | HasDType[dtype[floating[_64Bit]]] | Literal['float64', 'double', 'float', 'f8', '<f8', '>f8', 'd']) -> lil_array[float64]
- sklearn/utils/tests/test_sparsefuncs.py:451: note: def [T] hstack(blocks: Sequence[_CanStackAs[complex128, T]], format: None = ..., *, dtype: type[JustComplex] | type[complexfloating[_64Bit, _64Bit]] | dtype[complexfloating[_64Bit, _64Bit]] | HasDType[dtype[complexfloating[_64Bit, _64Bit]]] | Literal['complex', 'complex128', 'cdouble', 'c16', '<c16', '>c16', 'D']) -> T
- sklearn/utils/tests/test_sparsefuncs.py:451: note: def hstack(blocks: Sequence[sparray[Any, tuple[Any, ...]]], format: Literal['bsr'], dtype: type[JustComplex] | type[complexfloating[_64Bit, _64Bit]] | dtype[complexfloating[_64Bit, _64Bit]] | HasDType[dtype[complexfloating[_64Bit, _64Bit]]] | Literal['complex', 'complex128', 'cdouble', 'c16', '<c16', '>c16', 'D']) -> bsr_array[complex128]
- sklearn/utils/tests/test_sparsefuncs.py:451: note: def hstack(blocks: Sequence[sparray[Any, tuple[Any, ...]]], format: Literal['coo'], dtype: type[JustComplex] | type[complexfloating[_64Bit, _64Bit]] | dtype[complexfloating[_64Bit, _64Bit]] | HasDType[dtype[complexfloating[_64Bit, _64Bit]]] | Literal['complex', 'complex128', 'cdouble', 'c16', '<c16', '>c16', 'D']) -> coo_array[complex128, tuple[int, int]]
- sklearn/utils/tests/test_sparsefuncs.py:451: note: def hstack(blocks: Sequence[sparray[Any, tuple[Any, ...]]], format: Literal['csc'], dtype: type[JustComplex] | type[complexfloating[_64Bit, _64Bit]] | dtype[complexfloating[_64Bit, _64Bit]] | HasDType[dtype[complexfloating[_64Bit, _64Bit]]] | Literal['complex', 'complex128', 'cdouble', 'c16', '<c16', '>c16', 'D']) -> csc_array[complex128]
- sklearn/utils/tests/test_sparsefuncs.py:451: note: def hstack(blocks: Sequence[sparray[Any, tuple[Any, ...]]], format: Literal['csr'], dtype: type[JustComplex] | type[complexfloating[_64Bit, _64Bit]] | dtype[complexfloating[_64Bit, _64Bit]] | HasDType[dtype[complexfloating[_64Bit, _64Bit]]] | Literal['complex', 'complex128', 'cdouble', 'c16', '<c16', '>c16', 'D']) -> csr_array[complex128, tuple[int, int]]
- sklearn/utils/tests/test_sparsefuncs.py:451: note: def hstack(blocks: Sequence[sparray[Any, tuple[Any, ...]]], format: Literal['dia'], dtype: type[JustComplex] | type[complexfloating[_64Bit, _64Bit]] | dtype[complexfloating[_64Bit, _64Bit]] | HasDType[dtype[complexfloating[_64Bit, _64Bit]]] | Literal['complex', 'complex128', 'cdouble', 'c16', '<c16', '>c16', 'D']) -> dia_array[complex128]
... (truncated 56 lines) ...
pytest (https://github.com/pytest-dev/pytest)
+ testing/typing_checks.py:78: error: List item 0 has incompatible type "type[ImportError]"; expected "type[Exception]" [list-item]
pandas (https://github.com/pandas-dev/pandas): 1.15x slower (266.4s -> 306.1s in single noisy sample)
+ pandas/tests/groupby/test_libgroupby.py:153: error: List item 1 has incompatible type "tuple[def group_cumprod(out: ndarray[tuple[Any, ...], dtype[Any]], values: ndarray[tuple[Any, ...], dtype[Any]], labels: ndarray[tuple[Any, ...], dtype[Any]], ngroups: int, is_datetimelike: bool, skipna: bool = ..., mask: ndarray[tuple[Any, ...], dtype[Any]] | None = ..., result_mask: ndarray[tuple[Any, ...], dtype[Any]] | None = ...) -> None, overloaded function]"; expected "tuple[def group_cumsum(out: ndarray[tuple[Any, ...], dtype[Any]], values: ndarray[tuple[Any, ...], dtype[Any]], labels: ndarray[tuple[Any, ...], dtype[Any]], ngroups: int, is_datetimelike: bool, skipna: bool = ..., mask: ndarray[tuple[Any, ...], dtype[Any]] | None = ..., result_mask: ndarray[tuple[Any, ...], dtype[Any]] | None = ...) -> None, overloaded function]" [list-item]
+ pandas/tests/dtypes/test_missing.py:858: error: Unused "type: ignore" comment [unused-ignore]
... (truncated 66 lines) ...``` |
|
OK, some updates:
|
Otherwise mypy plugin crashes, see python/mypy#22286
Ref #22063
I think this is the right thing to do, even though this unfortunately (but unsurprisingly) causes some visible slow-down (because we infer 2-3x more constraints):
I add couple micro-optimizations in relevant code paths to minimize the impact.
The implementation is generally straightforward: use both sides buy default, and only fall back to outer context if there are problems (to give consistent type errors). My plan is to split the change into few smaller things:
5a. Fix false-negative bug due to
Anyleaking from partial context. This is present on master and quite benign, but may happen more often with the new logic.For now I added just a few test to illustrate the core idea (plus one test case that I find amusing). I will investigate the
mypy_primerandmypy-issues, and probably will add some more tests.cc @JukkaL @hauntsaninja