# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/03_types.ipynb.

# %% auto 0
__all__ = ['Series', 'ndarray', 'NPArray', 'DataFrame', 'DataFrames', 'Numeric', 'Bool', 'Boolish', 'IndexLike', 'SeriesLike',
           'IterLike', 'GroupKey', 'PathType', 'PathLike', 'SplitTuple2', 'SplitTuple3', 'SplitAsList',
           'DatasetSplitSpec', 'SplitDataset2Idxs', 'SplitDataset3Idxs', 'SplitDataFrames2', 'SplitDataFrames3',
           'SplitDatasets', 'ColorMap', 'TreeEntryFunc', 'RichTree', 'RichText', 'RichConsole', 'RichProgress',
           'TrainValidSplit', 'TrainTestSplit', 'TrainValidTestSplit', 'DirectoryTreeStrings']

# %% ../nbs/03_types.ipynb 5
from typing import (Tuple, Union, TypeAlias, List, Iterable, Literal, Any)
from numbers import Number

# %% ../nbs/03_types.ipynb 6
import numpy as np, pandas as pd
import pathlib

# %% ../nbs/03_types.ipynb 9
try:
    import torch
    Tensor: TypeAlias = torch.Tensor
    Device: TypeAlias = torch.device
except ImportError:
    # Define a placeholder type if torch is not installed
    Tensor: TypeAlias = Union[Iterable[Number], Any]
    Device: TypeAlias = Union[str, None, Any]
    pass

# %% ../nbs/03_types.ipynb 11
try:
    import anndata as ad    
    AnnData: TypeAlias = ad.AnnData
    AnnDatas: TypeAlias = List[AnnData]
except ImportError:
    # Define a placeholder type if torch is not installed
    AnnData: TypeAlias = Any
    AnnDatas: TypeAlias = List[AnnData]
    pass

# %% ../nbs/03_types.ipynb 12
Series: TypeAlias = pd.Series

ndarray: TypeAlias = np.ndarray

NPArray: TypeAlias = np.ndarray

DataFrame: TypeAlias = pd.DataFrame

DataFrames: TypeAlias = List[DataFrame]

# %% ../nbs/03_types.ipynb 13
Numeric: TypeAlias = Union[int, float, complex, Number]

Bool: TypeAlias = Union[bool, np.bool_]

Boolish: TypeAlias = Union[Bool, Literal[0], Literal[1]]

IndexLike: TypeAlias = Union[List[int], List[Boolish], pd.Index]

SeriesLike: TypeAlias = Union[list, Series, ndarray, Tensor, IndexLike]

IterLike: TypeAlias = Union[Iterable, SeriesLike, IndexLike]

GroupKey: TypeAlias = Union[str, int, float, Tuple]

PathType: TypeAlias = Union[pathlib.Path, pathlib.PosixPath]

PathLike: TypeAlias = Union[str, PathType]

# %% ../nbs/03_types.ipynb 15
from typing import (NamedTuple)

# %% ../nbs/03_types.ipynb 17
class TrainValidSplit(NamedTuple):
    train: int
    valid: int

class TrainTestSplit(NamedTuple):
    train: int
    test: int
        
class TrainValidTestSplit(NamedTuple):
    train: int
    valid: int
    test: int

# %% ../nbs/03_types.ipynb 18
SplitTuple2: TypeAlias =  Tuple[Number, Number]
SplitTuple3: TypeAlias =  Tuple[Number, Number, Number]
SplitAsList: TypeAlias =  List[Number]
  
DatasetSplitSpec: TypeAlias = Union[
    TrainValidSplit, TrainTestSplit, TrainValidTestSplit,
    SplitAsList, SplitTuple2, SplitTuple3
]

# %% ../nbs/03_types.ipynb 19
SplitDataset2Idxs: TypeAlias = Tuple[IndexLike, IndexLike]
SplitDataset3Idxs: TypeAlias = Tuple[IndexLike, IndexLike, IndexLike]

SplitDataFrames2: TypeAlias = Tuple[DataFrame, DataFrame]
SplitDataFrames3: TypeAlias = Tuple[DataFrame, DataFrame, DataFrame]

SplitDatasets: TypeAlias = Union[
    SplitDataset2Idxs, SplitDataset3Idxs,
    SplitDataFrames2, SplitDataFrames3,
]

# %% ../nbs/03_types.ipynb 21
from typing import TypeAlias
from matplotlib.colors import Colormap

# %% ../nbs/03_types.ipynb 22
ColorMap: TypeAlias = Colormap

# %% ../nbs/03_types.ipynb 24
from typing import Optional, ClassVar, TypeAlias, Callable
from enum import StrEnum

# %% ../nbs/03_types.ipynb 25
class DirectoryTreeStrings(StrEnum):
    SPACE : ClassVar[str] = '    '
    BRANCH: ClassVar[str] = '│   '    
    TEE   : ClassVar[str] = '├── '
    LAST  : ClassVar[str] = '└── '

# %% ../nbs/03_types.ipynb 26
TreeEntryFunc: TypeAlias = Callable[
    ['PathLike', Optional[str], Optional[str], Optional[str]], str
]

# %% ../nbs/03_types.ipynb 28
from typing import Any, TypeAlias

# %% ../nbs/03_types.ipynb 29
try:
    from rich.tree import Tree as TreeType
    from rich.text import Text as TextType
    from rich.console import Console as ConsoleType
    from rich.progress import Progress as ProgressType
    
except ImportError:
    TreeType = TextType = ConsoleType = ProgressType = Any

RichTree: TypeAlias = TreeType
RichText: TypeAlias = TextType
RichConsole: TypeAlias = ConsoleType
RichProgress: TypeAlias = ProgressType
