def _create_argument_value_pairs(func, *args, **kwargs):
    """
    Create dictionary with argument names as keys and their passed values as values.

    An empty dictionary is returned if an error is detected, such as more
    arguments than in the function definition, argument(s) defined by position
    and keyword, etc.
    """
    # Capture parameters that have been explicitly specified in function call
    try:
        arg_dict = signature(func).bind_partial(*args, **kwargs).arguments
    except TypeError:
        return dict()
    # Capture parameters that have not been explicitly specified
    # but have default values
    arguments = signature(func).parameters
    for arg_name in arguments:
        if (arguments[arg_name].default != Parameter.empty) and (
            arguments[arg_name].name not in arg_dict
        ):
            arg_dict[arguments[arg_name].name] = arguments[arg_name].default
    return arg_dict
def _create_argument_value_pairs ( func , * args , ** kwargs ) : try : arg_dict = signature ( func ) . bind_partial ( * args , ** kwargs ) . arguments except TypeError : return dict ( ) arguments = signature ( func ) . parameters for arg_name in arguments : if ( arguments [ arg_name ] . default != Parameter . empty ) and ( arguments [ arg_name ] . name not in arg_dict ) : arg_dict [ arguments [ arg_name ] . name ] = arguments [ arg_name ] . default return arg_dict
Create dictionary with argument names as keys and their passed values as values.

    An empty dictionary is returned if an error is detected, such as more
    arguments than in the function definition, argument(s) defined by position
    and keyword, etc.