|
18 | 18 | Generic, |
19 | 19 | get_args, |
20 | 20 | get_origin, |
21 | | - Type, |
22 | 21 | NamedTuple, |
23 | 22 | cast, |
24 | 23 | ) |
@@ -786,14 +785,14 @@ async def _update_flow(name: str, fl: Flow) -> tuple[str, _engine.IndexUpdateInf |
786 | 785 |
|
787 | 786 |
|
788 | 787 | def _get_data_slice_annotation_type( |
789 | | - data_slice_type: Type[DataSlice[T] | inspect._empty], |
790 | | -) -> Type[T] | None: |
| 788 | + data_slice_type: type[DataSlice[T] | inspect._empty], |
| 789 | +) -> type[T] | None: |
791 | 790 | type_args = get_args(data_slice_type) |
792 | 791 | if data_slice_type is inspect.Parameter.empty or data_slice_type is DataSlice: |
793 | 792 | return None |
794 | 793 | if get_origin(data_slice_type) != DataSlice or len(type_args) != 1: |
795 | 794 | raise ValueError(f"Expect a DataSlice[T] type, but got {data_slice_type}") |
796 | | - return cast(Type[T] | None, type_args[0]) |
| 795 | + return cast(type[T] | None, type_args[0]) |
797 | 796 |
|
798 | 797 |
|
799 | 798 | _transform_flow_name_builder = _NameBuilder() |
@@ -892,7 +891,7 @@ async def _build_flow_info_async(self) -> TransformFlowInfo: |
892 | 891 | engine_return_type = ( |
893 | 892 | _data_slice_state(output).engine_data_slice.data_type().schema() |
894 | 893 | ) |
895 | | - python_return_type: Type[T] | None = _get_data_slice_annotation_type( |
| 894 | + python_return_type: type[T] | None = _get_data_slice_annotation_type( |
896 | 895 | sig.return_annotation |
897 | 896 | ) |
898 | 897 | result_decoder = make_engine_value_decoder( |
@@ -952,7 +951,7 @@ def _transform_flow_wrapper(fn: Callable[..., DataSlice[T]]) -> TransformFlow[T] |
952 | 951 | raise ValueError( |
953 | 952 | f"Parameter `{param_name}` is not a parameter can be passed by name" |
954 | 953 | ) |
955 | | - value_type_annotation: Type[T] | None = _get_data_slice_annotation_type( |
| 954 | + value_type_annotation: type[T] | None = _get_data_slice_annotation_type( |
956 | 955 | param.annotation |
957 | 956 | ) |
958 | 957 | if value_type_annotation is None: |
|
0 commit comments