@@ -154,11 +154,21 @@ def copy(
154154T_Array = TypeVar ("T_Array" , bound = "AbstractArray" )
155155T_Index = TypeVar ("T_Index" , bound = "Index" )
156156
157+ # `T_Xarray` is a type variable that can be either "DataArray" or "Dataset". When used
158+ # in a function definition, all inputs and outputs annotated with `T_Xarray` must be of
159+ # the same concrete type, either "DataArray" or "Dataset". This is generally preferred
160+ # over `T_DataArrayOrSet`, given the type system can determine the exact type.
161+ T_Xarray = TypeVar ("T_Xarray" , "DataArray" , "Dataset" )
162+
163+ # `T_DataArrayOrSet` is a type variable that is bounded to either "DataArray" or
164+ # "Dataset". Use it for functions that might return either type, but where the exact
165+ # type cannot be determined statically using the type system.
157166T_DataArrayOrSet = TypeVar ("T_DataArrayOrSet" , bound = Union ["Dataset" , "DataArray" ])
158167
159- # Maybe we rename this to T_Data or something less Fortran-y?
160- T_Xarray = TypeVar ( "T_Xarray" , "DataArray" , "Dataset" )
168+ # For working directly with `DataWithCoords`. It will only allow using methods defined
169+ # on `DataWithCoords`.
161170T_DataWithCoords = TypeVar ("T_DataWithCoords" , bound = "DataWithCoords" )
171+
162172T_Alignable = TypeVar ("T_Alignable" , bound = "Alignable" )
163173
164174# Temporary placeholder for indicating an array api compliant type.
0 commit comments