1from typing import Any, TypeAlias
2
3import numpy as np
4
5# NOTE: `_StrLike_co` and `_BytesLike_co` are pointless, as `np.str_` and
6# `np.bytes_` are already subclasses of their builtin counterpart
7_CharLike_co: TypeAlias = str | bytes
8
9# The `<X>Like_co` type-aliases below represent all scalars that can be
10# coerced into `<X>` (with the casting rule `same_kind`)
11_BoolLike_co: TypeAlias = bool | np.bool
12_UIntLike_co: TypeAlias = bool | np.unsignedinteger | np.bool
13_IntLike_co: TypeAlias = int | np.integer | np.bool
14_FloatLike_co: TypeAlias = float | np.floating | np.integer | np.bool
15_ComplexLike_co: TypeAlias = complex | np.number | np.bool
16_NumberLike_co: TypeAlias = _ComplexLike_co
17_TD64Like_co: TypeAlias = int | np.timedelta64 | np.integer | np.bool
18# `_VoidLike_co` is technically not a scalar, but it's close enough
19_VoidLike_co: TypeAlias = tuple[Any, ...] | np.void
20_ScalarLike_co: TypeAlias = complex | str | bytes | np.generic