Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix reportInvalidCast false positive when casting to/from None and type #579

Merged
merged 2 commits into from
Aug 15, 2024

Conversation

DetachHead
Copy link
Owner

fixes #568

@DetachHead DetachHead force-pushed the fix-overlapping-cast-none branch from 7dac706 to 223ebe0 Compare August 14, 2024 11:04

This comment has been minimized.

@jorenham
Copy link
Contributor

jorenham commented Aug 14, 2024

Does this also fix cast(type[Any], object()), cast(type[object], object()), cast(type[int], object()) etc?

@DetachHead
Copy link
Owner Author

it does now, good catch

@DetachHead DetachHead changed the title fix reportInvalidCast false positive when casting to/from None fix reportInvalidCast false positive when casting to/from None and type Aug 14, 2024
Copy link
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

sympy (https://github.com/sympy/sympy)
-     Type of "P" is "(condition: Unknown, given_condition: Unknown | None = None, numsamples: Unknown | None = None, evaluate: bool = True, **kwargs: Unknown) -> (Unknown | Any | BernoulliDistribution | Probability | Self@Expr | tuple[Unknown, ...] | Sum | Order | Piecewise | Basic | Equality | Relational | Unequality | Lambda | int | None)" (reportUnknownVariableType)
+     Type of "P" is "(condition: Unknown, given_condition: Unknown | None = None, numsamples: Unknown | None = None, evaluate: bool = True, **kwargs: Unknown) -> (Unknown | Any | BernoulliDistribution | Probability | tuple[Unknown, ...] | Sum | Order | Piecewise | Basic | Equality | Lambda | Relational | Unequality | int | None)" (reportUnknownVariableType)
-     Type of "E" is "(expr: Unknown, condition: Unknown | None = None, numsamples: Unknown | None = None, evaluate: bool = True, **kwargs: Unknown) -> (Unknown | Basic | Expectation | tuple[Unknown, ...] | Sum | Self@Expr | Order | Any | Piecewise | Equality | Relational | Unequality | Integral | ExpectationMatrix | None)" (reportUnknownVariableType)
+     Type of "E" is "(expr: Unknown, condition: Unknown | None = None, numsamples: Unknown | None = None, evaluate: bool = True, **kwargs: Unknown) -> (Unknown | Basic | Expectation | tuple[Unknown, ...] | Sum | Order | Any | Piecewise | Equality | Relational | Unequality | Integral | ExpectationMatrix | None)" (reportUnknownVariableType)
-     Type of "expectation" is "(expr: Unknown, var: Unknown, evaluate: bool = True, **kwargs: Unknown) -> (Any | Unknown | tuple[Unknown, ...] | Sum | Self@Expr | Order | Piecewise | Basic | Equality | Relational | Unequality | Literal[0] | None)" (reportUnknownMemberType)
+     Type of "expectation" is "(expr: Unknown, var: Unknown, evaluate: bool = True, **kwargs: Unknown) -> (Any | Unknown | tuple[Unknown, ...] | Sum | Order | Piecewise | Basic | Equality | Relational | Unequality | Literal[0] | None)" (reportUnknownMemberType)
-     Type of "expectation" is "(expr: Unknown, var: Unknown, evaluate: bool = True, **kwargs: Unknown) -> (Any | Unknown | tuple[Unknown, ...] | Sum | Self@Expr | Order | Piecewise | Basic | Equality | Relational | Unequality | Literal[0] | None)" (reportUnknownMemberType)
+     Type of "expectation" is "(expr: Unknown, var: Unknown, evaluate: bool = True, **kwargs: Unknown) -> (Any | Unknown | tuple[Unknown, ...] | Sum | Order | Piecewise | Basic | Equality | Relational | Unequality | Literal[0] | None)" (reportUnknownMemberType)
-   /tmp/mypy_primer/projects/sympy/sympy/stats/tests/test_discrete_rv.py:39:12 - error: Operator "-" not supported for types "Any | Unknown | tuple[Unknown, ...] | Sum | Self@Expr | Order | Piecewise | Basic | Equality | Relational | Unequality | Literal[0] | None" and "Any | Unknown | Expr | int"
+   /tmp/mypy_primer/projects/sympy/sympy/stats/tests/test_discrete_rv.py:39:12 - error: Operator "-" not supported for types "Any | Unknown | tuple[Unknown, ...] | Sum | Order | Piecewise | Basic | Equality | Relational | Unequality | Literal[0] | None" and "Any | Unknown | Expr | int"
-     Operator "-" not supported for types "Expr*" and "Expr"
-     Operator "-" not supported for types "Expr*" and "int"
+     Operator "-" not supported for types "None" and "Expr"
+     Operator "-" not supported for types "None" and "int"
-     Type of "expectation" is "(expr: Unknown, var: Unknown, evaluate: bool = True, **kwargs: Unknown) -> (Any | Unknown | tuple[Unknown, ...] | Sum | Self@Expr | Order | Piecewise | Basic | Equality | Relational | Unequality | Literal[0] | None)" (reportUnknownMemberType)
+     Type of "expectation" is "(expr: Unknown, var: Unknown, evaluate: bool = True, **kwargs: Unknown) -> (Any | Unknown | tuple[Unknown, ...] | Sum | Order | Piecewise | Basic | Equality | Relational | Unequality | Literal[0] | None)" (reportUnknownMemberType)
-   /tmp/mypy_primer/projects/sympy/sympy/stats/tests/test_discrete_rv.py:39:37 - error: Operator "**" not supported for types "Any | Unknown | tuple[Unknown, ...] | Sum | Self@Expr | Order | Piecewise | Basic | Equality | Relational | Unequality | Literal[0] | None" and "Literal[2]"
+   /tmp/mypy_primer/projects/sympy/sympy/stats/tests/test_discrete_rv.py:39:37 - error: Operator "**" not supported for types "Any | Unknown | tuple[Unknown, ...] | Sum | Order | Piecewise | Basic | Equality | Relational | Unequality | Literal[0] | None" and "Literal[2]"
-     Type of "expectation" is "(expr: Unknown, var: Unknown, evaluate: bool = True, **kwargs: Unknown) -> (Any | Unknown | tuple[Unknown, ...] | Sum | Self@Expr | Order | Piecewise | Basic | Equality | Relational | Unequality | Literal[0] | None)" (reportUnknownMemberType)
+     Type of "expectation" is "(expr: Unknown, var: Unknown, evaluate: bool = True, **kwargs: Unknown) -> (Any | Unknown | tuple[Unknown, ...] | Sum | Order | Piecewise | Basic | Equality | Relational | Unequality | Literal[0] | None)" (reportUnknownMemberType)
-     Type of "expectation" is "(expr: Unknown, var: Unknown, evaluate: bool = True, **kwargs: Unknown) -> (Any | Unknown | tuple[Unknown, ...] | Sum | Self@Expr | Order | Piecewise | Basic | Equality | Relational | Unequality | Literal[0] | None)" (reportUnknownMemberType)
+     Type of "expectation" is "(expr: Unknown, var: Unknown, evaluate: bool = True, **kwargs: Unknown) -> (Any | Unknown | tuple[Unknown, ...] | Sum | Order | Piecewise | Basic | Equality | Relational | Unequality | Literal[0] | None)" (reportUnknownMemberType)
-   /tmp/mypy_primer/projects/sympy/sympy/stats/tests/test_discrete_rv.py:69:12 - error: Operator "-" not supported for types "Any | Unknown | tuple[Unknown, ...] | Sum | Self@Expr | Order | Piecewise | Basic | Equality | Relational | Unequality | Literal[0] | None" and "Any | Unknown | Expr | int"
+   /tmp/mypy_primer/projects/sympy/sympy/stats/tests/test_discrete_rv.py:69:12 - error: Operator "-" not supported for types "Any | Unknown | tuple[Unknown, ...] | Sum | Order | Piecewise | Basic | Equality | Relational | Unequality | Literal[0] | None" and "Any | Unknown | Expr | int"
-     Operator "-" not supported for types "Expr*" and "Expr"
-     Operator "-" not supported for types "Expr*" and "int"
+     Operator "-" not supported for types "None" and "Expr"
+     Operator "-" not supported for types "None" and "int"
-     Type of "expectation" is "(expr: Unknown, var: Unknown, evaluate: bool = True, **kwargs: Unknown) -> (Any | Unknown | tuple[Unknown, ...] | Sum | Self@Expr | Order | Piecewise | Basic | Equality | Relational | Unequality | Literal[0] | None)" (reportUnknownMemberType)
+     Type of "expectation" is "(expr: Unknown, var: Unknown, evaluate: bool = True, **kwargs: Unknown) -> (Any | Unknown | tuple[Unknown, ...] | Sum | Order | Piecewise | Basic | Equality | Relational | Unequality | Literal[0] | None)" (reportUnknownMemberType)
-   /tmp/mypy_primer/projects/sympy/sympy/stats/tests/test_discrete_rv.py:69:37 - error: Operator "**" not supported for types "Any | Unknown | tuple[Unknown, ...] | Sum | Self@Expr | Order | Piecewise | Basic | Equality | Relational | Unequality | Literal[0] | None" and "Literal[2]"
+   /tmp/mypy_primer/projects/sympy/sympy/stats/tests/test_discrete_rv.py:69:37 - error: Operator "**" not supported for types "Any | Unknown | tuple[Unknown, ...] | Sum | Order | Piecewise | Basic | Equality | Relational | Unequality | Literal[0] | None" and "Literal[2]"
-     Type of "rewrite" is "Unknown | Any | ((..., deep: bool = True) -> (BernoulliDistribution | Any)) | ((..., deep: bool = True) -> (Probability | Any)) | ((..., deep: bool = True) -> (Self@Expr | Any)) | ((..., deep: bool = True) -> (Sum | Any)) | ((..., deep: bool = True) -> (Order | Any)) | ((..., deep: bool = True) -> (Piecewise | Any)) | ((..., deep: bool = True) -> (Basic | Any)) | ((..., deep: bool = True) -> (Equality | Any)) | ((..., deep: bool = True) -> (Relational | Any)) | ((..., deep: bool = True) -> (Unequality | Any)) | ((..., deep: bool = True) -> (Lambda | Any))" (reportUnknownMemberType)
+     Type of "rewrite" is "Unknown | Any | ((..., deep: bool = True) -> (BernoulliDistribution | Any)) | ((..., deep: bool = True) -> (Probability | Any)) | ((..., deep: bool = True) -> (Sum | Any)) | ((..., deep: bool = True) -> (Order | Any)) | ((..., deep: bool = True) -> (Piecewise | Any)) | ((..., deep: bool = True) -> (Basic | Any)) | ((..., deep: bool = True) -> (Equality | Any)) | ((..., deep: bool = True) -> (Lambda | Any)) | ((..., deep: bool = True) -> (Relational | Any)) | ((..., deep: bool = True) -> (Unequality | Any))" (reportUnknownMemberType)
-     Argument type is "BernoulliDistribution | Any | Probability | Self@Expr | Sum | Order | Piecewise | Basic | Equality | Relational | Unequality | Lambda | Unknown" (reportUnknownArgumentType)
+     Argument type is "BernoulliDistribution | Any | Probability | Sum | Order | Piecewise | Basic | Equality | Lambda | Relational | Unequality | Unknown" (reportUnknownArgumentType)
-     Type of "rewrite" is "Unknown | Any | ((..., deep: bool = True) -> (BernoulliDistribution | Any)) | ((..., deep: bool = True) -> (Probability | Any)) | ((..., deep: bool = True) -> (Self@Expr | Any)) | ((..., deep: bool = True) -> (Sum | Any)) | ((..., deep: bool = True) -> (Order | Any)) | ((..., deep: bool = True) -> (Piecewise | Any)) | ((..., deep: bool = True) -> (Basic | Any)) | ((..., deep: bool = True) -> (Equality | Any)) | ((..., deep: bool = True) -> (Relational | Any)) | ((..., deep: bool = True) -> (Unequality | Any)) | ((..., deep: bool = True) -> (Lambda | Any))" (reportUnknownMemberType)

... (truncated 758 lines) ...

bidict (https://github.com/jab/bidict)
-   /tmp/mypy_primer/projects/bidict/bidict/_base.py:142:16 - error: Conversion of type `type[_]` to type `type[BT@_make_inv_cls]` may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to `object` first. (reportInvalidCast)
- 593 errors, 0 warnings, 0 notes
+ 592 errors, 0 warnings, 0 notes

pandera (https://github.com/pandera-dev/pandera)
-   /tmp/mypy_primer/projects/pandera/pandera/api/dataframe/model.py:183:20 - error: Conversion of type `type[DataFrameModel[Unknown, Unknown]]` to type `type[TDataFrameModel@__class_getitem__]` may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to `object` first. (reportInvalidCast)
-   /tmp/mypy_primer/projects/pandera/pandera/api/pyspark/model.py:192:20 - error: Conversion of type `type[DataFrameModel]` to type `type[TDataFrameModel@__class_getitem__]` may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to `object` first. (reportInvalidCast)
- 31743 errors, 0 warnings, 0 notes
+ 31741 errors, 0 warnings, 0 notes

pip (https://github.com/pypa/pip)
-   /tmp/mypy_primer/projects/pip/src/pip/_vendor/rich/_win32_console.py:121:5 - error: Conversion of type `type[WindowsCoordinates]` to type `type[_COORD]` may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to `object` first. (reportInvalidCast)
-   /tmp/mypy_primer/projects/pip/src/pip/_vendor/rich/_win32_console.py:162:5 - error: Conversion of type `type[WindowsCoordinates]` to type `type[_COORD]` may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to `object` first. (reportInvalidCast)
-   /tmp/mypy_primer/projects/pip/src/pip/_vendor/rich/_win32_console.py:246:5 - error: Conversion of type `type[WindowsCoordinates]` to type `type[_COORD]` may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to `object` first. (reportInvalidCast)
- 37894 errors, 0 warnings, 0 notes
+ 37891 errors, 0 warnings, 0 notes

pydantic (https://github.com/pydantic/pydantic)
-   /tmp/mypy_primer/projects/pydantic/pydantic/main.py:1511:21 - error: Conversion of type `type[BaseModel]` to type `type[ModelT@create_model]` may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to `object` first. (reportInvalidCast)
- 6037 errors, 0 warnings, 0 notes
+ 6036 errors, 0 warnings, 0 notes

scrapy (https://github.com/scrapy/scrapy)
-   /tmp/mypy_primer/projects/scrapy/scrapy/crawler.py:342:24 - error: Conversion of type `str | type[Spider]` to type `type[Spider]` may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to `object` first. (reportInvalidCast)
-   /tmp/mypy_primer/projects/scrapy/scrapy/crawler.py:426:13 - error: Conversion of type `type[Spider] | str` to type `type[Spider]` may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to `object` first. (reportInvalidCast)
-   /tmp/mypy_primer/projects/scrapy/scrapy/pipelines/files.py:489:39 - error: Conversion of type `type[FilesStoreProtocol]` to type `type[S3FilesStore]` may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to `object` first. (reportInvalidCast)
-   /tmp/mypy_primer/projects/scrapy/scrapy/pipelines/files.py:499:42 - error: Conversion of type `type[FilesStoreProtocol]` to type `type[GCSFilesStore]` may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to `object` first. (reportInvalidCast)
-   /tmp/mypy_primer/projects/scrapy/scrapy/pipelines/files.py:505:42 - error: Conversion of type `type[FilesStoreProtocol]` to type `type[FTPFilesStore]` may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to `object` first. (reportInvalidCast)
-   /tmp/mypy_primer/projects/scrapy/scrapy/pipelines/images.py:138:39 - error: Conversion of type `type[FilesStoreProtocol]` to type `type[S3FilesStore]` may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to `object` first. (reportInvalidCast)
-   /tmp/mypy_primer/projects/scrapy/scrapy/pipelines/images.py:148:42 - error: Conversion of type `type[FilesStoreProtocol]` to type `type[GCSFilesStore]` may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to `object` first. (reportInvalidCast)
-   /tmp/mypy_primer/projects/scrapy/scrapy/pipelines/images.py:154:42 - error: Conversion of type `type[FilesStoreProtocol]` to type `type[FTPFilesStore]` may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to `object` first. (reportInvalidCast)
- 27906 errors, 0 warnings, 0 notes
+ 27898 errors, 0 warnings, 0 notes

xarray (https://github.com/pydata/xarray)
-   /tmp/mypy_primer/projects/xarray/xarray/namedarray/core.py:152:16 - error: Conversion of type `type[NamedArray[Any, _DType_co@_new]]` to type `type[NamedArray[_ShapeType@_new, _DType@_new]]` may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to `object` first. (reportInvalidCast)
-   /tmp/mypy_primer/projects/xarray/xarray/tests/test_namedarray.py:432:24 - error: Conversion of type `type[Self@Variable[_ShapeType_co@Variable, _DType_co@Variable]]` to type `type[Variable[Any, _DType@_new]]` may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to `object` first. (reportInvalidCast)
-   /tmp/mypy_primer/projects/xarray/xarray/tests/test_namedarray.py:493:24 - error: Conversion of type `type[Self@Variable[_ShapeType_co@Variable, _DType_co@Variable]]` to type `type[Variable[Any, _DType@_new]]` may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to `object` first. (reportInvalidCast)
- 77234 errors, 0 warnings, 0 notes
+ 77231 errors, 0 warnings, 0 notes

rich (https://github.com/Textualize/rich)
-   /tmp/mypy_primer/projects/rich/rich/_win32_console.py:121:5 - error: Conversion of type `type[WindowsCoordinates]` to type `type[_COORD]` may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to `object` first. (reportInvalidCast)
-   /tmp/mypy_primer/projects/rich/rich/_win32_console.py:162:5 - error: Conversion of type `type[WindowsCoordinates]` to type `type[_COORD]` may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to `object` first. (reportInvalidCast)
-   /tmp/mypy_primer/projects/rich/rich/_win32_console.py:246:5 - error: Conversion of type `type[WindowsCoordinates]` to type `type[_COORD]` may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to `object` first. (reportInvalidCast)
- 4206 errors, 0 warnings, 0 notes
+ 4203 errors, 0 warnings, 0 notes

pytest (https://github.com/pytest-dev/pytest)
-   /tmp/mypy_primer/projects/pytest/src/_pytest/config/__init__.py:1970:12 - error: Conversion of type `type[Warning]` to type `type[Warning]` may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to `object` first. (reportInvalidCast)
- 17337 errors, 0 warnings, 0 notes
+ 17336 errors, 0 warnings, 0 notes

werkzeug (https://github.com/pallets/werkzeug)
-   /tmp/mypy_primer/projects/werkzeug/src/werkzeug/formparser.py:189:19 - error: Conversion of type `type[MultiDict[Unknown, Unknown]]` to type `type[MultiDict[str, Any]]` may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to `object` first. (reportInvalidCast)
-   /tmp/mypy_primer/projects/werkzeug/src/werkzeug/formparser.py:314:19 - error: Conversion of type `type[MultiDict[Unknown, Unknown]]` to type `type[MultiDict[str, Any]]` may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to `object` first. (reportInvalidCast)
-   /tmp/mypy_primer/projects/werkzeug/src/werkzeug/http.py:581:15 - error: Conversion of type `type[Accept]` to type `type[_TAnyAccept@parse_accept_header]` may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to `object` first. (reportInvalidCast)
-   /tmp/mypy_primer/projects/werkzeug/src/werkzeug/http.py:656:15 - error: Conversion of type `type[RequestCacheControl]` to type `type[_TAnyCC@parse_cache_control_header]` may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to `object` first. (reportInvalidCast)
-   /tmp/mypy_primer/projects/werkzeug/src/werkzeug/http.py:700:15 - error: Conversion of type `type[ContentSecurityPolicy]` to type `type[_TAnyCSP@parse_csp_header]` may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to `object` first. (reportInvalidCast)
-   /tmp/mypy_primer/projects/werkzeug/src/werkzeug/test.py:821:33 - error: Conversion of type `type[TestResponse] | type[WrapperTestResponse] | None` to type `type[TestResponse]` may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to `object` first. (reportInvalidCast)
-   /tmp/mypy_primer/projects/werkzeug/src/werkzeug/sansio/http.py:144:15 - error: Conversion of type `type[MultiDict[Unknown, Unknown]]` to type `type[MultiDict[str, str]]` may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to `object` first. (reportInvalidCast)
- 3353 errors, 0 warnings, 0 notes
+ 3346 errors, 0 warnings, 0 notes

schemathesis (https://github.com/schemathesis/schemathesis)
-   /tmp/mypy_primer/projects/schemathesis/src/schemathesis/models.py:308:19 - error: Conversion of type `type[Serializer] | None` to type `type[Serializer]` may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to `object` first. (reportInvalidCast)
- 7784 errors, 0 warnings, 0 notes
+ 7783 errors, 0 warnings, 0 notes

spark (https://github.com/apache/spark)
-   /tmp/mypy_primer/projects/spark/python/pyspark/ml/pipeline.py:250:33 - error: Conversion of type `type[Pipeline]` to type `type[JavaMLReadable[Pipeline]]` may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to `object` first. (reportInvalidCast)
-   /tmp/mypy_primer/projects/spark/python/pyspark/ml/pipeline.py:287:33 - error: Conversion of type `type[PipelineModel]` to type `type[JavaMLReadable[PipelineModel]]` may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to `object` first. (reportInvalidCast)
-   /tmp/mypy_primer/projects/spark/python/pyspark/pandas/namespace.py:2230:22 - error: Conversion of type `type[DecimalType] | type[StringType] | type[DateType] | type[ByteType] | type[ShortType] | type[IntegerType] | type[LongType] | type[FloatType] | type[DoubleType] | type[BooleanType] | type[TimestampType] | type[TimestampNTZType]` to type `type[DataType]` may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to `object` first. (reportInvalidCast)
- 151411 errors, 0 warnings, 0 notes
+ 151408 errors, 0 warnings, 0 notes

zulip (https://github.com/zulip/zulip)
-   /tmp/mypy_primer/projects/zulip/corporate/tests/test_stripe.py:6541:31 - error: Conversion of type `type[RemoteRealmAuditLog] | type[RemoteZulipServerAuditLog]` to type `type[RemoteRealmAuditLog] | type[RemoteZulipServerAuditLog]` may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to `object` first. (reportInvalidCast)
-   /tmp/mypy_primer/projects/zulip/zerver/tests/test_typed_endpoint.py:46:37 - error: Conversion of type `UnionType` to type `type[str] | type[None]` may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to `object` first. (reportInvalidCast)
- 116984 errors, 0 warnings, 0 notes
+ 116982 errors, 0 warnings, 0 notes

psycopg (https://github.com/psycopg/psycopg)
-   /tmp/mypy_primer/projects/psycopg/psycopg/psycopg/types/enum.py:145:16 - error: Conversion of type `Enum` to type `type[E@register_enum]` may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to `object` first. (reportInvalidCast)
- 39145 errors, 0 warnings, 0 notes
+ 39144 errors, 0 warnings, 0 notes

mkosi (https://github.com/systemd/mkosi)
-   /tmp/mypy_primer/projects/mkosi/mkosi/distributions/__init__.py:161:16 - error: Conversion of type `type[DistributionInstaller]` to type `type[DistributionInstaller]` may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to `object` first. (reportInvalidCast)
- 1454 errors, 0 warnings, 0 notes
+ 1453 errors, 0 warnings, 0 notes

hydra-zen (https://github.com/mit-ll-responsible-ai/hydra-zen)
-   /tmp/mypy_primer/projects/hydra-zen/src/hydra_zen/wrapper/_implementations.py:960:16 - error: Conversion of type `type[BuildsWithSig[Any, ...]]` to type `type[DataClass_]` may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to `object` first. (reportInvalidCast)
- 2584 errors, 0 warnings, 183 notes
+ 2583 errors, 0 warnings, 183 notes

prefect (https://github.com/PrefectHQ/prefect)
-   /tmp/mypy_primer/projects/prefect/src/prefect/input/run_input.py:393:20 - error: Conversion of type `type[RunInput]*` to type `type[R@run_input_subclass_from_type]` may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to `object` first. (reportInvalidCast)
-   /tmp/mypy_primer/projects/prefect/src/prefect/input/run_input.py:395:20 - error: Conversion of type `type[RunInput]*` to type `type[R@run_input_subclass_from_type]` may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to `object` first. (reportInvalidCast)
-   /tmp/mypy_primer/projects/prefect/src/prefect/input/run_input.py:400:12 - error: Conversion of type `type[AutomaticRunInput[Unknown]]` to type `type[AutomaticRunInput[T@run_input_subclass_from_type]]` may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to `object` first. (reportInvalidCast)
-   /tmp/mypy_primer/projects/prefect/src/prefect/utilities/collections.py:92:11 - error: Conversion of type `type[Dict[KT@dict_to_flatdict, Any | Dict[KT@dict_to_flatdict, Any]]]` to type `type[Dict[Tuple[KT@dict_to_flatdict, ...], Any]]` may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to `object` first. (reportInvalidCast)
- 83426 errors, 0 warnings, 0 notes
+ 83422 errors, 0 warnings, 0 notes

@DetachHead DetachHead merged commit 7b616d6 into main Aug 15, 2024
19 checks passed
@DetachHead DetachHead deleted the fix-overlapping-cast-none branch August 15, 2024 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

reportInvalidCast for cast(None, object()): "convert the expression to object first"
3 participants