from typing import Union
import ast
from typing import Container
from typing import Tuple
from typing import Set
import itertools


def get_signature_params(
    node: Union[ast.FunctionDef, ast.AsyncFunctionDef],
    ignore: Container[str] = ("self", "cls"),
) -> Tuple[Set[str], bool]:
    """Get parameters in a function signature.

    Parameters
    ----------
    node : Union[ast.FunctionDef, ast.AsyncFunctionDef]
        An ast function node
    ignore : tuple
        Which parameter names to ignore (the default is ("self", "cls"),
        which don't need documenting)

    Returns
    -------
    signature_params : Set[str]
    ambiguous : bool
    """

    signature_params = {
        argument.arg
        for argument in itertools.chain(node.args.args, node.args.kwonlyargs)
        if argument.arg not in ignore
    }
    ambiguous = node.args.vararg is not None or node.args.kwarg is not None
    return signature_params, ambiguous