# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/00_atyp.ipynb.

# %% auto 0
__all__ = ['G', 'P', 'TypeLike', 'TypeDesc', 'GuardFunc', 'PathLike', 'sbytes', 'notsbytes', 'pdbindex', 'pdindexlike', 'npbool',
           'npnan', 'npNaN', 'npNAN', 'npmatrix', 'npndarray', 'pdna', 'pdindex', 'pdseries', 'pdcindex', 'dataframe',
           'sparr', 'spmtx', 'pttype', 'ptdevice', 'pttensor', 'ptdataset', 'ptdataloader', 'pldatamodule', 'cvvideo',
           'anndata']

# %% ../nbs/00_atyp.ipynb 4
from typing import Type, Union, Callable, ForwardRef, TypeVar, ParamSpec, TypeGuard, TypeAlias

# %% ../nbs/00_atyp.ipynb 6
G = TypeVar('G')
P = ParamSpec('P')

TypeLike:  TypeAlias = Union[Type, TypeAlias, Type[G]]
TypeDesc: TypeAlias = Callable[[TypeLike], str]
GuardFunc: TypeAlias = Callable[P, TypeGuard[TypeLike]]

# %% ../nbs/00_atyp.ipynb 8
try: import os, pathlib
except ImportError: ...

PathLike: TypeAlias = Union[str, pathlib.Path, os.PathLike]

# %% ../nbs/00_atyp.ipynb 11
try: from atyp import (StrBytes, NotStrBytes)
except ImportError: StrBytes, NotStrBytes = type, type
    
sbytes: TypeAlias  = ForwardRef('StrBytes', module='atyp', is_class=True)
notsbytes: TypeAlias  = ForwardRef('NotStrBytes', module='atyp', is_class=True)

# %% ../nbs/00_atyp.ipynb 13
try: from atyp import (BoolIndex, IndexLike)
except ImportError: BoolIndex, IndexLike = list, list

pdbindex: TypeAlias  = ForwardRef('BoolIndex', module='atyp', is_class=True)
pdindexlike: TypeAlias  = ForwardRef('IndexLike', module='atyp', is_class=True)

# %% ../nbs/00_atyp.ipynb 15
try: from numpy import bool_
except ImportError: bool_ = bool

npbool: TypeAlias = ForwardRef('np.bool_', module='numpy', is_class=True)

# %% ../nbs/00_atyp.ipynb 16
try: from numpy import (nan, NaN, NAN)
except ImportError: nan, NaN, NAN = None, None, None

npnan: TypeAlias = ForwardRef('np.nan', module='numpy', is_class=False)
npNaN: TypeAlias = ForwardRef('np.NaN', module='numpy', is_class=False)
npNAN: TypeAlias = ForwardRef('np.NAN', module='numpy', is_class=False)

# %% ../nbs/00_atyp.ipynb 17
try: from numpy import (matrix, ndarray)
except ImportError: matrix, ndarray = list, list

npmatrix: TypeAlias   = ForwardRef('np.matrix',  module='numpy', is_class=True)
npndarray: TypeAlias  = ForwardRef('np.ndarray', module='numpy', is_class=True)

# %% ../nbs/00_atyp.ipynb 19
try: import pandas as pd
except ImportError: pd = None

# %% ../nbs/00_atyp.ipynb 20
try: from pandas import (NA)
except ImportError: 
    NA = None

pdna: TypeAlias = ForwardRef('pd.NA', module='pandas')

# %% ../nbs/00_atyp.ipynb 21
try: from pandas import (Index, Series, CategoricalIndex, DataFrame)
except ImportError: Index, Series, CategoricalIndex, DataFrame = list, list, list, list

pdindex: TypeAlias   = ForwardRef('pd.Index',     module='pandas', is_class=True)
pdseries: TypeAlias  = ForwardRef('pd.Series',    module='pandas', is_class=True)
pdcindex: TypeAlias  = ForwardRef('pd.CategoricalIndex', module='pandas', is_class=True)
dataframe: TypeAlias = ForwardRef('pd.DataFrame', module='pandas', is_class=True)

# %% ../nbs/00_atyp.ipynb 23
try: from scipy.sparse import sparray, spmatrix
except ImportError: sparray, spmatrix = list, list

sparr: TypeAlias = ForwardRef('sp.sparse.sparray',  module='scipy.sparse', is_class=True)
spmtx: TypeAlias = ForwardRef('sp.sparse.spmatrix', module='scipy.sparse', is_class=True)

# %% ../nbs/00_atyp.ipynb 25
try: from torch import dtype, device, Tensor
except ImportError: dtype, device, Tensor = type, str, list
    
pttype: TypeAlias = ForwardRef('torch.dtype', module='torch', is_class=True)
ptdevice: TypeAlias = ForwardRef('torch.device', module='torch', is_class=True)
pttensor: TypeAlias = ForwardRef('torch.Tensor', module='torch', is_class=True)

# %% ../nbs/00_atyp.ipynb 26
try: from torch.utils.data import (Dataset, DataLoader)    
except ImportError: Dataset, DataLoader = list, list

ptdataset = ForwardRef('torch.utils.data.Dataset', module='torch.utils.data', is_class=True)
ptdataloader = ForwardRef('torch.utils.data.DataLoader', module='torch.utils.data', is_class=True)

# %% ../nbs/00_atyp.ipynb 28
try: from pytorch_lightning import (LightningDataModule as DataModule)
except ImportError: DataModule = list
    
pldatamodule = ForwardRef('pytorch_lightning.LightningDataModule', module='pytorch_lightning', is_class=True)

# %% ../nbs/00_atyp.ipynb 30
try: from cv2 import VideoCapture
except ImportError: VideoCapture = type    

cvvideo: TypeAlias = ForwardRef('cv2.VideoCapture', module='cv2', is_class=True)

# %% ../nbs/00_atyp.ipynb 32
try: from anndata import AnnData
except ImportError: AnnData = list

anndata: TypeAlias = ForwardRef('ad.AnnData', module='anndata', is_class=True)
