def _inject_args(sig, types):
    """A function to inject arguments manually into a method signature before
    it's been parsed. If using keyword arguments use 'kw=type' instead in
    the types array.

        sig         the string signature
        types       a list of types to be inserted

    Returns the altered signature.
    """
    if '(' in sig:
        parts = sig.split('(')
        sig = '{0}({1}{2}{3}'.format(
            parts[0], ', '.join(types),
            (', ' if parts[1].index(')') > 0 else ''), parts[1]
        )
    else:
        sig = '{0}({1})'.format(sig, ', '.join(types))
    return sig
dataset/ETHPy150Open cenobites/flask-jsonrpc/flask_jsonrpc/__init__.py/_inject_args/original