# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/01_core.ipynb.

# %% auto 0
__all__ = ['isclass', 'iscls', 'isint', 'isstr', 'isset', 'isnum', 'isbool', 'iscall', 'isdict', 'islist', 'isiter', 'isnone',
           'notnone', 'isany', 'istype', 'istuple', 'istup', 'isslice', 'isslc', 'isrange', 'isrng', 'isbytes']

# %% ../nbs/01_core.ipynb 4
import inspect
from numbers import Number
from typing import TypeGuard

from typing import Any, Type, Callable, Iterable

# %% ../nbs/01_core.ipynb 6
def isclass(x: Type) -> TypeGuard[Type]:
    '''Check if `x` is a `class`.
    
    See Also
    --------
    iscls : Alias for `isclass`.
    '''
    return inspect.isclass(x)

def iscls(x: Type) -> TypeGuard[Type]:
    '''Check if `x` is a `class`.
    
    See Also
    --------
    isclass : Check if `x` is a `class`.
    '''
    return isclass(x)

def isint(x) -> TypeGuard[int]:
    '''Check if `x` is an `int`.'''
    return isinstance(x, int)

def isstr(x) -> TypeGuard[str]:
    '''Check if `x` is an `str`.'''
    return isinstance(x, str)

def isset(x) -> TypeGuard[set]:
    '''Check if `x` is a `set`.'''
    return isinstance(x, set)

def isnum(x) -> TypeGuard[Number]: 
    '''Check if `x` is a `Number`.'''
    return isinstance(x, Number)

# %% ../nbs/01_core.ipynb 7
def isbool(x) -> TypeGuard[bool]:
    '''Check if `x` is `bool`.'''
    return isinstance(x, bool)

def iscall(x) -> TypeGuard[Callable]:
    '''Check if `x` is `Callable`.'''
    return isinstance(x, Callable)

def isdict(x) -> TypeGuard[dict]:
    '''Check if `x` is a `dict`.'''
    return isinstance(x, dict)

def islist(x) -> TypeGuard[list]:
    '''Check if `x` is a `list`.'''
    return isinstance(x, list)

def isiter(x) -> TypeGuard[Iterable]:
    '''Check if `x` is an `Iterable`.'''
    return isinstance(x, Iterable)

def isnone(x) -> TypeGuard[None]:
    '''Check if `x` is `None`.'''
    return x is None

def notnone(x) -> TypeGuard[Any]:
    '''Check if `x` is not `None`.
    
    See Also
    --------
    isany : alias for `notnone`.
    '''
    return not isnone(x)

def isany(x) -> TypeGuard[Any]:
    '''Check if `x` is not `None`.
    
    See Also
    --------
    notnone : alias for `isany`.
    '''
    return notnone(x)


def istype(x) -> TypeGuard[type]:
    '''Check if `x` is `type`.'''
    return isinstance(x, type)


# %% ../nbs/01_core.ipynb 8
def istuple(x) -> TypeGuard[tuple]:
    '''Check if `x` is an `tuple`.
    
    See Also
    --------
    istup : alias for `istuple`.
    '''
    return isinstance(x, tuple)

def istup(x) -> TypeGuard[tuple]:
    '''Check if `x` is an `tuple`.
    
    See Also
    --------
    istuple : alias for `istup`.
    '''
    return istuple(x)

# %% ../nbs/01_core.ipynb 9
def isslice(x) -> TypeGuard[slice]:
    '''Check if `x` is an `slice`.
    
    See Also
    --------
    isslc : alias for `isslice`.
    '''
    return isinstance(x, slice)

def isslc(x) -> TypeGuard[slice]:
    '''Check if `x` is an `slice`.
    
    See Also
    --------
    isslice : alias for `isslc`.
    '''
    return isslice(x)

# %% ../nbs/01_core.ipynb 10
def isrange(x) -> TypeGuard[range]:
    '''Check if `x` is a `range`.
    
    See Also
    --------
    isrng : alias for `isrange`.
    '''
    return isinstance(x, range)

def isrng(x) -> TypeGuard[range]:
    '''Check if `x` is a `range`.
    
    See Also
    --------
    isrange : alias for `isrng`.
    '''
    return isrange(x)

# %% ../nbs/01_core.ipynb 11
def isbytes(x) -> TypeGuard[bytes]:
    '''Check if `x` is an `bytes`.'''
    return isinstance(x, bytes)
