Repository navigation
Conversation
When a type alias in a Union resolves to another Union with members that already appear in the outer Union (for example, ``TextInput | ImageInput`` where ``TextInput = str`` and ``ImageInput = str | None``), the error message rendered as ``str | str | None``. The dedup pass in ``ignore_last_known_values`` only compared Instance items against each other and left anything wrapped in a TypeAliasType in place, so the nested ``str`` from ``ImageInput`` slipped past it. Flatten the input list with ``flatten_nested_unions`` first, keeping recursive aliases intact (otherwise ``get_proper_type`` recurses forever), and look at the proper type of each item when deciding whether it is an Instance to deduplicate. Non-Instance items are preserved as before. Fixes python#22194
Contributor
|
Diff from mypy_primer, showing the effect of this PR on open source code: spark (https://github.com/apache/spark)
- python/pyspark/sql/pandas/types.py:1060: note: def astype(self, dtype: type[builtins.bool] | Literal['bool'] | BooleanDtype | Literal['boolean'] | Literal['?', 'b1', 'bool_'] | type[numpy.bool[builtins.bool]] | Literal['bool[pyarrow]', 'boolean[pyarrow]'], errors: Literal['ignore', 'raise'] = ...) -> Series[bool]
+ python/pyspark/sql/pandas/types.py:1060: note: def astype(self, dtype: Literal['bool', 'boolean', '?', 'b1', 'bool_', 'bool[pyarrow]', 'boolean[pyarrow]'] | type[builtins.bool] | BooleanDtype | type[numpy.bool[builtins.bool]], errors: Literal['ignore', 'raise'] = ...) -> Series[bool]
- python/pyspark/sql/pandas/types.py:1060: note: def astype(self, dtype: type[str] | Literal['str'] | StringDtype[None] | Literal['string'] | StringDtype[Literal['python']] | Literal['string[python]'] | Literal['U', 'str_', 'unicode'] | type[str_] | StringDtype[Literal['pyarrow']] | Literal['string[pyarrow]'], errors: Literal['ignore', 'raise'] = ...) -> Series[str]
- python/pyspark/sql/pandas/types.py:1060: note: def astype(self, dtype: type[bytes] | Literal['bytes'] | Literal['S', 'bytes_'] | type[bytes_] | Literal['binary[pyarrow]'], errors: Literal['ignore', 'raise'] = ...) -> Series[bytes]
- python/pyspark/sql/pandas/types.py:1060: note: def astype(self, dtype: type[float] | Literal['float'] | Literal['Float32', 'Float64'] | Float32Dtype | Float64Dtype | Literal['e', 'f2', '<f2', 'float16', 'half'] | type[floating[_16Bit]] | Literal['f', 'f4', 'float32', 'single', 'd', 'f8', 'float64', 'double', 'g', 'f16', 'float128', 'longdouble'] | type[floating[_32Bit]] | type[float64] | type[floating[_64Bit | _96Bit | _128Bit]] | Literal['float[pyarrow]', 'double[pyarrow]', 'float16[pyarrow]', 'float32[pyarrow]', 'float64[pyarrow]'], errors: Literal['ignore', 'raise'] = ...) -> Series[float]
+ python/pyspark/sql/pandas/types.py:1060: note: def astype(self, dtype: Literal['str', 'string', 'string[python]', 'U', 'str_', 'unicode', 'string[pyarrow]'] | type[str] | StringDtype[None] | StringDtype[Literal['python']] | type[str_] | StringDtype[Literal['pyarrow']], errors: Literal['ignore', 'raise'] = ...) -> Series[str]
+ python/pyspark/sql/pandas/types.py:1060: note: def astype(self, dtype: Literal['bytes', 'S', 'bytes_', 'binary[pyarrow]'] | type[bytes] | type[bytes_], errors: Literal['ignore', 'raise'] = ...) -> Series[bytes]
+ python/pyspark/sql/pandas/types.py:1060: note: def astype(self, dtype: Literal['float', 'Float32', 'Float64', 'e', 'f2', '<f2', 'float16', 'half', 'f', 'f4', 'float32', 'single', 'd', 'f8', 'float64', 'double', 'g', 'f16', 'float128', 'longdouble', 'float[pyarrow]', 'double[pyarrow]', 'float16[pyarrow]', 'float32[pyarrow]', 'float64[pyarrow]'] | type[float] | Float32Dtype | Float64Dtype | type[floating[_16Bit]] | type[floating[_32Bit]] | type[float64] | type[floating[_64Bit | _96Bit | _128Bit]], errors: Literal['ignore', 'raise'] = ...) -> Series[float]
- python/pyspark/sql/pandas/types.py:1060: note: def astype(self, dtype: type[complex] | Literal['complex'] | Literal['F', 'c8', 'complex64', 'csingle', 'D', 'c16', 'complex128', 'cdouble', 'G', 'c32', 'complex256', 'clongdouble'] | type[complexfloating[_32Bit, _32Bit]] | type[complex128] | type[complexfloating[_64Bit | _96Bit | _128Bit, _64Bit | _96Bit | _128Bit]], errors: Literal['ignore', 'raise'] = ...) -> Series[complex]
+ python/pyspark/sql/pandas/types.py:1060: note: def astype(self, dtype: Literal['complex', 'F', 'c8', 'complex64', 'csingle', 'D', 'c16', 'complex128', 'cdouble', 'G', 'c32', 'complex256', 'clongdouble'] | type[complex] | type[complexfloating[_32Bit, _32Bit]] | type[complex128] | type[complexfloating[_64Bit | _96Bit | _128Bit, _64Bit | _96Bit | _128Bit]], errors: Literal['ignore', 'raise'] = ...) -> Series[complex]
- python/pyspark/sql/pandas/types.py:1062: note: def astype(self, dtype: type[builtins.bool] | Literal['bool'] | BooleanDtype | Literal['boolean'] | Literal['?', 'b1', 'bool_'] | type[numpy.bool[builtins.bool]] | Literal['bool[pyarrow]', 'boolean[pyarrow]'], errors: Literal['ignore', 'raise'] = ...) -> Series[bool]
+ python/pyspark/sql/pandas/types.py:1062: note: def astype(self, dtype: Literal['bool', 'boolean', '?', 'b1', 'bool_', 'bool[pyarrow]', 'boolean[pyarrow]'] | type[builtins.bool] | BooleanDtype | type[numpy.bool[builtins.bool]], errors: Literal['ignore', 'raise'] = ...) -> Series[bool]
- python/pyspark/sql/pandas/types.py:1062: note: def astype(self, dtype: type[str] | Literal['str'] | StringDtype[None] | Literal['string'] | StringDtype[Literal['python']] | Literal['string[python]'] | Literal['U', 'str_', 'unicode'] | type[str_] | StringDtype[Literal['pyarrow']] | Literal['string[pyarrow]'], errors: Literal['ignore', 'raise'] = ...) -> Series[str]
- python/pyspark/sql/pandas/types.py:1062: note: def astype(self, dtype: type[bytes] | Literal['bytes'] | Literal['S', 'bytes_'] | type[bytes_] | Literal['binary[pyarrow]'], errors: Literal['ignore', 'raise'] = ...) -> Series[bytes]
- python/pyspark/sql/pandas/types.py:1062: note: def astype(self, dtype: type[float] | Literal['float'] | Literal['Float32', 'Float64'] | Float32Dtype | Float64Dtype | Literal['e', 'f2', '<f2', 'float16', 'half'] | type[floating[_16Bit]] | Literal['f', 'f4', 'float32', 'single', 'd', 'f8', 'float64', 'double', 'g', 'f16', 'float128', 'longdouble'] | type[floating[_32Bit]] | type[float64] | type[floating[_64Bit | _96Bit | _128Bit]] | Literal['float[pyarrow]', 'double[pyarrow]', 'float16[pyarrow]', 'float32[pyarrow]', 'float64[pyarrow]'], errors: Literal['ignore', 'raise'] = ...) -> Series[float]
+ python/pyspark/sql/pandas/types.py:1062: note: def astype(self, dtype: Literal['str', 'string', 'string[python]', 'U', 'str_', 'unicode', 'string[pyarrow]'] | type[str] | StringDtype[None] | StringDtype[Literal['python']] | type[str_] | StringDtype[Literal['pyarrow']], errors: Literal['ignore', 'raise'] = ...) -> Series[str]
+ python/pyspark/sql/pandas/types.py:1062: note: def astype(self, dtype: Literal['bytes', 'S', 'bytes_', 'binary[pyarrow]'] | type[bytes] | type[bytes_], errors: Literal['ignore', 'raise'] = ...) -> Series[bytes]
+ python/pyspark/sql/pandas/types.py:1062: note: def astype(self, dtype: Literal['float', 'Float32', 'Float64', 'e', 'f2', '<f2', 'float16', 'half', 'f', 'f4', 'float32', 'single', 'd', 'f8', 'float64', 'double', 'g', 'f16', 'float128', 'longdouble', 'float[pyarrow]', 'double[pyarrow]', 'float16[pyarrow]', 'float32[pyarrow]', 'float64[pyarrow]'] | type[float] | Float32Dtype | Float64Dtype | type[floating[_16Bit]] | type[floating[_32Bit]] | type[float64] | type[floating[_64Bit | _96Bit | _128Bit]], errors: Literal['ignore', 'raise'] = ...) -> Series[float]
- python/pyspark/sql/pandas/types.py:1062: note: def astype(self, dtype: type[complex] | Literal['complex'] | Literal['F', 'c8', 'complex64', 'csingle', 'D', 'c16', 'complex128', 'cdouble', 'G', 'c32', 'complex256', 'clongdouble'] | type[complexfloating[_32Bit, _32Bit]] | type[complex128] | type[complexfloating[_64Bit | _96Bit | _128Bit, _64Bit | _96Bit | _128Bit]], errors: Literal['ignore', 'raise'] = ...) -> Series[complex]
+ python/pyspark/sql/pandas/types.py:1062: note: def astype(self, dtype: Literal['complex', 'F', 'c8', 'complex64', 'csingle', 'D', 'c16', 'complex128', 'cdouble', 'G', 'c32', 'complex256', 'clongdouble'] | type[complex] | type[complexfloating[_32Bit, _32Bit]] | type[complex128] | type[complexfloating[_64Bit | _96Bit | _128Bit, _64Bit | _96Bit | _128Bit]], errors: Literal['ignore', 'raise'] = ...) -> Series[complex]
- python/pyspark/sql/pandas/types.py:1068: note: def astype(self, dtype: type[builtins.bool] | Literal['bool'] | BooleanDtype | Literal['boolean'] | Literal['?', 'b1', 'bool_'] | type[numpy.bool[builtins.bool]] | Literal['bool[pyarrow]', 'boolean[pyarrow]'], errors: Literal['ignore', 'raise'] = ...) -> Series[bool]
+ python/pyspark/sql/pandas/types.py:1068: note: def astype(self, dtype: Literal['bool', 'boolean', '?', 'b1', 'bool_', 'bool[pyarrow]', 'boolean[pyarrow]'] | type[builtins.bool] | BooleanDtype | type[numpy.bool[builtins.bool]], errors: Literal['ignore', 'raise'] = ...) -> Series[bool]
- python/pyspark/sql/pandas/types.py:1068: note: def astype(self, dtype: type[str] | Literal['str'] | StringDtype[None] | Literal['string'] | StringDtype[Literal['python']] | Literal['string[python]'] | Literal['U', 'str_', 'unicode'] | type[str_] | StringDtype[Literal['pyarrow']] | Literal['string[pyarrow]'], errors: Literal['ignore', 'raise'] = ...) -> Series[str]
- python/pyspark/sql/pandas/types.py:1068: note: def astype(self, dtype: type[bytes] | Literal['bytes'] | Literal['S', 'bytes_'] | type[bytes_] | Literal['binary[pyarrow]'], errors: Literal['ignore', 'raise'] = ...) -> Series[bytes]
- python/pyspark/sql/pandas/types.py:1068: note: def astype(self, dtype: type[float] | Literal['float'] | Literal['Float32', 'Float64'] | Float32Dtype | Float64Dtype | Literal['e', 'f2', '<f2', 'float16', 'half'] | type[floating[_16Bit]] | Literal['f', 'f4', 'float32', 'single', 'd', 'f8', 'float64', 'double', 'g', 'f16', 'float128', 'longdouble'] | type[floating[_32Bit]] | type[float64] | type[floating[_64Bit | _96Bit | _128Bit]] | Literal['float[pyarrow]', 'double[pyarrow]', 'float16[pyarrow]', 'float32[pyarrow]', 'float64[pyarrow]'], errors: Literal['ignore', 'raise'] = ...) -> Series[float]
+ python/pyspark/sql/pandas/types.py:1068: note: def astype(self, dtype: Literal['str', 'string', 'string[python]', 'U', 'str_', 'unicode', 'string[pyarrow]'] | type[str] | StringDtype[None] | StringDtype[Literal['python']] | type[str_] | StringDtype[Literal['pyarrow']], errors: Literal['ignore', 'raise'] = ...) -> Series[str]
+ python/pyspark/sql/pandas/types.py:1068: note: def astype(self, dtype: Literal['bytes', 'S', 'bytes_', 'binary[pyarrow]'] | type[bytes] | type[bytes_], errors: Literal['ignore', 'raise'] = ...) -> Series[bytes]
+ python/pyspark/sql/pandas/types.py:1068: note: def astype(self, dtype: Literal['float', 'Float32', 'Float64', 'e', 'f2', '<f2', 'float16', 'half', 'f', 'f4', 'float32', 'single', 'd', 'f8', 'float64', 'double', 'g', 'f16', 'float128', 'longdouble', 'float[pyarrow]', 'double[pyarrow]', 'float16[pyarrow]', 'float32[pyarrow]', 'float64[pyarrow]'] | type[float] | Float32Dtype | Float64Dtype | type[floating[_16Bit]] | type[floating[_32Bit]] | type[float64] | type[floating[_64Bit | _96Bit | _128Bit]], errors: Literal['ignore', 'raise'] = ...) -> Series[float]
- python/pyspark/sql/pandas/types.py:1068: note: def astype(self, dtype: type[complex] | Literal['complex'] | Literal['F', 'c8', 'complex64', 'csingle', 'D', 'c16', 'complex128', 'cdouble', 'G', 'c32', 'complex256', 'clongdouble'] | type[complexfloating[_32Bit, _32Bit]] | type[complex128] | type[complexfloating[_64Bit | _96Bit | _128Bit, _64Bit | _96Bit | _128Bit]], errors: Literal['ignore', 'raise'] = ...) -> Series[complex]
+ python/pyspark/sql/pandas/types.py:1068: note: def astype(self, dtype: Literal['complex', 'F', 'c8', 'complex64', 'csingle', 'D', 'c16', 'complex128', 'cdouble', 'G', 'c32', 'complex256', 'clongdouble'] | type[complex] | type[complexfloating[_32Bit, _32Bit]] | type[complex128] | type[complexfloating[_64Bit | _96Bit | _128Bit, _64Bit | _96Bit | _128Bit]], errors: Literal['ignore', 'raise'] = ...) -> Series[complex]
- python/pyspark/sql/pandas/types.py:1070: note: def astype(self, dtype: type[builtins.bool] | Literal['bool'] | BooleanDtype | Literal['boolean'] | Literal['?', 'b1', 'bool_'] | type[numpy.bool[builtins.bool]] | Literal['bool[pyarrow]', 'boolean[pyarrow]'], errors: Literal['ignore', 'raise'] = ...) -> Series[bool]
+ python/pyspark/sql/pandas/types.py:1070: note: def astype(self, dtype: Literal['bool', 'boolean', '?', 'b1', 'bool_', 'bool[pyarrow]', 'boolean[pyarrow]'] | type[builtins.bool] | BooleanDtype | type[numpy.bool[builtins.bool]], errors: Literal['ignore', 'raise'] = ...) -> Series[bool]
- python/pyspark/sql/pandas/types.py:1070: note: def astype(self, dtype: type[str] | Literal['str'] | StringDtype[None] | Literal['string'] | StringDtype[Literal['python']] | Literal['string[python]'] | Literal['U', 'str_', 'unicode'] | type[str_] | StringDtype[Literal['pyarrow']] | Literal['string[pyarrow]'], errors: Literal['ignore', 'raise'] = ...) -> Series[str]
- python/pyspark/sql/pandas/types.py:1070: note: def astype(self, dtype: type[bytes] | Literal['bytes'] | Literal['S', 'bytes_'] | type[bytes_] | Literal['binary[pyarrow]'], errors: Literal['ignore', 'raise'] = ...) -> Series[bytes]
- python/pyspark/sql/pandas/types.py:1070: note: def astype(self, dtype: type[float] | Literal['float'] | Literal['Float32', 'Float64'] | Float32Dtype | Float64Dtype | Literal['e', 'f2', '<f2', 'float16', 'half'] | type[floating[_16Bit]] | Literal['f', 'f4', 'float32', 'single', 'd', 'f8', 'float64', 'double', 'g', 'f16', 'float128', 'longdouble'] | type[floating[_32Bit]] | type[float64] | type[floating[_64Bit | _96Bit | _128Bit]] | Literal['float[pyarrow]', 'double[pyarrow]', 'float16[pyarrow]', 'float32[pyarrow]', 'float64[pyarrow]'], errors: Literal['ignore', 'raise'] = ...) -> Series[float]
+ python/pyspark/sql/pandas/types.py:1070: note: def astype(self, dtype: Literal['str', 'string', 'string[python]', 'U', 'str_', 'unicode', 'string[pyarrow]'] | type[str] | StringDtype[None] | StringDtype[Literal['python']] | type[str_] | StringDtype[Literal['pyarrow']], errors: Literal['ignore', 'raise'] = ...) -> Series[str]
+ python/pyspark/sql/pandas/types.py:1070: note: def astype(self, dtype: Literal['bytes', 'S', 'bytes_', 'binary[pyarrow]'] | type[bytes] | type[bytes_], errors: Literal['ignore', 'raise'] = ...) -> Series[bytes]
+ python/pyspark/sql/pandas/types.py:1070: note: def astype(self, dtype: Literal['float', 'Float32', 'Float64', 'e', 'f2', '<f2', 'float16', 'half', 'f', 'f4', 'float32', 'single', 'd', 'f8', 'float64', 'double', 'g', 'f16', 'float128', 'longdouble', 'float[pyarrow]', 'double[pyarrow]', 'float16[pyarrow]', 'float32[pyarrow]', 'float64[pyarrow]'] | type[float] | Float32Dtype | Float64Dtype | type[floating[_16Bit]] | type[floating[_32Bit]] | type[float64] | type[floating[_64Bit | _96Bit | _128Bit]], errors: Literal['ignore', 'raise'] = ...) -> Series[float]
- python/pyspark/sql/pandas/types.py:1070: note: def astype(self, dtype: type[complex] | Literal['complex'] | Literal['F', 'c8', 'complex64', 'csingle', 'D', 'c16', 'complex128', 'cdouble', 'G', 'c32', 'complex256', 'clongdouble'] | type[complexfloating[_32Bit, _32Bit]] | type[complex128] | type[complexfloating[_64Bit | _96Bit | _128Bit, _64Bit | _96Bit | _128Bit]], errors: Literal['ignore', 'raise'] = ...) -> Series[complex]
+ python/pyspark/sql/pandas/types.py:1070: note: def astype(self, dtype: Literal['complex', 'F', 'c8', 'complex64', 'csingle', 'D', 'c16', 'complex128', 'cdouble', 'G', 'c32', 'complex256', 'clongdouble'] | type[complex] | type[complexfloating[_32Bit, _32Bit]] | type[complex128] | type[complexfloating[_64Bit | _96Bit | _128Bit, _64Bit | _96Bit | _128Bit]], errors: Literal['ignore', 'raise'] = ...) -> Series[complex]
- python/pyspark/sql/pandas/types.py:1080: note: def astype(self, dtype: type[builtins.bool] | Literal['bool'] | BooleanDtype | Literal['boolean'] | Literal['?', 'b1', 'bool_'] | type[numpy.bool[builtins.bool]] | Literal['bool[pyarrow]', 'boolean[pyarrow]'], errors: Literal['ignore', 'raise'] = ...) -> Series[bool]
+ python/pyspark/sql/pandas/types.py:1080: note: def astype(self, dtype: Literal['bool', 'boolean', '?', 'b1', 'bool_', 'bool[pyarrow]', 'boolean[pyarrow]'] | type[builtins.bool] | BooleanDtype | type[numpy.bool[builtins.bool]], errors: Literal['ignore', 'raise'] = ...) -> Series[bool]
- python/pyspark/sql/pandas/types.py:1080: note: def astype(self, dtype: type[str] | Literal['str'] | StringDtype[None] | Literal['string'] | StringDtype[Literal['python']] | Literal['string[python]'] | Literal['U', 'str_', 'unicode'] | type[str_] | StringDtype[Literal['pyarrow']] | Literal['string[pyarrow]'], errors: Literal['ignore', 'raise'] = ...) -> Series[str]
- python/pyspark/sql/pandas/types.py:1080: note: def astype(self, dtype: type[bytes] | Literal['bytes'] | Literal['S', 'bytes_'] | type[bytes_] | Literal['binary[pyarrow]'], errors: Literal['ignore', 'raise'] = ...) -> Series[bytes]
... (truncated 26 lines) ...
prefect (https://github.com/PrefectHQ/prefect)
- src/prefect/variables.py:213: error: Argument 1 has incompatible type "Callable[[type[Variable[T]], str, Any | Any | Any | Any | dict[str, Any] | list[Any] | None | None], Any | Any | Any | Any | dict[str, Any] | list[Any] | None | None]"; expected "Callable[[type[Variable[T]], str], T | None]" [arg-type]
+ src/prefect/variables.py:213: error: Argument 1 has incompatible type "Callable[[type[Variable[T]], str, Any | Any | Any | Any | dict[str, Any] | list[Any] | None], Any | Any | Any | Any | dict[str, Any] | list[Any] | None]"; expected "Callable[[type[Variable[T]], str], T | None]" [arg-type]
colour (https://github.com/colour-science/colour)
- colour/continuous/signal.py:825: error: Invalid index type "Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str] | slice[Any, Any, Any]" for "ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]]"; expected type "SupportsIndex | slice[Any, Any, Any] | EllipsisType | _SupportsArray[dtype[numpy.bool[builtins.bool] | integer[Any]]] | _NestedSequence[_SupportsArray[dtype[numpy.bool[builtins.bool] | integer[Any]]]] | int | _NestedSequence[int] | None | tuple[SupportsIndex | slice[Any, Any, Any] | EllipsisType | _SupportsArray[dtype[numpy.bool[builtins.bool] | integer[Any]]] | _NestedSequence[_SupportsArray[dtype[numpy.bool[builtins.bool] | integer[Any]]]] | int | _NestedSequence[int] | None, ...]" [index]
+ colour/continuous/signal.py:825: error: Invalid index type "Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str] | slice[Any, Any, Any]" for "ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]]"; expected type "SupportsIndex | slice[Any, Any, Any] | EllipsisType | _SupportsArray[dtype[numpy.bool[builtins.bool] | integer[Any]]] | _NestedSequence[_SupportsArray[dtype[numpy.bool[builtins.bool] | integer[Any]]]] | int | _NestedSequence[int] | tuple[SupportsIndex | slice[Any, Any, Any] | EllipsisType | _SupportsArray[dtype[numpy.bool[builtins.bool] | integer[Any]]] | _NestedSequence[_SupportsArray[dtype[numpy.bool[builtins.bool] | integer[Any]]]] | int | _NestedSequence[int] | None, ...] | None" [index]
- colour/continuous/multi_signals.py:1142: error: Invalid index type "tuple[Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str] | slice[Any, Any, Any], Any | slice[Any, Any, Any]]" for "ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]]"; expected type "SupportsIndex | slice[Any, Any, Any] | EllipsisType | _SupportsArray[dtype[numpy.bool[builtins.bool] | integer[Any]]] | _NestedSequence[_SupportsArray[dtype[numpy.bool[builtins.bool] | integer[Any]]]] | int | _NestedSequence[int] | None | tuple[SupportsIndex | slice[Any, Any, Any] | EllipsisType | _SupportsArray[dtype[numpy.bool[builtins.bool] | integer[Any]]] | _NestedSequence[_SupportsArray[dtype[numpy.bool[builtins.bool] | integer[Any]]]] | int | _NestedSequence[int] | None, ...]" [index]
+ colour/continuous/multi_signals.py:1142: error: Invalid index type "tuple[Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str] | slice[Any, Any, Any], Any | slice[Any, Any, Any]]" for "ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]]"; expected type "SupportsIndex | slice[Any, Any, Any] | EllipsisType | _SupportsArray[dtype[numpy.bool[builtins.bool] | integer[Any]]] | _NestedSequence[_SupportsArray[dtype[numpy.bool[builtins.bool] | integer[Any]]]] | int | _NestedSequence[int] | tuple[SupportsIndex | slice[Any, Any, Any] | EllipsisType | _SupportsArray[dtype[numpy.bool[builtins.bool] | integer[Any]]] | _NestedSequence[_SupportsArray[dtype[numpy.bool[builtins.bool] | integer[Any]]]] | int | _NestedSequence[int] | None, ...] | None" [index]
- colour/recovery/meng2015.py:225: note: def [Float1DT: ndarray[tuple[int], dtype[float64]]] minimize(fun: def (Float1DT, /, *Any, **Any) -> Float1DT, x0: float | floating[Any] | integer[Any] | numpy.bool[builtins.bool], args: tuple[object, ...] = ..., method: Literal['Nelder-Mead', 'nelder-mead', 'Powell', 'powell', 'CG', 'cg', 'BFGS', 'bfgs', 'Newton-CG', 'newton-cg', 'L-BFGS-B', 'l-bfgs-b', 'TNC', 'tnc', 'COBYLA', 'cobyla', 'COBYQA', 'cobyqa', 'SLSQP', 'slsqp', 'Trust-Constr', 'trust-constr', 'Dogleg', 'dogleg', 'Trust-NCG', 'trust-ncg', 'Trust-Exact', 'trust-exact', 'Trust-Krylov', 'trust-krylov'] | _MinimizeMethodFun | None = ..., jac: def (ndarray[tuple[int], dtype[float64]], /, *Any, **Any) -> _CanArrayND[floating[Any] | integer[Any] | numpy.bool[builtins.bool]] | Sequence[float | floating[Any] | integer[Any] | numpy.bool[builtins.bool]] | Literal['2-point', '3-point', 'cs'] | Literal[False] | numpy.bool[Literal[False]] | Literal[0] | None = ..., hess: def (ndarray[tuple[int], dtype[float64]], /, *Any, **Any) -> _CanArrayND[floating[Any] | integer[Any] | numpy.bool[builtins.bool]] | Sequence[_CanArrayND[floating[Any] | integer[Any] | numpy.bool[builtins.bool]] | Sequence[float | floating[Any] | integer[Any] | numpy.bool[builtins.bool]]] | Literal['2-point', '3-point', 'cs'] | HessianUpdateStrategy | None = ..., hessp: def (ndarray[tuple[int], dtype[float64]], ndarray[tuple[int], dtype[float64]], /, *Any, **Any) -> _CanArrayND[floating[Any] | integer[Any] | numpy.bool[builtins.bool]] | Sequence[float | floating[Any] | integer[Any] | numpy.bool[builtins.bool]] | None = ..., bounds: Sequence[Sequence[float | floating[Any] | integer[Any] | numpy.bool[builtins.bool] | None]] | _CanArrayND[floating[Any] | integer[Any] | numpy.bool[builtins.bool]] | Sequence[_CanArrayND[floating[Any] | integer[Any] | numpy.bool[builtins.bool]] | Sequence[float | floating[Any] | integer[Any] | numpy.bool[builtins.bool]]] | Bounds[tuple[Any, ...], float64 | Any] | None = ..., constraints: LinearConstraint | NonlinearConstraint[float | Any, builtins.bool] | _ConstraintDict | Sequence[LinearConstraint | NonlinearConstraint[float | Any, builtins.bool] | _ConstraintDict] = ..., tol: float | floating[Any] | integer[Any] | numpy.bool[builtins.bool] | None = ..., callback: _CallbackResult | _CallbackVector | None = ..., options: _MinimizeOptions | None = ...) -> OptimizeResult[float64]
+ colour/recovery/meng2015.py:225: note: def [Float1DT: ndarray[tuple[int], dtype[float64]]] minimize(fun: def (Float1DT, /, *Any, **Any) -> Float1DT, x0: float | floating[Any] | integer[Any] | numpy.bool[builtins.bool], args: tuple[object, ...] = ..., method: Literal['Nelder-Mead', 'nelder-mead', 'Powell', 'powell', 'CG', 'cg', 'BFGS', 'bfgs', 'Newton-CG', 'newton-cg', 'L-BFGS-B', 'l-bfgs-b', 'TNC', 'tnc', 'COBYLA', 'cobyla', 'COBYQA', 'cobyqa', 'SLSQP', 'slsqp', 'Trust-Constr', 'trust-constr', 'Dogleg', 'dogleg', 'Trust-NCG', 'trust-ncg', 'Trust-Exact', 'trust-exact', 'Trust-Krylov', 'trust-krylov'] | _MinimizeMethodFun | None = ..., jac: Literal['2-point', '3-point', 'cs', False, 0] | def (ndarray[tuple[int], dtype[float64]], /, *Any, **Any) -> _CanArrayND[floating[Any] | integer[Any] | numpy.bool[builtins.bool]] | Sequence[float | floating[Any] | integer[Any] | numpy.bool[builtins.bool]] | numpy.bool[Literal[False]] | None = ..., hess: Literal['2-point', '3-point', 'cs'] | def (ndarray[tuple[int], dtype[float64]], /, *Any, **Any) -> _CanArrayND[floating[Any] | integer[Any] | numpy.bool[builtins.bool]] | Sequence[_CanArrayND[floating[Any] | integer[Any] | numpy.bool[builtins.bool]] | Sequence[float | floating[Any] | integer[Any] | numpy.bool[builtins.bool]]] | HessianUpdateStrategy | None = ..., hessp: def (ndarray[tuple[int], dtype[float64]], ndarray[tuple[int], dtype[float64]], /, *Any, **Any) -> _CanArrayND[floating[Any] | integer[Any] | numpy.bool[builtins.bool]] | Sequence[float | floating[Any] | integer[Any] | numpy.bool[builtins.bool]] | None = ..., bounds: Sequence[Sequence[float | floating[Any] | integer[Any] | numpy.bool[builtins.bool] | None]] | _CanArrayND[floating[Any] | integer[Any] | numpy.bool[builtins.bool]] | Sequence[_CanArrayND[floating[Any] | integer[Any] | numpy.bool[builtins.bool]] | Sequence[float | floating[Any] | integer[Any] | numpy.bool[builtins.bool]]] | Bounds[tuple[Any, ...], float64 | Any] | None = ..., constraints: LinearConstraint | NonlinearConstraint[float | Any, builtins.bool] | _ConstraintDict | Sequence[LinearConstraint | NonlinearConstraint[float | Any, builtins.bool] | _ConstraintDict] = ..., tol: float | floating[Any] | integer[Any] | numpy.bool[builtins.bool] | None = ..., callback: _CallbackResult | _CallbackVector | None = ..., options: _MinimizeOptions | None = ...) -> OptimizeResult[float64]
- colour/recovery/meng2015.py:225: note: def minimize(fun: def (ndarray[tuple[int], dtype[float64]], /, *Any, **Any) -> float | floating[Any] | integer[Any] | numpy.bool[builtins.bool], x0: float | floating[Any] | integer[Any] | numpy.bool[builtins.bool] | _CanArrayND[floating[Any] | integer[Any] | numpy.bool[builtins.bool]] | Sequence[float | floating[Any] | integer[Any] | numpy.bool[builtins.bool]], args: tuple[object, ...], method: Literal['COBYLA', 'cobyla'], jac: def (ndarray[tuple[int], dtype[float64]], /, *Any, **Any) -> _CanArrayND[floating[Any] | integer[Any] | numpy.bool[builtins.bool]] | Sequence[float | floating[Any] | integer[Any] | numpy.bool[builtins.bool]] | Literal['2-point', '3-point', 'cs'] | Literal[False] | numpy.bool[Literal[False]] | Literal[0] | None = ..., hess: def (ndarray[tuple[int], dtype[float64]], /, *Any, **Any) -> _CanArrayND[floating[Any] | integer[Any] | numpy.bool[builtins.bool]] | Sequence[_CanArrayND[floating[Any] | integer[Any] | numpy.bool[builtins.bool]] | Sequence[float | floating[Any] | integer[Any] | numpy.bool[builtins.bool]]] | Literal['2-point', '3-point', 'cs'] | HessianUpdateStrategy | None = ..., hessp: def (ndarray[tuple[int], dtype[float64]], ndarray[tuple[int], dtype[float64]], /, *Any, **Any) -> _CanArrayND[floating[Any] | integer[Any] | numpy.bool[builtins.bool]] | Sequence[float | floating[Any] | integer[Any] | numpy.bool[builtins.bool]] | None = ..., bounds: Sequence[Sequence[float | floating[Any] | integer[Any] | numpy.bool[builtins.bool] | None]] | _CanArrayND[floating[Any] | integer[Any] | numpy.bool[builtins.bool]] | Sequence[_CanArrayND[floating[Any] | integer[Any] | numpy.bool[builtins.bool]] | Sequence[float | floating[Any] | integer[Any] | numpy.bool[builtins.bool]]] | Bounds[tuple[Any, ...], float64 | Any] | None = ..., constraints: LinearConstraint | NonlinearConstraint[float | Any, builtins.bool] | _ConstraintDict | Sequence[LinearConstraint | NonlinearConstraint[float | Any, builtins.bool] | _ConstraintDict] = ..., tol: float | floating[Any] | integer[Any] | numpy.bool[builtins.bool] | None = ..., callback: _CallbackResult | _CallbackVector | None = ..., options: _MinimizeOptions | None = ...) -> _CobylaResult
+ colour/recovery/meng2015.py:225: note: def minimize(fun: def (ndarray[tuple[int], dtype[float64]], /, *Any, **Any) -> float | floating[Any] | integer[Any] | numpy.bool[builtins.bool], x0: float | floating[Any] | integer[Any] | numpy.bool[builtins.bool] | _CanArrayND[floating[Any] | integer[Any] | numpy.bool[builtins.bool]] | Sequence[float | floating[Any] | integer[Any] | numpy.bool[builtins.bool]], args: tuple[object, ...], method: Literal['COBYLA', 'cobyla'], jac: Literal['2-point', '3-point', 'cs', False, 0] | def (ndarray[tuple[int], dtype[float64]], /, *Any, **Any) -> _CanArrayND[floating[Any] | integer[Any] | numpy.bool[builtins.bool]] | Sequence[float | floating[Any] | integer[Any] | numpy.bool[builtins.bool]] | numpy.bool[Literal[False]] | None = ..., hess: Literal['2-point', '3-point', 'cs'] | def (ndarray[tuple[int], dtype[float64]], /, *Any, **Any) -> _CanArrayND[floating[Any] | integer[Any] | numpy.bool[builtins.bool]] | Sequence[_CanArrayND[floating[Any] | integer[Any] | numpy.bool[builtins.bool]] | Sequence[float | floating[Any] | integer[Any] | numpy.bool[builtins.bool]]] | HessianUpdateStrategy | None = ..., hessp: def (ndarray[tuple[int], dtype[float64]], ndarray[tuple[int], dtype[float64]], /, *Any, **Any) -> _CanArrayND[floating[Any] | integer[Any] | numpy.bool[builtins.bool]] | Sequence[float | floating[Any] | integer[Any] | numpy.bool[builtins.bool]] | None = ..., bounds: Sequence[Sequence[float | floating[Any] | integer[Any] | numpy.bool[builtins.bool] | None]] | _CanArrayND[floating[Any] | integer[Any] | numpy.bool[builtins.bool]] | Sequence[_CanArrayND[floating[Any] | integer[Any] | numpy.bool[builtins.bool]] | Sequence[float | floating[Any] | integer[Any] | numpy.bool[builtins.bool]]] | Bounds[tuple[Any, ...], float64 | Any] | None = ..., constraints: LinearConstraint | NonlinearConstraint[float | Any, builtins.bool] | _ConstraintDict | Sequence[LinearConstraint | NonlinearConstraint[float | Any, builtins.bool] | _ConstraintDict] = ..., tol: float | floating[Any] | integer[Any] | numpy.bool[builtins.bool] | None = ..., callback: _CallbackResult | _CallbackVector | None = ..., options: _MinimizeOptions | None = ...) -> _CobylaResult
- colour/recovery/meng2015.py:225: note: def minimize(fun: def (ndarray[tuple[int], dtype[float64]], /, *Any, **Any) -> float | floating[Any] | integer[Any] | numpy.bool[builtins.bool], x0: float | floating[Any] | integer[Any] | numpy.bool[builtins.bool] | _CanArrayND[floating[Any] | integer[Any] | numpy.bool[builtins.bool]] | Sequence[float | floating[Any] | integer[Any] | numpy.bool[builtins.bool]], args: tuple[object, ...] = ..., *, method: Literal['COBYLA', 'cobyla'], jac: def (ndarray[tuple[int], dtype[float64]], /, *Any, **Any) -> _CanArrayND[floating[Any] | integer[Any] | numpy.bool[builtins.bool]] | Sequence[float | floating[Any] | integer[Any] | numpy.bool[builtins.bool]] | Literal['2-point', '3-point', 'cs'] | Literal[False] | numpy.bool[Literal[False]] | Literal[0] | None = ..., hess: def (ndarray[tuple[int], dtype[float64]], /, *Any, **Any) -> _CanArrayND[floating[Any] | integer[Any] | numpy.bool[builtins.bool]] | Sequence[_CanArrayND[floating[Any] | integer[Any] | numpy.bool[builtins.bool]] | Sequence[float | floating[Any] | integer[Any] | numpy.bool[builtins.bool]]] | Literal['2-point', '3-point', 'cs'] | HessianUpdateStrategy | None = ..., hessp: def (ndarray[tuple[int], dtype[float64]], ndarray[tuple[int], dtype[float64]], /, *Any, **Any) -> _CanArrayND[floating[Any] | integer[Any] | numpy.bool[builtins.bool]] | Sequence[float | floating[Any] | integer[Any] | numpy.bool[builtins.bool]] | None = ..., bounds: Sequence[Sequence[float | floating[Any] | integer[Any] | numpy.bool[builtins.bool] | None]] | _CanArrayND[floating[Any] | integer[Any] | numpy.bool[builtins.bool]] | Sequence[_CanArrayND[floating[Any] | integer[Any] | numpy.bool[builtins.bool]] | Sequence[float | floating[Any] | integer[Any] | numpy.bool[builtins.bool]]] | Bounds[tuple[Any, ...], float64 | Any] | None = ..., constraints: LinearConstraint | NonlinearConstraint[float | Any, builtins.bool] | _ConstraintDict | Sequence[LinearConstraint | NonlinearConstraint[float | Any, builtins.bool] | _ConstraintDict] = ..., tol: float | floating[Any] | integer[Any] | numpy.bool[builtins.bool] | None = ..., callback: _CallbackResult | _CallbackVector | None = ..., options: _MinimizeOptions | None = ...) -> _CobylaResult
... (truncated 63 lines) ...
hydra-zen (https://github.com/mit-ll-responsible-ai/hydra-zen)
- src/hydra_zen/structured_configs/_implementations.py:1159: note: def [R, P] builds(cls, type[BuildsWithSig[type[R], P]], /, *, zen_partial: Literal[False] | None = ..., populate_full_signature: Literal[True], zen_wrappers: Builds[Callable[[Callable[..., Any]], Callable[..., Any]]] | ZenPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]] | HydraPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]] | Just[Callable[[Callable[..., Any]], Callable[..., Any]]] | type[Builds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[ZenPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[HydraPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[Just[Callable[[Callable[..., Any]], Callable[..., Any]]]] | Callable[[Callable[..., Any]], Callable[..., Any]] | str | None | Sequence[Builds[Callable[[Callable[..., Any]], Callable[..., Any]]] | ZenPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]] | HydraPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]] | Just[Callable[[Callable[..., Any]], Callable[..., Any]]] | type[Builds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[ZenPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[HydraPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[Just[Callable[[Callable[..., Any]], Callable[..., Any]]]] | Callable[[Callable[..., Any]], Callable[..., Any]] | str | None] = ..., zen_meta: Mapping[str, SupportedPrimitive] | None = ..., hydra_recursive: bool | None = ..., hydra_convert: Literal['none', 'partial', 'all', 'object'] | None = ..., hydra_defaults: list[str | DataClass_ | type[DataClass_] | Mapping[str, str | Sequence[str] | None]] | None = ..., dataclass_name: str | None = ..., builds_bases: tuple[()] = ..., zen_dataclass: DataclassOptions | None = ..., frozen: bool = ..., zen_convert: ZenConvert | None = ...) -> type[BuildsWithSig[type[R], P]]
- src/hydra_zen/structured_configs/_implementations.py:1159: note: def [P, R] builds(cls, Callable[P, R], /, *, zen_partial: Literal[False] | None = ..., populate_full_signature: Literal[True], zen_wrappers: Builds[Callable[[Callable[..., Any]], Callable[..., Any]]] | ZenPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]] | HydraPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]] | Just[Callable[[Callable[..., Any]], Callable[..., Any]]] | type[Builds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[ZenPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[HydraPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[Just[Callable[[Callable[..., Any]], Callable[..., Any]]]] | Callable[[Callable[..., Any]], Callable[..., Any]] | str | None | Sequence[Builds[Callable[[Callable[..., Any]], Callable[..., Any]]] | ZenPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]] | HydraPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]] | Just[Callable[[Callable[..., Any]], Callable[..., Any]]] | type[Builds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[ZenPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[HydraPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[Just[Callable[[Callable[..., Any]], Callable[..., Any]]]] | Callable[[Callable[..., Any]], Callable[..., Any]] | str | None] = ..., zen_meta: Mapping[str, SupportedPrimitive] | None = ..., hydra_recursive: bool | None = ..., hydra_convert: Literal['none', 'partial', 'all', 'object'] | None = ..., hydra_defaults: list[str | DataClass_ | type[DataClass_] | Mapping[str, str | Sequence[str] | None]] | None = ..., dataclass_name: str | None = ..., builds_bases: tuple[()] = ..., zen_dataclass: DataclassOptions | None = ..., frozen: bool = ..., zen_convert: ZenConvert | None = ...) -> type[BuildsWithSig[type[R], P]]
- src/hydra_zen/structured_configs/_implementations.py:1159: note: def [Importable: Callable[..., Any]] builds(cls, type[Builds[Importable]] | type[BuildsWithSig[Importable, Any]], /, *pos_args: T, zen_partial: Literal[False] | None = ..., populate_full_signature: bool = ..., zen_wrappers: Builds[Callable[[Callable[..., Any]], Callable[..., Any]]] | ZenPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]] | HydraPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]] | Just[Callable[[Callable[..., Any]], Callable[..., Any]]] | type[Builds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[ZenPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[HydraPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[Just[Callable[[Callable[..., Any]], Callable[..., Any]]]] | Callable[[Callable[..., Any]], Callable[..., Any]] | str | None | Sequence[Builds[Callable[[Callable[..., Any]], Callable[..., Any]]] | ZenPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]] | HydraPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]] | Just[Callable[[Callable[..., Any]], Callable[..., Any]]] | type[Builds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[ZenPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[HydraPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[Just[Callable[[Callable[..., Any]], Callable[..., Any]]]] | Callable[[Callable[..., Any]], Callable[..., Any]] | str | None] = ..., zen_meta: Mapping[str, SupportedPrimitive] | None = ..., hydra_recursive: bool | None = ..., hydra_convert: Literal['none', 'partial', 'all', 'object'] | None = ..., hydra_defaults: list[str | DataClass_ | type[DataClass_] | Mapping[str, str | Sequence[str] | None]] | None = ..., dataclass_name: str | None = ..., builds_bases: tuple[type[DataClass_], ...] = ..., zen_dataclass: DataclassOptions | None = ..., frozen: bool = ..., zen_convert: ZenConvert | None = ..., **kwargs_for_target: T) -> type[Builds[Importable]]
- src/hydra_zen/structured_configs/_implementations.py:1159: note: def [Importable: Callable[..., Any]] builds(cls, Importable, /, *pos_args: T, zen_partial: Literal[False] | None = ..., populate_full_signature: bool = ..., zen_wrappers: Builds[Callable[[Callable[..., Any]], Callable[..., Any]]] | ZenPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]] | HydraPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]] | Just[Callable[[Callable[..., Any]], Callable[..., Any]]] | type[Builds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[ZenPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[HydraPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[Just[Callable[[Callable[..., Any]], Callable[..., Any]]]] | Callable[[Callable[..., Any]], Callable[..., Any]] | str | None | Sequence[Builds[Callable[[Callable[..., Any]], Callable[..., Any]]] | ZenPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]] | HydraPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]] | Just[Callable[[Callable[..., Any]], Callable[..., Any]]] | type[Builds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[ZenPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[HydraPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[Just[Callable[[Callable[..., Any]], Callable[..., Any]]]] | Callable[[Callable[..., Any]], Callable[..., Any]] | str | None] = ..., zen_meta: Mapping[str, SupportedPrimitive] | None = ..., hydra_recursive: bool | None = ..., hydra_convert: Literal['none', 'partial', 'all', 'object'] | None = ..., hydra_defaults: list[str | DataClass_ | type[DataClass_] | Mapping[str, str | Sequence[str] | None]] | None = ..., dataclass_name: str | None = ..., builds_bases: tuple[type[DataClass_], ...] = ..., zen_dataclass: DataclassOptions | None = ..., frozen: bool = ..., zen_convert: ZenConvert | None = ..., **kwargs_for_target: T) -> type[Builds[Importable]]
- src/hydra_zen/structured_configs/_implementations.py:1159: note: def [Importable: Callable[..., Any]] builds(cls, type[Builds[Importable]] | type[BuildsWithSig[Importable, Any]], /, *pos_args: T, zen_partial: Literal[True], populate_full_signature: bool = ..., zen_wrappers: Builds[Callable[[Callable[..., Any]], Callable[..., Any]]] | ZenPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]] | HydraPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]] | Just[Callable[[Callable[..., Any]], Callable[..., Any]]] | type[Builds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[ZenPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[HydraPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[Just[Callable[[Callable[..., Any]], Callable[..., Any]]]] | Callable[[Callable[..., Any]], Callable[..., Any]] | str | None | Sequence[Builds[Callable[[Callable[..., Any]], Callable[..., Any]]] | ZenPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]] | HydraPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]] | Just[Callable[[Callable[..., Any]], Callable[..., Any]]] | type[Builds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[ZenPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[HydraPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[Just[Callable[[Callable[..., Any]], Callable[..., Any]]]] | Callable[[Callable[..., Any]], Callable[..., Any]] | str | None] = ..., zen_meta: Mapping[str, SupportedPrimitive] | None = ..., hydra_recursive: bool | None = ..., hydra_convert: Literal['none', 'partial', 'all', 'object'] | None = ..., hydra_defaults: list[str | DataClass_ | type[DataClass_] | Mapping[str, str | Sequence[str] | None]] | None = ..., dataclass_name: str | None = ..., builds_bases: tuple[type[DataClass_], ...] = ..., zen_dataclass: DataclassOptions | None = ..., frozen: bool = ..., zen_convert: ZenConvert | None = ..., **kwargs_for_target: T) -> type[ZenPartialBuilds[Importable]] | type[HydraPartialBuilds[Importable]]
- src/hydra_zen/structured_configs/_implementations.py:1159: note: def [Importable: Callable[..., Any]] builds(cls, Importable, /, *pos_args: T, zen_partial: Literal[True], populate_full_signature: bool = ..., zen_wrappers: Builds[Callable[[Callable[..., Any]], Callable[..., Any]]] | ZenPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]] | HydraPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]] | Just[Callable[[Callable[..., Any]], Callable[..., Any]]] | type[Builds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[ZenPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[HydraPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[Just[Callable[[Callable[..., Any]], Callable[..., Any]]]] | Callable[[Callable[..., Any]], Callable[..., Any]] | str | None | Sequence[Builds[Callable[[Callable[..., Any]], Callable[..., Any]]] | ZenPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]] | HydraPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]] | Just[Callable[[Callable[..., Any]], Callable[..., Any]]] | type[Builds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[ZenPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[HydraPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[Just[Callable[[Callable[..., Any]], Callable[..., Any]]]] | Callable[[Callable[..., Any]], Callable[..., Any]] | str | None] = ..., zen_meta: Mapping[str, SupportedPrimitive] | None = ..., hydra_recursive: bool | None = ..., hydra_convert: Literal['none', 'partial', 'all', 'object'] | None = ..., hydra_defaults: list[str | DataClass_ | type[DataClass_] | Mapping[str, str | Sequence[str] | None]] | None = ..., dataclass_name: str | None = ..., builds_bases: tuple[type[DataClass_], ...] = ..., zen_dataclass: DataclassOptions | None = ..., frozen: bool = ..., zen_convert: ZenConvert | None = ..., **kwargs_for_target: T) -> type[ZenPartialBuilds[Importable]] | type[HydraPartialBuilds[Importable]]
- src/hydra_zen/structured_configs/_implementations.py:1159: note: def [Importable: Callable[..., Any]] builds(cls, type[Builds[Importable]] | type[BuildsWithSig[Importable, Any]], /, *pos_args: T, zen_partial: bool | None = ..., populate_full_signature: Literal[False] = ..., zen_wrappers: Builds[Callable[[Callable[..., Any]], Callable[..., Any]]] | ZenPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]] | HydraPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]] | Just[Callable[[Callable[..., Any]], Callable[..., Any]]] | type[Builds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[ZenPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[HydraPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[Just[Callable[[Callable[..., Any]], Callable[..., Any]]]] | Callable[[Callable[..., Any]], Callable[..., Any]] | str | None | Sequence[Builds[Callable[[Callable[..., Any]], Callable[..., Any]]] | ZenPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]] | HydraPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]] | Just[Callable[[Callable[..., Any]], Callable[..., Any]]] | type[Builds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[ZenPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[HydraPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[Just[Callable[[Callable[..., Any]], Callable[..., Any]]]] | Callable[[Callable[..., Any]], Callable[..., Any]] | str | None] = ..., zen_meta: Mapping[str, SupportedPrimitive] | None = ..., hydra_recursive: bool | None = ..., hydra_convert: Literal['none', 'partial', 'all', 'object'] | None = ..., hydra_defaults: list[str | DataClass_ | type[DataClass_] | Mapping[str, str | Sequence[str] | None]] | None = ..., dataclass_name: str | None = ..., builds_bases: tuple[type[DataClass_], ...] = ..., zen_dataclass: DataclassOptions | None = ..., frozen: bool = ..., zen_convert: ZenConvert | None = ..., **kwargs_for_target: T) -> type[Builds[Importable]] | type[ZenPartialBuilds[Importable]] | type[HydraPartialBuilds[Importable]]
- src/hydra_zen/structured_configs/_implementations.py:1159: note: def [Importable: Callable[..., Any]] builds(cls, Importable, /, *pos_args: T, zen_partial: bool | None = ..., populate_full_signature: Literal[False] = ..., zen_wrappers: Builds[Callable[[Callable[..., Any]], Callable[..., Any]]] | ZenPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]] | HydraPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]] | Just[Callable[[Callable[..., Any]], Callable[..., Any]]] | type[Builds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[ZenPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[HydraPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[Just[Callable[[Callable[..., Any]], Callable[..., Any]]]] | Callable[[Callable[..., Any]], Callable[..., Any]] | str | None | Sequence[Builds[Callable[[Callable[..., Any]], Callable[..., Any]]] | ZenPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]] | HydraPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]] | Just[Callable[[Callable[..., Any]], Callable[..., Any]]] | type[Builds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[ZenPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[HydraPartialBuilds[Callable[[Callable[..., Any]], Callable[..., Any]]]] | type[Just[Callable[[Callable[..., Any]], Callable[..., Any]]]] | Callable[[Callable[..., Any]], Callable[..., Any]] | str | None] = ..., zen_meta: Mapping[str, SupportedPrimitive] | None = ..., hydra_recursive: bool | None = ..., hydra_convert: Literal['none', 'partial', 'all', 'object'] | None = ..., hydra_defaults: list[str | DataClass_ | type[DataClass_] | Mapping[str, str | Sequence[str] | None]] | None = ..., dataclass_name: str | None = ..., builds_bases: tuple[type[DataClass_], ...] = ..., zen_dataclass: DataclassOptions | None = ..., frozen: bool = ..., zen_convert: ZenConvert | None = ..., **kwargs_for_target: T) -> type[Builds[Importable]] | type[ZenPartialBuilds[Importable]] | type[HydraPartialBuilds[Importable]]
... (truncated 10 lines) ...
core (https://github.com/home-assistant/core)
+ homeassistant/components/ecowitt/sensor.py:368: error: Returning Any from function declared to return "str | int | float | datetime | None" [no-any-return]
- homeassistant/components/ecowitt/sensor.py:368: error: Returning Any from function declared to return "str | int | float | None | datetime" [no-any-return]
- homeassistant/components/vallox/sensor.py:69: error: Returning Any from function declared to return "str | int | float | None | datetime" [no-any-return]
+ homeassistant/components/vallox/sensor.py:69: error: Returning Any from function declared to return "str | int | float | datetime | None" [no-any-return]
pandera (https://github.com/pandera-dev/pandera)
... (truncated 161 lines) ...``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #22194.
When a type alias in a Union resolved to another Union whose members
overlapped with the outer Union, the formatted type kept the duplicates.
Reproducer from the issue (
sentence_transformers-style aliases):Before:
expected "str | str | None".After:
expected "str | None".Why it happens
ignore_last_known_valuesis where duplicates in error-message unionsget collapsed, and its docstring already promises "This will avoid
types like str | str in error messages." It only compared
Instanceitems against each other, though — anything wrapped in a
TypeAliasTypewent straight into the output. The outer
SingleInputresolves onelevel, giving
[Instance(str), TypeAliasType(ImageInput → str | None)];the inner
strfrom the alias then slips past dedup and is formattedalongside the Instance
str.Fix
flatten_nested_unions(..., handle_recursive=False)on the itemsfirst, so any TypeAliasType pointing at a Union is expanded (its leaf
items are compared against the other outer items).
handle_recursiveis kept off so that recursive aliases are not expanded forever —
get_proper_typeon a recursive alias calls_expand_oncewhichwould otherwise recurse without bound (several
check-recursive-typestests exercise exactly this via
format_type).get_proper_type(item)is used to seethrough a non-recursive TypeAliasType to a bare Instance, so an
Instance already in the output deduplicates it. Non-Instance items
are preserved as before.
TypeAliasTypeitems are passed through untouched so therecursive-aliases suite still formats them with their alias name.
Tests
Regression cases added for both authoring styles:
check-type-aliases.test::testUnionTypeAliasErrorDeduplicatesOverlappingItemscovers
TypeAliasaliases plus anint | Optvariant.check-python312.test::testPEP695TypeAliasUnionErrorDeduplicatesOverlappingItemscovers the PEP 695
typeform.Both fail on master with
str | str | None/int | int | Noneand passwith this fix.
Verification
pytest mypy/test/testcheck.py --timeout=180— 8313 passed, 2pre-existing failures unrelated to this change
(
testNamespaceErrorCodes,testErrorCodeTypeIgnoreMisspelled2,both reproduce on unmodified master).
python runtests.py lint— all pre-commit hooks pass.python -m mypy --config-file mypy_self_check.ini -p mypy— same 36pre-existing errors as master; this change introduces zero new ones.