from typing import Union, Tuple, Any

import numpy as np

# NOTE: `_StrLike` and `_BytesLike` are pointless, as `np.str_` and `np.bytes_`
# are already subclasses of their builtin counterpart

_CharLike = Union[str, bytes]

_BoolLike = Union[bool, np.bool_]
_IntLike = Union[int, np.integer]
_FloatLike = Union[_IntLike, float, np.floating]
_ComplexLike = Union[_FloatLike, complex, np.complexfloating]
_NumberLike = Union[int, float, complex, np.number, np.bool_]

_ScalarLike = Union[
    int,
    float,
    complex,
    str,
    bytes,
    np.generic,
]

# `_VoidLike` is technically not a scalar, but it's close enough
_VoidLike = Union[Tuple[Any, ...], np.void]

from typing import Union, Tuple, Any

import numpy as np

# NOTE: `_StrLike` and `_BytesLike` are pointless, as `np.str_` and `np.bytes_`
# are already subclasses of their builtin counterpart

_CharLike = Union[str, bytes]

# The 6 `<X>Like` type-aliases below represent all scalars that can be
# coerced into `<X>` (with the casting rule `same_kind`)
_BoolLike = Union[bool, np.bool_]
_IntLike = Union[_BoolLike, int, np.integer]
_FloatLike = Union[_IntLike, float, np.floating]
_ComplexLike = Union[_FloatLike, complex, np.complexfloating]
_NumberLike = Union[int, float, complex, np.number, np.bool_]

_ScalarLike = Union[
    int,
    float,
    complex,
    str,
    bytes,
    np.generic,
]

# `_VoidLike` is technically not a scalar, but it's close enough
_VoidLike = Union[Tuple[Any, ...], np.void]

Add `_BoolLike` to the union defining `_IntLike`
ENH: Add `_BoolLike` to the union defining `_IntLike`

  from typing import Union, Tuple, Any
  
  import numpy as np
  
  # NOTE: `_StrLike` and `_BytesLike` are pointless, as `np.str_` and `np.bytes_`
  # are already subclasses of their builtin counterpart
  
  _CharLike = Union[str, bytes]
  
+ # The 6 `<X>Like` type-aliases below represent all scalars that can be
+ # coerced into `<X>` (with the casting rule `same_kind`)
  _BoolLike = Union[bool, np.bool_]
- _IntLike = Union[int, np.integer]
+ _IntLike = Union[_BoolLike, int, np.integer]
  _FloatLike = Union[_IntLike, float, np.floating]
  _ComplexLike = Union[_FloatLike, complex, np.complexfloating]
  _NumberLike = Union[int, float, complex, np.number, np.bool_]
  
  _ScalarLike = Union[
      int,
      float,
      complex,
      str,
      bytes,
      np.generic,
  ]
  
  # `_VoidLike` is technically not a scalar, but it's close enough
  _VoidLike = Union[Tuple[Any, ...], np.void]
  
Add `_BoolLike` to the union defining `_IntLike`
## Code Before:
from typing import Union, Tuple, Any

import numpy as np

# NOTE: `_StrLike` and `_BytesLike` are pointless, as `np.str_` and `np.bytes_`
# are already subclasses of their builtin counterpart

_CharLike = Union[str, bytes]

_BoolLike = Union[bool, np.bool_]
_IntLike = Union[int, np.integer]
_FloatLike = Union[_IntLike, float, np.floating]
_ComplexLike = Union[_FloatLike, complex, np.complexfloating]
_NumberLike = Union[int, float, complex, np.number, np.bool_]

_ScalarLike = Union[
    int,
    float,
    complex,
    str,
    bytes,
    np.generic,
]

# `_VoidLike` is technically not a scalar, but it's close enough
_VoidLike = Union[Tuple[Any, ...], np.void]

## Instruction:
Add `_BoolLike` to the union defining `_IntLike`
## Code After:
from typing import Union, Tuple, Any

import numpy as np

# NOTE: `_StrLike` and `_BytesLike` are pointless, as `np.str_` and `np.bytes_`
# are already subclasses of their builtin counterpart

_CharLike = Union[str, bytes]

# The 6 `<X>Like` type-aliases below represent all scalars that can be
# coerced into `<X>` (with the casting rule `same_kind`)
_BoolLike = Union[bool, np.bool_]
_IntLike = Union[_BoolLike, int, np.integer]
_FloatLike = Union[_IntLike, float, np.floating]
_ComplexLike = Union[_FloatLike, complex, np.complexfloating]
_NumberLike = Union[int, float, complex, np.number, np.bool_]

_ScalarLike = Union[
    int,
    float,
    complex,
    str,
    bytes,
    np.generic,
]

# `_VoidLike` is technically not a scalar, but it's close enough
_VoidLike = Union[Tuple[Any, ...], np.void]
