# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/13_call.ipynb.

# %% auto 0
__all__ = ['isattrcall', 'iscallattr', 'hasget', 'haskeys']

# %% ../nbs/13_call.ipynb 4
from typing import TypeGuard
from typing import Callable

# %% ../nbs/13_call.ipynb 5
from .core import iscall
from .atyp import GuardFunc

# %% ../nbs/13_call.ipynb 7
def isattrcall(attr: str) -> GuardFunc:
    '''Checks if the attribute of the object is a callable'''
    def decorator(obj) -> GuardFunc:
        return iscall(getattr(obj, attr, None))
    return decorator

def iscallattr(obj, attr: str) -> TypeGuard[Callable]:
    '''Checks if `obj.attr` is a callable'''
    return isattrcall(attr)(obj)

# %% ../nbs/13_call.ipynb 8
def hasget(obj) -> TypeGuard[Callable]:
    '''Checks if `obj.get` is a callable'''
    return iscallattr(obj, 'get')

def haskeys(obj) -> TypeGuard[Callable]: 
    '''Checks if `obj.keys` is a callable'''
    return iscallattr(obj, 'keys')
