def make_cmd_invocation(invocation, args, kwargs):
    """
    >>> make_cmd_invocation('path/program', ['arg1', 'arg2'], {'darg': 4})
    ['./giotto-cmd', '/path/program/arg1/arg2/', '--darg=4']
    """
    if not invocation.endswith('/'):
        invocation += '/'
    if not invocation.startswith('/'):
        invocation = '/' + invocation

    cmd = invocation

    for arg in args:
        cmd += str(arg) + "/"

    rendered_kwargs = []
    for k, v in kwargs.items():
        rendered_kwargs.append("--%s=%s" % (k,v))
    
    return ['./giotto-cmd', cmd] + rendered_kwargs
dataset/ETHPy150Open priestc/giotto/giotto/controllers/cmd.py/make_cmd_invocation/original