(sig)
return sig.replace(parameters=params)
Private helper to transform signatures for unbound
    functions to bound methods.
Private helper to transform signatures for unbound
    functions to bound methods.
Private helper to transform signatures for unbound functions to bound methods .
def _signature_bound_method(sig):
    """Private helper to transform signatures for unbound
    functions to bound methods.
    """

    params = tuple(sig.parameters.values())

    if not params or params[0].kind in (_VAR_KEYWORD, _KEYWORD_ONLY):
        raise ValueError('invalid method signature')

    kind = params[0].kind
    if kind in (_POSITIONAL_OR_KEYWORD, _POSITIONAL_ONLY):
        # Drop first parameter:
        # '(p1, p2[, ...])' -> '(p2[, ...])'
        params = params[1:]
    else:
        if kind is not _VAR_POSITIONAL:
            # Unless we add a new parameter type we never
            # get here
            raise ValueError('invalid argument type')
        # It's a var-positional parameter.
        # Do nothing. '(*args[, ...])' -> '(*args[, ...])'

    return sig.replace(parameters=params)
def _signature_bound_method ( sig ) : params = tuple ( sig . parameters . values ( ) ) if not params or params [ 0 ] . kind in ( _VAR_KEYWORD , _KEYWORD_ONLY ) : raise ValueError ( 'invalid method signature' ) kind = params [ 0 ] . kind if kind in ( _POSITIONAL_OR_KEYWORD , _POSITIONAL_ONLY ) : # Drop first parameter: # '(p1, p2[, ...])' -> '(p2[, ...])' params = params [ 1 : ] else : if kind is not _VAR_POSITIONAL : # Unless we add a new parameter type we never # get here raise ValueError ( 'invalid argument type' ) # It's a var-positional parameter. # Do nothing. '(*args[, ...])' -> '(*args[, ...])' return sig . replace ( parameters = params )