Closed erictraut closed 1 month ago
Diff from mypy_primer, showing the effect of this PR on open source code:
xarray (https://github.com/pydata/xarray)
- /tmp/mypy_primer/projects/xarray/asv_bench/benchmarks/dataset_io.py:385:59 - error: Argument of type "dict[str, float]" cannot be assigned to parameter "chunks" of type "str | int | tuple[int, ...] | Mapping[Any, T_ChunkDim] | None" in function "open_mfdataset"
+ /tmp/mypy_primer/projects/xarray/asv_bench/benchmarks/dataset_io.py:385:59 - error: Argument of type "dict[str, float]" cannot be assigned to parameter "chunks" of type "T_Chunks" in function "open_mfdataset"
- Type "dict[str, float]" is incompatible with type "str | int | tuple[int, ...] | Mapping[Any, T_ChunkDim] | None"
+ Type "dict[str, float]" is incompatible with type "T_Chunks"
- /tmp/mypy_primer/projects/xarray/asv_bench/benchmarks/dataset_io.py:391:63 - error: Argument of type "dict[str, float]" cannot be assigned to parameter "chunks" of type "str | int | tuple[int, ...] | Mapping[Any, T_ChunkDim] | None" in function "open_mfdataset"
+ /tmp/mypy_primer/projects/xarray/asv_bench/benchmarks/dataset_io.py:391:63 - error: Argument of type "dict[str, float]" cannot be assigned to parameter "chunks" of type "T_Chunks" in function "open_mfdataset"
- Type "dict[str, float]" is incompatible with type "str | int | tuple[int, ...] | Mapping[Any, T_ChunkDim] | None"
+ Type "dict[str, float]" is incompatible with type "T_Chunks"
- /tmp/mypy_primer/projects/xarray/asv_bench/benchmarks/dataset_io.py:407:59 - error: Argument of type "dict[str, float]" cannot be assigned to parameter "chunks" of type "str | int | tuple[int, ...] | Mapping[Any, T_ChunkDim] | None" in function "open_mfdataset"
+ /tmp/mypy_primer/projects/xarray/asv_bench/benchmarks/dataset_io.py:407:59 - error: Argument of type "dict[str, float]" cannot be assigned to parameter "chunks" of type "T_Chunks" in function "open_mfdataset"
- Type "dict[str, float]" is incompatible with type "str | int | tuple[int, ...] | Mapping[Any, T_ChunkDim] | None"
+ Type "dict[str, float]" is incompatible with type "T_Chunks"
- /tmp/mypy_primer/projects/xarray/asv_bench/benchmarks/dataset_io.py:413:63 - error: Argument of type "dict[str, float]" cannot be assigned to parameter "chunks" of type "str | int | tuple[int, ...] | Mapping[Any, T_ChunkDim] | None" in function "open_mfdataset"
+ /tmp/mypy_primer/projects/xarray/asv_bench/benchmarks/dataset_io.py:413:63 - error: Argument of type "dict[str, float]" cannot be assigned to parameter "chunks" of type "T_Chunks" in function "open_mfdataset"
- Type "dict[str, float]" is incompatible with type "str | int | tuple[int, ...] | Mapping[Any, T_ChunkDim] | None"
+ Type "dict[str, float]" is incompatible with type "T_Chunks"
- /tmp/mypy_primer/projects/xarray/asv_bench/benchmarks/dataset_io.py:443:61 - error: Argument of type "dict[str, float]" cannot be assigned to parameter "chunks" of type "str | int | tuple[int, ...] | Mapping[Any, T_ChunkDim] | None" in function "open_mfdataset"
+ /tmp/mypy_primer/projects/xarray/asv_bench/benchmarks/dataset_io.py:443:61 - error: Argument of type "dict[str, float]" cannot be assigned to parameter "chunks" of type "T_Chunks" in function "open_mfdataset"
- Type "dict[str, float]" is incompatible with type "str | int | tuple[int, ...] | Mapping[Any, T_ChunkDim] | None"
+ Type "dict[str, float]" is incompatible with type "T_Chunks"
- /tmp/mypy_primer/projects/xarray/asv_bench/benchmarks/dataset_io.py:455:61 - error: Argument of type "dict[str, float]" cannot be assigned to parameter "chunks" of type "str | int | tuple[int, ...] | Mapping[Any, T_ChunkDim] | None" in function "open_mfdataset"
+ /tmp/mypy_primer/projects/xarray/asv_bench/benchmarks/dataset_io.py:455:61 - error: Argument of type "dict[str, float]" cannot be assigned to parameter "chunks" of type "T_Chunks" in function "open_mfdataset"
- Type "dict[str, float]" is incompatible with type "str | int | tuple[int, ...] | Mapping[Any, T_ChunkDim] | None"
+ Type "dict[str, float]" is incompatible with type "T_Chunks"
bokeh (https://github.com/bokeh/bokeh)
+ "Nullable[Any]" is incompatible with "None"
- "Nullable[Any]" is incompatible with "None" (reportArgumentType)
+ "Nullable[Any]" is incompatible with type "Auto" (reportArgumentType)
+ "Nullable[Any]" is incompatible with "None"
- "Nullable[Any]" is incompatible with "None" (reportArgumentType)
+ "Nullable[Any]" is incompatible with type "Auto" (reportArgumentType)
+ "Nullable[Any]" is incompatible with "None"
- "Nullable[Any]" is incompatible with "None" (reportArgumentType)
+ "Nullable[Any]" is incompatible with type "Auto" (reportArgumentType)
+ "Nullable[Any]" is incompatible with "None"
- "Nullable[Any]" is incompatible with "None" (reportArgumentType)
+ "Nullable[Any]" is incompatible with type "Auto" (reportArgumentType)
+ "Nullable[Any]" is incompatible with "None"
- "Nullable[Any]" is incompatible with "None" (reportArgumentType)
+ "Nullable[Any]" is incompatible with type "Auto" (reportArgumentType)
+ "Nullable[Any]" is incompatible with "None"
- "Nullable[Any]" is incompatible with "None" (reportArgumentType)
+ "Nullable[Any]" is incompatible with type "Auto" (reportArgumentType)
+ "Nullable[Any]" is incompatible with "None"
- "Nullable[Any]" is incompatible with "None" (reportArgumentType)
+ "Nullable[Any]" is incompatible with type "Auto" (reportArgumentType)
+ "Nullable[Any]" is incompatible with "None"
- "Nullable[Any]" is incompatible with "None" (reportArgumentType)
+ "Nullable[Any]" is incompatible with type "Auto" (reportArgumentType)
+ "Nullable[Any]" is incompatible with "None"
- "Nullable[Any]" is incompatible with "None" (reportArgumentType)
+ "Nullable[Any]" is incompatible with type "Auto" (reportArgumentType)
+ "Nullable[Any]" is incompatible with "None"
- "Nullable[Any]" is incompatible with "None" (reportArgumentType)
+ "Nullable[Any]" is incompatible with type "Auto" (reportArgumentType)
Tanjun (https://github.com/FasterSpeeding/Tanjun)
- Parameter type is "Unknown | str" (reportUnknownParameterType)
+ Parameter type is "Unknown | str | Literal['ok']" (reportUnknownParameterType)
- Type of "result" is "(event: Unknown | str) -> Coroutine[Any, Any, None]" (reportUnknownVariableType)
+ Type of "result" is "(event: Unknown | str | Literal['ok']) -> Coroutine[Any, Any, None]" (reportUnknownVariableType)
- Argument type is "(event: Unknown | str) -> Coroutine[Any, Any, None]" (reportUnknownArgumentType)
+ Argument type is "(event: Unknown | str | Literal['ok']) -> Coroutine[Any, Any, None]" (reportUnknownArgumentType)
- Parameter type is "Unknown | str" (reportUnknownParameterType)
+ Parameter type is "Unknown | str | Literal['ok']" (reportUnknownParameterType)
- Type of "result" is "(event: Unknown | str) -> Coroutine[Any, Any, None]" (reportUnknownVariableType)
+ Type of "result" is "(event: Unknown | str | Literal['ok']) -> Coroutine[Any, Any, None]" (reportUnknownVariableType)
- Argument type is "(event: Unknown | str) -> Coroutine[Any, Any, None]" (reportUnknownArgumentType)
+ Argument type is "(event: Unknown | str | Literal['ok']) -> Coroutine[Any, Any, None]" (reportUnknownArgumentType)
- Parameter type is "Unknown | str" (reportUnknownParameterType)
+ Parameter type is "Unknown | str | Literal['ok']" (reportUnknownParameterType)
- Type of "result" is "(event: Unknown | str) -> Coroutine[Any, Any, None]" (reportUnknownVariableType)
+ Type of "result" is "(event: Unknown | str | Literal['ok']) -> Coroutine[Any, Any, None]" (reportUnknownVariableType)
- Argument type is "(event: Unknown | str) -> Coroutine[Any, Any, None]" (reportUnknownArgumentType)
+ Argument type is "(event: Unknown | str | Literal['ok']) -> Coroutine[Any, Any, None]" (reportUnknownArgumentType)
- Parameter type is "Unknown | str" (reportUnknownParameterType)
+ Parameter type is "Unknown | str | Literal['ok']" (reportUnknownParameterType)
- Type of "result" is "(event: Unknown | str) -> Coroutine[Any, Any, None]" (reportUnknownVariableType)
+ Type of "result" is "(event: Unknown | str | Literal['ok']) -> Coroutine[Any, Any, None]" (reportUnknownVariableType)
- Argument type is "(event: Unknown | str) -> Coroutine[Any, Any, None]" (reportUnknownArgumentType)
+ Argument type is "(event: Unknown | str | Literal['ok']) -> Coroutine[Any, Any, None]" (reportUnknownArgumentType)
…literals in some cases. In particular, for type expressions that explicitly include literals along with their non-literal counterpart like
Literal[1] | int
. Retaining these redundant subtypes can be useful for language server features like completion suggestions. This addresses #8392.