GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||
GeezerVison is showing github.com — Limit binder special-casing to imprecise Any by ilevkivskyi · Pull Request #22050 · python/mypy Conversation
|
|
Mostly expected things, but there are couple weird results in In the meantime, I remember last time we tried this, it caused issues for |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I think primer looks very good. New errors in def _match_version(self, got_tuple: tuple[int, ...]) -> bool: ... op: Callable[[tuple[int, ...], tuple[int, ...]], bool] op = getattr(operator, self._OP_NAMES[self.op]) return op(got_tuple, version_tuple) IMO this is exactly the case where this error should be given. Literally nothing prevents me from writing: def _match_version(self, got_tuple: tuple[int, ...]) -> Cake: ... op: Callable[[tuple[int, ...], tuple[int, ...]], Cake] op = getattr(operator, self._OP_NAMES[self.op]) return op(got_tuple, version_tuple) But this doesn't mean I will get a cake. I think these are all from people who can't have even a single |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Btw cc @cdce8p (so that it will not be a surprise for you). |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Primer looks great, thanks! One comment about tests, otherwise looks good.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| reveal_type(self) # N: Revealed type is "__main__.Child" | ||
| reveal_type(self) # N: Revealed type is "None" | ||
| return None # E: Incompatible return value type (got "None", expected "int") | ||
| reveal_type(self) # N: Revealed type is "Any" |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Add a new test case focused on the new behavior, as now it seems to be tested only incidentally?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Diff from mypy_primer, showing the effect of this PR on open source code: spark (https://github.com/apache/spark) + python/pyspark/pandas/groupby.py:357: error: Unused "type: ignore" comment [unused-ignore] + python/pyspark/sql/connect/column.py:90: error: Unused "type: ignore" comment [unused-ignore] psycopg (https://github.com/psycopg/psycopg) + tests/utils.py:143: error: Returning Any from function declared to return "bool" [no-any-return] prefect (https://github.com/PrefectHQ/prefect) - src/prefect/cli/deploy/_core.py:356: error: Argument 1 to "_initialize_deployment_triggers" has incompatible type "Any | None"; expected "str" [arg-type] colour (https://github.com/colour-science/colour) - colour/appearance/atd95.py:264: error: No overload variant of "__mul__" of "ndarray" matches argument type "Buffer" [operator] - colour/appearance/atd95.py:264: note: Possible overload variants: - colour/appearance/atd95.py:264: note: def __mul__(self, int | numpy.bool[builtins.bool], /) -> ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]] - colour/appearance/atd95.py:264: note: def __mul__(self, _SupportsArray[dtype[numpy.bool[builtins.bool]]] | _NestedSequence[_SupportsArray[dtype[numpy.bool[builtins.bool]]]] | builtins.bool | _NestedSequence[builtins.bool], /) -> ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]] - colour/appearance/atd95.py:264: note: def __mul__(self, _SupportsArray[dtype[floating[_64Bit]]] | _NestedSequence[_SupportsArray[dtype[floating[_64Bit]]]], /) -> ndarray[tuple[Any, ...], dtype[float64]] - colour/appearance/atd95.py:264: note: def __mul__(self, _SupportsArray[dtype[complexfloating[_64Bit, _64Bit]]] | _NestedSequence[_SupportsArray[dtype[complexfloating[_64Bit, _64Bit]]]], /) -> ndarray[tuple[Any, ...], dtype[complex128]] - colour/appearance/atd95.py:264: note: def __mul__(self, _SupportsArray[dtype[numpy.bool[builtins.bool] | integer[Any] | floating[Any]]] | _NestedSequence[_SupportsArray[dtype[numpy.bool[builtins.bool] | integer[Any] | floating[Any]]]] | float | _NestedSequence[float], /) -> ndarray[tuple[Any, ...], dtype[floating[Any]]] - colour/appearance/atd95.py:264: note: def __mul__(self, _SupportsArray[dtype[numpy.bool[builtins.bool] | number[Any, Any]]] | _NestedSequence[_SupportsArray[dtype[numpy.bool[builtins.bool] | number[Any, Any]]]] | complex | _NestedSequence[complex], /) -> ndarray[tuple[Any, ...], dtype[complexfloating[Any, Any]]] - colour/appearance/atd95.py:264: note: def __mul__(self, _SupportsArray[dtype[numpy.bool[builtins.bool] | number[Any, Any]]] | _NestedSequence[_SupportsArray[dtype[numpy.bool[builtins.bool] | number[Any, Any]]]] | complex | _NestedSequence[complex], /) -> ndarray[tuple[Any, ...], dtype[number[Any, Any]]] - colour/appearance/atd95.py:264: note: def __mul__(self, _SupportsArray[dtype[timedelta64[Any]]] | _NestedSequence[_SupportsArray[dtype[timedelta64[Any]]]], /) -> ndarray[tuple[Any, ...], dtype[timedelta64[Any]]] - colour/appearance/atd95.py:264: note: def __mul__(self, _SupportsArray[dtype[object_]] | _NestedSequence[_SupportsArray[dtype[object_]]], /) -> Any - colour/appearance/atd95.py:264: error: Unsupported operand types for * ("ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]]" and "_NestedSequence[complex | bytes | str]") [operator] - colour/appearance/atd95.py:264: note: Right operand is of type "Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]" - colour/appearance/atd95.py:264: error: No overload variant of "__add__" of "ndarray" matches argument type "bytes" [operator] - colour/appearance/atd95.py:264: note: def __add__(self, int | numpy.bool[builtins.bool], /) -> ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]] - colour/appearance/atd95.py:264: note: def __add__(self, _SupportsArray[dtype[numpy.bool[builtins.bool]]] | _NestedSequence[_SupportsArray[dtype[numpy.bool[builtins.bool]]]] | builtins.bool | _NestedSequence[builtins.bool], /) -> ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]] - colour/appearance/atd95.py:264: note: def __add__(self, _SupportsArray[dtype[floating[_64Bit]]] | _NestedSequence[_SupportsArray[dtype[floating[_64Bit]]]], /) -> ndarray[tuple[Any, ...], dtype[float64]] - colour/appearance/atd95.py:264: note: def __add__(self, _SupportsArray[dtype[complexfloating[_64Bit, _64Bit]]] | _NestedSequence[_SupportsArray[dtype[complexfloating[_64Bit, _64Bit]]]], /) -> ndarray[tuple[Any, ...], dtype[complex128]] - colour/appearance/atd95.py:264: note: def __add__(self, _SupportsArray[dtype[numpy.bool[builtins.bool] | integer[Any] | floating[Any]]] | _NestedSequence[_SupportsArray[dtype[numpy.bool[builtins.bool] | integer[Any] | floating[Any]]]] | float | _NestedSequence[float], /) -> ndarray[tuple[Any, ...], dtype[floating[Any]]] - colour/appearance/atd95.py:264: note: def __add__(self, _SupportsArray[dtype[numpy.bool[builtins.bool] | number[Any, Any]]] | _NestedSequence[_SupportsArray[dtype[numpy.bool[builtins.bool] | number[Any, Any]]]] | complex | _NestedSequence[complex], /) -> ndarray[tuple[Any, ...], dtype[complexfloating[Any, Any]]] - colour/appearance/atd95.py:264: note: def __add__(self, _SupportsArray[dtype[numpy.bool[builtins.bool] | number[Any, Any]]] | _NestedSequence[_SupportsArray[dtype[numpy.bool[builtins.bool] | number[Any, Any]]]] | complex | _NestedSequence[complex], /) -> ndarray[tuple[Any, ...], dtype[number[Any, Any]]] - colour/appearance/atd95.py:264: note: def __add__(self, _SupportsArray[dtype[object_]] | _NestedSequence[_SupportsArray[dtype[object_]]], /) -> Any - colour/appearance/atd95.py:264: error: No overload variant of "__add__" of "ndarray" matches argument type "str" [operator] - colour/appearance/atd95.py:264: note: def __add__(self, int | numpy.bool[builtins.bool], /) -> ndarray[tuple[Any, ...], dtype[complexfloating[Any, Any]]] - colour/appearance/atd95.py:264: note: def __add__(self, _SupportsArray[dtype[numpy.bool[builtins.bool]]] | _NestedSequence[_SupportsArray[dtype[numpy.bool[builtins.bool]]]] | builtins.bool | _NestedSequence[builtins.bool], /) -> ndarray[tuple[Any, ...], dtype[complexfloating[Any, Any]]] - colour/appearance/atd95.py:264: error: Unsupported operand types for + ("bytes" and "str") [operator] - colour/appearance/atd95.py:264: error: Unsupported operand types for + ("str" and "ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]]") [operator] - colour/appearance/atd95.py:264: error: Unsupported operand types for + ("str" and "ndarray[tuple[Any, ...], dtype[complexfloating[Any, Any]]]") [operator] - colour/appearance/atd95.py:264: error: Unsupported operand types for + ("str" and "bytes") [operator] - colour/appearance/atd95.py:264: note: Both left and right operands are unions - colour/models/rgb/rgb_colourspace.py:1064: error: Item "str" of "RGB_Colourspace | str" has no attribute "whitepoint" [union-attr] - colour/models/rgb/rgb_colourspace.py:1066: error: Item "str" of "RGB_Colourspace | str" has no attribute "whitepoint" [union-attr] - colour/models/rgb/rgb_colourspace.py:1067: error: Item "str" of "RGB_Colourspace | str" has no attribute "matrix_XYZ_to_RGB" [union-attr] - colour/models/rgb/rgb_colourspace.py:1068: error: Item "str" of "RGB_Colourspace | str" has no attribute "cctf_encoding" [union-attr] - colour/models/rgb/rgb_colourspace.py:1197: error: Item "str" of "RGB_Colourspace | str" has no attribute "whitepoint" [union-attr] - colour/models/rgb/rgb_colourspace.py:1199: error: Item "str" of "RGB_Colourspace | str" has no attribute "whitepoint" [union-attr] - colour/models/rgb/rgb_colourspace.py:1200: error: Item "str" of "RGB_Colourspace | str" has no attribute "matrix_RGB_to_XYZ" [union-attr] - colour/models/rgb/rgb_colourspace.py:1201: error: Item "str" of "RGB_Colourspace | str" has no attribute "cctf_decoding" [union-attr] hydra-zen (https://github.com/mit-ll-responsible-ai/hydra-zen) + src/hydra_zen/structured_configs/_make_config.py:278: error: Unused "type: ignore" comment [unused-ignore] scrapy (https://github.com/scrapy/scrapy) + scrapy/downloadermiddlewares/httpcache.py:108: error: Returning Any from function declared to return "Request | Response | None" [no-any-return] urllib3 (https://github.com/urllib3/urllib3) + src/urllib3/connectionpool.py:760: error: Unused "type: ignore" comment [unused-ignore] comtypes (https://github.com/enthought/comtypes) - comtypes/errorinfo.py:128: error: Item "str" of "Any | str" has no attribute "as_progid" [union-attr] core (https://github.com/home-assistant/core) - Warning: disabling incremental mode may severely reduce performance - If this is intentional, delete '.mypy_cache' to suppress this warning + homeassistant/components/cloud/account_link.py:66: error: Returning Any from function declared to return "list[dict[str, Any]]" [no-any-return] + homeassistant/components/homeassistant/exposed_entities.py:257: error: Returning Any from function declared to return "bool" [no-any-return] + homeassistant/components/homeassistant/exposed_entities.py:284: error: Returning Any from function declared to return "bool" [no-any-return] + homeassistant/components/mqtt/models.py:398: error: Returning Any from function declared to return "str | bytes | bytearray" [no-any-return] + homeassistant/components/mqtt/models.py:424: error: Returning Any from function declared to return "str | bytes | bytearray" [no-any-return] + homeassistant/components/shelly/entity.py:592: error: Returning Any from function declared to return "str | int | float | None" [no-any-return] + homeassistant/components/unifiprotect/utils.py:85: error: Returning Any from function declared to return "dict[str, Any]" [no-any-return] + homeassistant/components/enphase_envoy/coordinator.py:91: error: Returning Any from function declared to return "bool" [no-any-return] + homeassistant/components/mqtt/config_flow.py:849: error: Returning Any from function declared to return "str" [no-any-return] dulwich (https://github.com/dulwich/dulwich) + dulwich/client.py:4471: error: Returning Any from function declared to return "ProxyManager | PoolManager | AuthCallbackPoolManager" [no-any-return] scipy (https://github.com/scipy/scipy) - scipy/spatial/transform/_rotation_xp.py:521: error: Unsupported operand types for > ("int" and "Buffer") [operator] - scipy/spatial/transform/_rotation_xp.py:521: error: Unsupported operand types for > ("int" and "_SupportsArray[dtype[Any]]") [operator] - scipy/spatial/transform/_rotation_xp.py:521: error: Unsupported operand types for > ("int" and "_NestedSequence[_SupportsArray[dtype[Any]]]") [operator] - scipy/spatial/transform/_rotation_xp.py:521: error: Unsupported operand types for > ("int" and "complex") [operator] - scipy/spatial/transform/_rotation_xp.py:521: error: Unsupported operand types for > ("int" and "_NestedSequence[complex | bytes | str]") [operator] - scipy/spatial/transform/_rotation_xp.py:521: note: Left operand is of type "Any | Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | str | _NestedSequence[complex | bytes | str]" - scipy/spatial/transform/_rotation_xp.py:521: error: Unsupported operand types for < ("str" and "int") [operator] - scipy/spatial/transform/_rotation_xp.py:529: error: Item "Buffer" of "Any | Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | str | _NestedSequence[complex | bytes | str]" has no attribute "shape" [union-attr] - scipy/spatial/transform/_rotation_xp.py:529: error: Item "_SupportsArray[dtype[Any]]" of "Any | Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | str | _NestedSequence[complex | bytes | str]" has no attribute "shape" [union-attr] - scipy/spatial/transform/_rotation_xp.py:529: error: Item "_NestedSequence[_SupportsArray[dtype[Any]]]" of "Any | Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | str | _NestedSequence[complex | bytes | str]" has no attribute "shape" [union-attr] - scipy/spatial/transform/_rotation_xp.py:529: error: Item "complex" of "Any | Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | str | _NestedSequence[complex | bytes | str]" has no attribute "shape" [union-attr] - scipy/spatial/transform/_rotation_xp.py:529: error: Item "str" of "Any | Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | str | _NestedSequence[complex | bytes | str]" has no attribute "shape" [union-attr] - scipy/spatial/transform/_rotation_xp.py:529: error: Item "_NestedSequence[complex | bytes | str]" of "Any | Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | str | _NestedSequence[complex | bytes | str]" has no attribute "shape" [union-attr] - scipy/spatial/transform/_rotation_xp.py:532: error: Item "Buffer" of "Any | Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | str | _NestedSequence[complex | bytes | str]" has no attribute "shape" [union-attr] - scipy/spatial/transform/_rotation_xp.py:532: error: Item "_SupportsArray[dtype[Any]]" of "Any | Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | str | _NestedSequence[complex | bytes | str]" has no attribute "shape" [union-attr] - scipy/spatial/transform/_rotation_xp.py:532: error: Item "_NestedSequence[_SupportsArray[dtype[Any]]]" of "Any | Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | str | _NestedSequence[complex | bytes | str]" has no attribute "shape" [union-attr] - scipy/spatial/transform/_rotation_xp.py:532: error: Item "complex" of "Any | Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | str | _NestedSequence[complex | bytes | str]" has no attribute "shape" [union-attr] - scipy/spatial/transform/_rotation_xp.py:532: error: Item "str" of "Any | Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | str | _NestedSequence[complex | bytes | str]" has no attribute "shape" [union-attr] - scipy/spatial/transform/_rotation_xp.py:532: error: Item "_NestedSequence[complex | bytes | str]" of "Any | Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | str | _NestedSequence[complex | bytes | str]" has no attribute "shape" [union-attr] - scipy/stats/_entropy.py:328: error: Item "Buffer" of "Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]" has no attribute "shape" [union-attr] - scipy/stats/_entropy.py:328: error: Item "_SupportsArray[dtype[Any]]" of "Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]" has no attribute "shape" [union-attr] - scipy/stats/_entropy.py:328: error: Item "_NestedSequence[_SupportsArray[dtype[Any]]]" of "Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]" has no attribute "shape" [union-attr] - scipy/stats/_entropy.py:328: error: Item "complex" of "Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]" has no attribute "shape" [union-attr] - scipy/stats/_entropy.py:328: error: Item "bytes" of "Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]" has no attribute "shape" [union-attr] - scipy/stats/_entropy.py:328: error: Item "str" of "Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]" has no attribute "shape" [union-attr] - scipy/stats/_entropy.py:328: error: Item "_NestedSequence[complex | bytes | str]" of "Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]" has no attribute "shape" [union-attr] - scipy/stats/_entropy.py:369: error: Item "Buffer" of "Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]" has no attribute "dtype" [union-attr] - scipy/stats/_entropy.py:369: error: Item "_SupportsArray[dtype[Any]]" of "Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]" has no attribute "dtype" [union-attr] - scipy/stats/_entropy.py:369: error: Item "_NestedSequence[_SupportsArray[dtype[Any]]]" of "Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]" has no attribute "dtype" [union-attr] - scipy/stats/_entropy.py:369: error: Item "complex" of "Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]" has no attribute "dtype" [union-attr] - scipy/stats/_entropy.py:369: error: Item "bytes" of "Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]" has no attribute "dtype" [union-attr] - scipy/stats/_entropy.py:369: error: Item "str" of "Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]" has no attribute "dtype" [union-attr] - scipy/stats/_entropy.py:369: error: Item "_NestedSequence[complex | bytes | str]" of "Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]" has no attribute "dtype" [union-attr] + scipy/spatial/transform/_rotation.py:2578: error: Unused "type: ignore" comment [unused-ignore] - scipy/conftest.py:721: error: "str" not callable [operator] pydantic (https://github.com/pydantic/pydantic) + pydantic/v1/main.py:864: error: Unused "type: ignore" comment [unused-ignore] - pydantic/_internal/_discriminated_union.py:210: error: "Mapping[str, Any]" has no attribute "pop" [attr-defined] - pydantic/types.py:3148: error: "Mapping[str, Any]" has no attribute "pop" [attr-defined] - pydantic/_internal/_known_annotated_metadata.py:223: error: Unsupported target for indexed assignment ("Mapping[str, Any]") [index] - pydantic/_internal/_known_annotated_metadata.py:223: error: Unsupported target for indexed assignment ("Mapping[str, Any] | AfterValidatorFunctionSchema") [index] - pydantic/_internal/_generate_schema.py:2358: error: Unsupported target for indexed assignment ("Mapping[str, Any]") [index] - pydantic/_internal/_generate_schema.py:2366: error: Unsupported target for indexed assignment ("Mapping[str, Any]") [index] + pydantic/deprecated/copy_internals.py:49: error: Unused "type: ignore" comment [unused-ignore] - pydantic/experimental/pipeline.py:464: error: Unsupported target for indexed assignment ("Mapping[str, Any] | Any") [index] - pydantic/experimental/pipeline.py:468: error: Unsupported target for indexed assignment ("Mapping[str, Any] | Any") [index] - pydantic/experimental/pipeline.py:472: error: Unsupported target for indexed assignment ("Mapping[str, Any] | Any") [index] - pydantic/experimental/pipeline.py:496: error: Unsupported target for indexed assignment ("Mapping[str, Any] | Any") [index] - pydantic/experimental/pipeline.py:507: error: Unsupported target for indexed assignment ("Mapping[str, Any] | Any") [index] - pydantic/experimental/pipeline.py:518: error: Unsupported target for indexed assignment ("Mapping[str, Any] | Any") [index] - pydantic/experimental/pipeline.py:529: error: Unsupported target for indexed assignment ("Mapping[str, Any] | Any") [index] - pydantic/experimental/pipeline.py:543: error: Unsupported target for indexed assignment ("Mapping[str, Any] | Any") [index] - pydantic/experimental/pipeline.py:545: error: Unsupported target for indexed assignment ("Mapping[str, Any] | Any") [index] - pydantic/experimental/pipeline.py:562: error: Unsupported target for indexed assignment ("Mapping[str, Any] | Any") [index] - pydantic/experimental/pipeline.py:575: error: Unsupported target for indexed assignment ("Mapping[str, Any] | Any") [index] - pydantic/experimental/pipeline.py:586: error: Unsupported target for indexed assignment ("Mapping[str, Any] | Any") [index] - pydantic/experimental/pipeline.py:655: error: Unsupported target for indexed assignment ("Mapping[str, Any] | Any") [index] beartype (https://github.com/beartype/beartype) + error: INTERNAL ERROR -- Please try using mypy master on GitHub: + https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build + Please report a bug at https://github.com/python/mypy/issues + version: 2.5.0+dev.0256f151cacd8a9d597a733fe6539c13cc4c5108 + note: use --pdb to drop into pdb + Traceback (most recent call last): + File "", line 6, in <module> + sys.exit(console_entry()) + File "/__main__.py", line 16, in console_entry + main() + ~~~~^^ + File "/main.py", line 167, in main + res, messages, blockers = run_build(sources, options, fscache, t0, stdout, stderr) + ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/main.py", line 257, in run_build + res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr) + File "/build.py", line 388, in build + metastore = create_metastore(options, parallel_worker=False) + File "/build.py", line 1902, in create_metastore + mds: MetadataStore = SqliteMetadataStore( + ~~~~~~~~~~~~~~~~~~~^ + _cache_dir_prefix(options), + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + set_journal_mode=not parallel_worker, + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + num_shards=options.sqlite_num_shards, + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + ) + ^ + File "/metastore.py", line 200, in __init__ + connect_db(os_path_join(cache_dir_prefix, f"cache.{i}.db"), set_journal_mode) + ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/metastore.py", line 174, in connect_db + db.execute("PRAGMA journal_mode=WAL") + ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^ + sqlite3.OperationalError: database is locked + - beartype/typing/__init__.py:331: error: Unused "type: ignore" comment [unused-ignore] - beartype/_util/kind/maplike/utilmaptest.py:96: error: Unused "type: ignore" comment [unused-ignore] - beartype/_cave/_cavefast.py:181: error: Unused "type: ignore" comment [unused-ignore] - beartype/_cave/_cavefast.py:289: error: Unused "type: ignore" comment [unused-ignore] - beartype/_cave/_cavefast.py:1402: error: Unused "type: ignore" comment [unused-ignore] - beartype/_util/text/utiltextjoin.py:339: error: Unused "type: ignore" comment [unused-ignore] - beartype/_util/kind/maplike/utilmapfrozen.py:224: error: Unused "type: ignore" comment [unused-ignore] - beartype/_util/error/utilerrwarn.py:83: error: Unused "type: ignore" comment [unused-ignore] - beartype/_util/error/utilerrwarn.py:89: error: Unused "type: ignore" comment [unused-ignore] - beartype/_util/error/utilerrwarn.py:124: error: Unused "type: ignore" comment [unused-ignore] - beartype/_util/hint/utilhintfactory.py:46: error: Unused "type: ignore" comment [unused-ignore] - beartype/_conf/_confoverrides.py:89: error: Unused "type: ignore" comment [unused-ignore] - beartype/_conf/confmain.py:1437: error: Unused "type: ignore" comment [unused-ignore] - beartype/_util/utilobjattr.py:362: error: Unused "type: ignore" comment [unused-ignore] - beartype/_util/text/utiltextlabel.py:179: error: Unused "type: ignore" comment [unused-ignore] - beartype/_util/module/utilmodtest.py:21: error: Unused "type: ignore" comment [unused-ignore] - beartype/_util/hint/pep/proposal/pep696.py:118: error: Unused "type: ignore" comment [unused-ignore] - beartype/_util/hint/pep/proposal/pep557.py:81: error: Unused "type: ignore" comment [unused-ignore] - beartype/_util/hint/pep/proposal/pep749/pep749evaluate.py:265: error: Unused "type: ignore" comment [unused-ignore] - beartype/_util/hint/pep/proposal/pep646/pep646692unpack.py:483: error: Unused "type: ignore" comment [unused-ignore] - beartype/_util/hint/pep/proposal/pep646/pep646692unpack.py:520: error: Unused "type: ignore" comment [unused-ignore] - beartype/_util/hint/pep/proposal/pep646/pep646692unpack.py:609: error: Unused "type: ignore" comment [unused-ignore] - beartype/_util/hint/pep/proposal/pep484585/pep484585args.py:61: error: Unused "type: ignore" comment [unused-ignore] - beartype/_util/hint/pep/proposal/pep484/pep484union.py:87: error: Unused "type: ignore" comment [unused-ignore] - beartype/_util/hint/pep/proposal/pep484/pep484604union.py:150: error: Unused "type: ignore" comment [unused-ignore] - beartype/_util/hint/pep/proposal/pep484/pep484604union.py:277: error: Unused "type: ignore" comment [unused-ignore] - beartype/_util/hint/pep/proposal/pep484/pep484604union.py:282: error: Unused "type: ignore" comment [unused-ignore] - beartype/_util/func/utilfuncscope.py:822: error: Unused "type: ignore" comment [unused-ignore] - beartype/_util/func/utilfuncframe.py:1239: error: Unused "type: ignore" comment [unused-ignore] - beartype/_util/func/utilfunccodeobj.py:130: error: Unused "type: ignore" comment [unused-ignore] - beartype/_util/func/utilfunccodeobj.py:348: error: Unused "type: ignore" comment [unused-ignore] - beartype/_util/api/external/utilnumpy.py:254: error: Unused "type: ignore" comment [unused-ignore] - beartype/_check/forward/reference/_cls/fwdreffake.py:189: error: Unused "type: ignore" comment [unused-ignore] - beartype/bite/kind/inferthirdparty.py:125: error: Unused "type: ignore" comment [unused-ignore] - beartype/bite/kind/inferthirdparty.py:134: error: Unused "type: ignore" comment [unused-ignore] - beartype/bite/kind/inferthirdparty.py:138: error: Unused "type: ignore[misc, valid-type]" comment [unused-ignore] - beartype/bite/kind/inferthirdparty.py:144: error: Unused "type: ignore" comment [unused-ignore] - beartype/bite/collection/infercollectionsabc.py:163: error: Unused "type: ignore" comment [unused-ignore] - beartype/bite/collection/infercollectionsabc.py:830: error: Unused "type: ignore" comment [unused-ignore] - beartype/_util/hint/pep/proposal/pep586.py:243: error: Unused "type: ignore" comment [unused-ignore] - beartype/_util/hint/pep/proposal/pep544.py:115: error: Unused "type: ignore" comment [unused-ignore] - beartype/_util/hint/pep/proposal/pep749/pep484749forwardref.py:471: error: Unused "type: ignore" comment [unused-ignore] - beartype/_util/hint/pep/proposal/pep484/pep484generic.py:149: error: Unused "type: ignore" comment [unused-ignore] - beartype/_util/hint/pep/proposal/pep484/pep484generic.py:177: error: Unused "type: ignore" comment [unused-ignore] - beartype/_util/func/utilfuncmake.py:24: error: Unused "type: ignore" comment [unused-ignore] - beartype/_util/func/utilfuncmake.py:308: error: Unused "type: ignore" comment [unused-ignore] - beartype/_util/func/utilfuncmake.py:313: error: Unused "type: ignore" comment [unused-ignore] - beartype/_util/func/utilfuncmake.py:355: error: Unused "type: ignore" comment [unused-ignore] - beartype/_util/func/utilfuncmake.py:356: error: Unused "type: ignore" comment [unused-ignore] - beartype/_util/cls/pep/clspep3119.py:99: error: Unused "type: ignore" comment [unused-ignore] - beartype/_util/cls/pep/clspep3119.py:278: error: Unused "type: ignore" comment [unused-ignore] - beartype/_util/cls/pep/clspep3119.py:441: error: Unused "type: ignore" comment [unused-ignore] - beartype/_util/cls/pep/clspep3119.py:549: error: Unused "type: ignore" comment [unused-ignore] - beartype/_util/cls/pep/clspep3119.py:612: error: Unused "type: ignore" comment [unused-ignore] - beartype/_util/cls/pep/clspep3119.py:911: error: Unused "type: ignore" comment [unused-ignore] - beartype/_cache/cls/cacheclsabc.py:98: error: Unused "type: ignore" comment [unused-ignore] - beartype/_util/hint/pep/proposal/pep585.py:378: error: Unused "type: ignore" comment [unused-ignore] - beartype/_util/hint/pep/proposal/pep749/pep649749annotate.py:438: error: Unused "type: ignore" comment [unused-ignore] - beartype/_util/hint/pep/proposal/pep749/pep649749annotate.py:518: error: Unused "type: ignore" comment [unused-ignore] - beartype/_util/hint/pep/proposal/pep749/pep649749annotate.py:916: error: Unused "type: ignore" comment [unused-ignore] - beartype/_util/func/arg/utilfuncargiter.py:404: error: Unused "type: ignore" comment [unused-ignore] - beartype/_util/func/arg/utilfuncargiter.py:419: error: Unused "type: ignore" comment [unused-ignore] - beartype/_util/func/arg/utilfuncargiter.py:424: error: Unused "type: ignore" comment [unused-ignore] - beartype/_check/pep/pep484/checkpep484typevar.py:178: error: Unused "type: ignore" comment [unused-ignore] - beartype/_check/convert/_reduce/_pep/pep484585/redpep484585itemsview.py:72: error: Unused "type: ignore" comment [unused-ignore] - beartype/_check/convert/_reduce/_pep/pep484585/redpep484585itemsview.py:82: error: Unused "type: ignore[assignment]" comment [unused-ignore] - beartype/_check/cls/hint/hintsane.py:529: error: Unused "type: ignore" comment [unused-ignore] - beartype/door/_cls/doormeta.py:138: error: Unused "type: ignore" comment [unused-ignore] - beartype/door/_cls/doormeta.py:204: error: Unused "type: ignore" comment [unused-ignore] - beartype/_util/hint/pep/proposal/pep484585/pep484585func.py:110: error: Unused "type: ignore" comment [unused-ignore] - beartype/_check/convert/_reduce/_redrecurse.py:230: error: Unused "type: ignore" comment [unused-ignore] - beartype/_check/convert/_reduce/_pep/redpep673.py:129: error: Unused "type: ignore" comment [unused-ignore] - beartype/_check/convert/_reduce/_pep/pep484585/redpep484585subclass.py:109: error: Unused "type: ignore" comment [unused-ignore] - beartype/_check/cls/call/calldatadecorfuncmin.py:86: error: Unused "type: ignore" comment [unused-ignore] - beartype/bite/collection/infercollectionitems.py:317: error: Unused "type: ignore" comment [unused-ignore] - beartype/bite/collection/infercollectionitems.py:500: error: Unused "type: ignore" comment [unused-ignore] - beartype/_util/hint/pep/utilpepget.py:453: error: Unused "type: ignore" comment [unused-ignore] - beartype/_util/hint/pep/utilpepget.py:1038: error: Unused "type: ignore" comment [unused-ignore] - beartype/_util/hint/pep/utilpepget.py:1173: error: Unused "type: ignore" comment [unused-ignore] - beartype/_util/func/utilfuncwrap.py:542: error: Unused "type: ignore" comment [unused-ignore] - beartype/_check/convert/_reduce/_nonpep/api/redapinumpy.py:129: error: Unused "type: ignore" comment [unused-ignore] - beartype/_check/convert/_reduce/_nonpep/api/redapinumpy.py:275: error: Unused "type: ignore" comment [unused-ignore] - beartype/_check/convert/_reduce/_nonpep/api/redapinumpy.py:325: error: Unused "type: ignore" comment [unused-ignore] - beartype/_util/hint/pep/proposal/pep484585/generic/pep484585genfind.py:504: error: Unused "type: ignore" comment [unused-ignore] - beartype/_util/hint/pep/proposal/pep484585/generic/pep484585genfind.py:612: error: Unused "type: ignore" comment [unused-ignore] - beartype/_util/hint/pep/proposal/pep484585/generic/pep484585genfind.py:789: error: Unused "type: ignore" comment [unused-ignore] - beartype/_util/hint/pep/proposal/pep484585/generic/pep484585genfind.py:964: error: Unused "type: ignore" comment [unused-ignore] - beartype/_util/hint/pep/proposal/pep484585/generic/pep484585genfind.py:1075: error: Unused "type: ignore" comment [unused-ignore] - beartype/_check/forward/reference/_cls/fwdrefcache.py:394: error: Unused "type: ignore" comment [unused-ignore] - beartype/_check/forward/reference/_cls/fwdrefcache.py:522: error: Unused "type: ignore" comment [unused-ignore] - beartype/vale/_is/_valeistype.py:122: error: Unused "type: ignore" comment [unused-ignore] - beartype/vale/_is/_valeistype.py:325: error: Unused "type: ignore" comment [unused-ignore] - beartype/vale/_is/_valeisoper.py:184: error: Unused "type: ignore" comment [unused-ignore] - beartype/vale/_is/_valeisobj.py:138: error: Unused "type: ignore" comment [unused-ignore] - beartype/vale/_is/_valeis.py:265: error: Unused "type: ignore" comment [unused-ignore] - beartype/_check/forward/reference/_cls/fwdrefmeta.py:83: error: Unused "type: ignore" comment [unused-ignore] - beartype/_check/forward/reference/_cls/fwdrefmeta.py:302: error: Unused "type: ignore" comment [unused-ignore] - beartype/_check/forward/reference/_cls/fwdrefmeta.py:381: error: Unused "type: ignore" comment [unused-ignore] - beartype/_check/forward/reference/_cls/fwdrefmeta.py:640: error: Unused "type: ignore" comment [unused-ignore] - beartype/_check/forward/reference/_cls/fwdrefmeta.py:684: error: Unused "type: ignore" comment [unused-ignore] - beartype/_check/forward/reference/_cls/fwdrefmeta.py:751: error: Unused "type: ignore" comment [unused-ignore] - beartype/_check/forward/reference/_cls/fwdrefmeta.py:792: error: Unused "type: ignore" comment [unused-ignore] - beartype/_util/hint/pep/proposal/pep695.py:565: error: Unused "type: ignore[union-attr]" comment [unused-ignore] - beartype/_util/hint/pep/proposal/pep695.py:692: error: Unused "type: ignore" comment [unused-ignore] - beartype/_check/convert/_reduce/_pep/pep484/redpep484ref.py:294: error: Unused "type: ignore" comment [unused-ignore] - beartype/_util/hint/pep/utilpepsign.py:589: error: Unused "type: ignore" comment [unused-ignore] - beartype/_util/hint/pep/proposal/pep612.py:90: error: Unused "type: ignore" comment [unused-ignore] - beartype/_util/hint/pep/proposal/pep612.py:96: error: Unused "type: ignore" comment [unused-ignore] - beartype/_util/hint/pep/proposal/pep612.py:167: error: Unused "type: ignore" comment [unused-ignore] - beartype/_util/hint/pep/proposal/pep612.py:227: error: Unused "type: ignore[attr-defined]" comment [unused-ignore] - beartype/_util/hint/pep/proposal/pep612.py:260: error: Unused "type: ignore[attr-defined]" comment [unused-ignore] - beartype/_check/pep/pep484585/checkpep484585subclass.py:128: error: Unused "type: ignore" comment [unused-ignore] - beartype/_check/pep/pep484585/checkpep484585subclass.py:139: error: Unused "type: ignore" comment [unused-ignore] - beartype/_check/convert/_reduce/_pep/pep646/redpep484612646typearg.py:220: error: Unused "type: ignore" comment [unused-ignore] - beartype/_check/convert/_reduce/_pep/pep646/redpep484612646typearg.py:643: error: Unused "type: ignore" comment [unused-ignore] - beartype/_check/convert/_reduce/_pep/pep646/redpep484612646typearg.py:1258: error: Unused "type: ignore" comment [unused-ignore] - beartype/_check/convert/_convcoerce.py:205: error: Unused "type: ignore" comment [unused-ignore] - beartype/_check/convert/_convcoerce.py:421: error: Unused "type: ignore" comment [unused-ignore] - beartype/bite/_infermain.py:268: error: Unused "type: ignore" comment [unused-ignore] - beartype/_check/cls/hint/tree/hinttreeerror.py:484: error: Unused "type: ignore" comment [unused-ignore] - beartype/_check/error/errmain.py:194: error: Unused "type: ignore" comment [unused-ignore] - beartype/_check/error/_nonpep/errnonpeptype.py:107: error: Unused "type: ignore" comment [unused-ignore] - beartype/_check/error/_nonpep/errnonpeptype.py:253: error: Unused "type: ignore" comment [unused-ignore] - beartype/_check/code/_pep/pep484585/codepep484585subclass.py:71: error: Unused "type: ignore" comment [unused-ignore] - beartype/_check/code/_pep/pep484/codepep484604union.py:197: error: Unused "type: ignore" comment [unused-ignore] - beartype/_check/code/codemain.py:737: error: Unused "type: ignore" comment [unused-ignore] - beartype/_check/code/codemain.py:854: error: Unused "type: ignore" comment [unused-ignore] - beartype/_check/make/checkmakefunc.py:626: error: Unused "type: ignore" comment [unused-ignore] - beartype/door/_cls/doorabc.py:717: error: Unused "type: ignore" comment [unused-ignore] - beartype/door/_cls/doorabc.py:1192: error: Unused "type: ignore" comment [unused-ignore] - beartype/door/_cls/doorabc.py:1210: error: Unused "type: ignore" comment [unused-ignore] - beartype/door/_cls/doorabc.py:1228: error: Unused "type: ignore" comment [unused-ignore] - beartype/door/_cls/doorabc.py:1250: error: Unused "type: ignore" comment [unused-ignore] - beartype/door/_cls/pep/doorpep586.py:79: error: Unused "type: ignore" comment [unused-ignore] - beartype/door/_cls/pep/doorpep586.py:92: error: Unused "type: ignore" comment [unused-ignore] - beartype/door/_cls/pep/doorpep484604.py:59: error: Unused "type: ignore" comment [unused-ignore] - beartype/door/_cls/pep/pep484585/doorpep484585callable.py:211: error: Unused "type: ignore" comment [unused-ignore] - beartype/door/_cls/pep/pep484/doorpep484newtype.py:65: error: Unused "type: ignore" comment [unused-ignore] ... (truncated 43 lines) ... sympy (https://github.com/sympy/sympy) + sympy/core/evalf.py:917: error: Unused "type: ignore" comment [unused-ignore] pandas (https://github.com/pandas-dev/pandas) + pandas/core/arrays/interval.py:694: error: Argument 1 to "ndim" has incompatible type "ndarray[Any, Any] | ExtensionArray"; expected "Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]" [arg-type] + pandas/core/reshape/merge.py:2968: error: Unused "type: ignore" comment [unused-ignore] + pandas/core/indexes/base.py:4434: error: Unused "type: ignore" comment [unused-ignore] + pandas/core/indexes/base.py:4454: error: Unused "type: ignore" comment [unused-ignore] boostedblob (https://github.com/hauntsaninja/boostedblob) + boostedblob/listing.py:403: error: Unused "type: ignore" comment [unused-ignore] + boostedblob/listing.py:412: error: Unused "type: ignore" comment [unused-ignore] poetry (https://github.com/python-poetry/poetry) + tests/helpers.py:269: error: Returning Any from function declared to return "EntryPoint" [no-any-return] ibis (https://github.com/ibis-project/ibis) - ibis/backends/datafusion/__init__.py:429: error: Item "str" of "str | Any" has no attribute "names" [union-attr] - ibis/backends/datafusion/__init__.py:432: error: Item "str" of "str | Any" has no attribute "table" [union-attr] jax (https://github.com/google/jax) - jax/_src/numpy/util.py:387: error: Argument 1 to "ndim" has incompatible type "int | float | complex | SupportsNdim"; expected "Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]" [arg-type] - jax/_src/third_party/scipy/betaln.py:63: error: Unsupported operand types for > ("int" and "complex") [operator] - jax/_src/third_party/scipy/betaln.py:63: note: Left operand is of type "Array | ndarray[tuple[Any, ...], dtype[Any]] | numpy.bool[builtins.bool] | number[Any, Any] | builtins.bool | int | float | complex" - jax/experimental/array_serialization/pytree_serialization.py:152: error: Item "str" of "str | PathLike[str]" has no attribute "exists" [union-attr] - jax/experimental/array_serialization/pytree_serialization.py:152: error: Item "PathLike[str]" of "str | PathLike[str]" has no attribute "exists" [union-attr] - jax/experimental/array_serialization/pytree_serialization.py:152: error: Item "str" of "str | PathLike[str]" has no attribute "iterdir" [union-attr] - jax/experimental/array_serialization/pytree_serialization.py:152: error: Item "PathLike[str]" of "str | PathLike[str]" has no attribute "iterdir" [union-attr] - jax/experimental/array_serialization/pytree_serialization.py:156: error: Item "str" of "str | PathLike[str]" has no attribute "iterdir" [union-attr] - jax/experimental/array_serialization/pytree_serialization.py:156: error: Item "PathLike[str]" of "str | PathLike[str]" has no attribute "iterdir" [union-attr] - jax/experimental/array_serialization/pytree_serialization.py:166: error: Item "str" of "str | PathLike[str]" has no attribute "exists" [union-attr] - jax/experimental/array_serialization/pytree_serialization.py:166: error: Item "PathLike[str]" of "str | PathLike[str]" has no attribute "exists" [union-attr] - jax/experimental/array_serialization/pytree_serialization.py:171: error: Item "str" of "str | PathLike[str]" has no attribute "exists" [union-attr] - jax/experimental/array_serialization/pytree_serialization.py:171: error: Item "PathLike[str]" of "str | PathLike[str]" has no attribute "exists" [union-attr] - jax/experimental/array_serialization/pytree_serialization.py:171: error: Item "str" of "str | PathLike[str]" has no attribute "iterdir" [union-attr] - jax/experimental/array_serialization/pytree_serialization.py:171: error: Item "PathLike[str]" of "str | PathLike[str]" has no attribute "iterdir" [union-attr] - jax/experimental/array_serialization/pytree_serialization.py:193: error: Item "str" of "str | PathLike[str]" has no attribute "mkdir" [union-attr] - jax/experimental/array_serialization/pytree_serialization.py:193: error: Item "PathLike[str]" of "str | PathLike[str]" has no attribute "mkdir" [union-attr] - jax/experimental/array_serialization/pytree_serialization.py:194: error: Item "str" of "str | PathLike[str]" has no attribute "exists" [union-attr] - jax/experimental/array_serialization/pytree_serialization.py:194: error: Item "PathLike[str]" of "str | PathLike[str]" has no attribute "exists" [union-attr] - jax/experimental/array_serialization/pytree_serialization.py:194: error: Item "str" of "str | PathLike[str]" has no attribute "is_dir" [union-attr] - jax/experimental/array_serialization/pytree_serialization.py:194: error: Item "PathLike[str]" of "str | PathLike[str]" has no attribute "is_dir" [union-attr] PyGithub (https://github.com/PyGithub/PyGithub) + github/PaginatedList.py:455: error: Unused "type: ignore" comment [unused-ignore] mkosi (https://github.com/systemd/mkosi) + mkosi/sandbox.py:570:5: error: Returning Any from function declared to return "int" [no-any-return] static-frame (https://github.com/static-frame/static-frame) + static_frame/core/index_datetime.py:150: error: Unused "type: ignore" comment [unused-ignore] + static_frame/core/index_hierarchy.py:1523: error: Returning Any from function declared to return "int" [no-any-return] + static_frame/core/index_hierarchy.py:2052: error: Returning Any from function declared to return "ndarray[Any, Any]" [no-any-return] apprise (https://github.com/caronc/apprise) - apprise/utils/pem.py:323: error: "None" has no attribute "public_bytes" [attr-defined] mongo-python-driver (https://github.com/mongodb/mongo-python-driver) + bson/code.py:74: error: Unused "type: ignore" comment [unused-ignore] + pymongo/synchronous/bulk.py:369: error: Argument 5 to "_BulkWriteContext" has incompatible type "_EventListeners | None"; expected "_EventListeners" [arg-type] + pymongo/synchronous/bulk.py:404: error: Argument 3 to "_execute_batch" of "_Bulk" has incompatible type "islice[Any]"; expected "list[Mapping[str, Any]]" [arg-type] + pymongo/synchronous/bulk.py:424: error: Argument 3 to "_execute_batch_unack" of "_Bulk" has incompatible type "islice[Any]"; expected "list[Mapping[str, Any]]" [arg-type] + pymongo/synchronous/bulk.py:501: error: Argument 5 to "_BulkWriteContext" has incompatible type "_EventListeners | None"; expected "_EventListeners" [arg-type] + pymongo/synchronous/bulk.py:516: error: Argument 3 to "_execute_batch_unack" of "_Bulk" has incompatible type "islice[Any]"; expected "list[Mapping[str, Any]]" [arg-type] + pymongo/asynchronous/bulk.py:369: error: Argument 5 to "_BulkWriteContext" has incompatible type "_EventListeners | None"; expected "_EventListeners" [arg-type] + pymongo/asynchronous/bulk.py:404: error: Argument 3 to "_execute_batch" of "_AsyncBulk" has incompatible type "islice[Any]"; expected "list[Mapping[str, Any]]" [arg-type] + pymongo/asynchronous/bulk.py:424: error: Argument 3 to "_execute_batch_unack" of "_AsyncBulk" has incompatible type "islice[Any]"; expected "list[Mapping[str, Any]]" [arg-type] + pymongo/asynchronous/bulk.py:503: error: Argument 5 to "_BulkWriteContext" has incompatible type "_EventListeners | None"; expected "_EventListeners" [arg-type] + pymongo/asynchronous/bulk.py:518: error: Argument 3 to "_execute_batch_unack" of "_AsyncBulk" has incompatible type "islice[Any]"; expected "list[Mapping[str, Any]]" [arg-type] |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Thanks for the ping @ilevkivskyi! I'm a bit preoccupied at the moment which is why I didn't see this earlier. In total this change results in 40 new error messages for Home Assistant, most are acceptable. One pattern I saw repeatedly which will now raise an error is: # mypy: warn_return_any from typing import Any def func() -> Any: ... def do_something() -> int: var: int var = func() reveal_type(var) return var I feel like if people go out of their way to annotate a variable beforehand, the type should stick and not be "overwritten" with Note that |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@cdce8p Note the key point here is that if |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
While that works for simple types, it doesn't fully for generic ones. For Home Assistant it's about 20% of cases and it might be similar for other projects. Errors are good if they are helpful. However here they will likely just lead to additional (unnecessary) type ignores. As another data point, pyright will still infer it as If you like to look at the examples yourself: cdce8p/ha-core@8cc2d31 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
I am not sure I follow: we only give the def async_get_devices_by_type( bootstrap: Bootstrap, device_type: ModelType ) -> dict[str, ProtectAdoptableDeviceModel]: """Get devices by type.""" devices: dict[str, ProtectAdoptableDeviceModel] devices = getattr(bootstrap, device_type.devices_key) return devices # type: ignore[no-any-return] should instead be written like this instead: def async_get_devices_by_type( bootstrap: Bootstrap, device_type: ModelType ) -> dict[str, ProtectAdoptableDeviceModel]: """Get devices by type.""" devices = getattr(bootstrap, device_type.devices_key) assert isinstance(devices, dict) return devices So I think all the examples in cdce8p/ha-core@8cc2d31 can be rewritten without We may need to update the docs on |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
I was thinking about something like this though I've to admit that I didn't check it before posting my comment. def do_something() -> list[str]: var = func() assert isinstance(var, list) reveal_type(var) # should be list[str] return var
--
Sure but that's usually not what happens. For typing asserts or casts it's sometimes also desired to guard them behind an |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
My point is exactly the opposite, writing a type twice doesn't make code any safer. While knowing a minimal set of places where |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
See discussion in #22050 for context.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.