# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/99_misc.ipynb.

# %% auto 0
__all__ = ['isin', 'arein', 'isna', 'notna']

# %% ../nbs/99_misc.ipynb 4
from typing import TypeGuard
from typing import Any, Iterable

# %% ../nbs/99_misc.ipynb 5
from .atyp import pd, pdna
from .core import isiter, isnone, notnone
from .isnp import isnpnan
from .ispd import ispdna

# %% ../nbs/99_misc.ipynb 7
def isin(x, refs: Iterable) -> bool: return x in refs
def arein(x: Iterable, refs: Iterable) -> bool:
    return isiter(x) and isiter(refs) and all(isin(y, refs) for y in x)

def isna(x) -> TypeGuard[pdna]:
    if notnone(pd): return pd.isna(x)
    return isnone(x) or isnpnan(x) or ispdna(x)

def notna(x) -> TypeGuard[Any]:
    if notnone(pd): return pd.notna(x)
    return not isna(x)
