(args, varargs=None, varkw=None, defaults=None,
                  kwonlyargs=(), kwonlydefaults={}, annotations={},
                  formatarg=str,
                  formatvarargs=lambda name: '*' + name,
                  formatvarkw=lambda name: '**' + name,
                  formatvalue=lambda value: '=' + repr(value),
                  formatreturns=lambda text: ' -> ' + text,
                  formatannotation=formatannotation)
return result
Format an argument spec from the values returned by getfullargspec.

    The first seven arguments are (args, varargs, varkw, defaults,
    kwonlyargs, kwonlydefaults, annotations).  The other five arguments
    are the corresponding optional formatting functions that are called to
    turn names and values into strings.  The last argument is an optional
    function to format the sequence of arguments.

    Deprecated since Python 3.5: use the `signature` function and `Signature`
    objects.
Format an argument spec from the values returned by getfullargspec.
Format an argument spec from the values returned by getfullargspec .
def formatargspec(args, varargs=None, varkw=None, defaults=None,
                  kwonlyargs=(), kwonlydefaults={}, annotations={},
                  formatarg=str,
                  formatvarargs=lambda name: '*' + name,
                  formatvarkw=lambda name: '**' + name,
                  formatvalue=lambda value: '=' + repr(value),
                  formatreturns=lambda text: ' -> ' + text,
                  formatannotation=formatannotation):
    """Format an argument spec from the values returned by getfullargspec.

    The first seven arguments are (args, varargs, varkw, defaults,
    kwonlyargs, kwonlydefaults, annotations).  The other five arguments
    are the corresponding optional formatting functions that are called to
    turn names and values into strings.  The last argument is an optional
    function to format the sequence of arguments.

    Deprecated since Python 3.5: use the `signature` function and `Signature`
    objects.
    """

    from warnings import warn

    warn("`formatargspec` is deprecated since Python 3.5. Use `signature` and "
         "the `Signature` object directly",
         DeprecationWarning,
         stacklevel=2)

    def formatargandannotation(arg):
        result = formatarg(arg)
        if arg in annotations:
            result += ': ' + formatannotation(annotations[arg])
        return result
    specs = []
    if defaults:
        firstdefault = len(args) - len(defaults)
    for i, arg in enumerate(args):
        spec = formatargandannotation(arg)
        if defaults and i >= firstdefault:
            spec = spec + formatvalue(defaults[i - firstdefault])
        specs.append(spec)
    if varargs is not None:
        specs.append(formatvarargs(formatargandannotation(varargs)))
    else:
        if kwonlyargs:
            specs.append('*')
    if kwonlyargs:
        for kwonlyarg in kwonlyargs:
            spec = formatargandannotation(kwonlyarg)
            if kwonlydefaults and kwonlyarg in kwonlydefaults:
                spec += formatvalue(kwonlydefaults[kwonlyarg])
            specs.append(spec)
    if varkw is not None:
        specs.append(formatvarkw(formatargandannotation(varkw)))
    result = '(' + ', '.join(specs) + ')'
    if 'return' in annotations:
        result += formatreturns(formatannotation(annotations['return']))
    return result
def formatargspec ( args , varargs = None , varkw = None , defaults = None , kwonlyargs = ( ) , kwonlydefaults = { } , annotations = { } , formatarg = str , formatvarargs = lambda name : '*' + name , formatvarkw = lambda name : '**' + name , formatvalue = lambda value : '=' + repr ( value ) , formatreturns = lambda text : ' -> ' + text , formatannotation = formatannotation ) : from warnings import warn warn ( "`formatargspec` is deprecated since Python 3.5. Use `signature` and " "the `Signature` object directly" , DeprecationWarning , stacklevel = 2 ) def formatargandannotation ( arg ) : result = formatarg ( arg ) if arg in annotations : result += ': ' + formatannotation ( annotations [ arg ] ) return result specs = [ ] if defaults : firstdefault = len ( args ) - len ( defaults ) for i , arg in enumerate ( args ) : spec = formatargandannotation ( arg ) if defaults and i >= firstdefault : spec = spec + formatvalue ( defaults [ i - firstdefault ] ) specs . append ( spec ) if varargs is not None : specs . append ( formatvarargs ( formatargandannotation ( varargs ) ) ) else : if kwonlyargs : specs . append ( '*' ) if kwonlyargs : for kwonlyarg in kwonlyargs : spec = formatargandannotation ( kwonlyarg ) if kwonlydefaults and kwonlyarg in kwonlydefaults : spec += formatvalue ( kwonlydefaults [ kwonlyarg ] ) specs . append ( spec ) if varkw is not None : specs . append ( formatvarkw ( formatargandannotation ( varkw ) ) ) result = '(' + ', ' . join ( specs ) + ')' if 'return' in annotations : result += formatreturns ( formatannotation ( annotations [ 'return' ] ) ) return result