

def mock_ssh_file(host, path, contents):
    'Create a directory at ``path`` relative to the temp directory for\n    ``host``, where ``path`` is a POSIX path.\n\n    Returns the path of the resulting file on the filesystem for sanity\n    checking.\n    '
    if (not isinstance(contents, bytes)):
        raise TypeError('mock SSH file contents must be bytes')
    path = rel_posix_to_abs_local(host, path)
    (basename, name) = os.path.split(path)
    if (not os.path.exists(basename)):
        os.makedirs(basename)
    with open(path, 'wb') as f:
        f.write(contents)
    return path

dataset/ETHPy150Open Yelp/mrjob/tests/mockssh.py mock_ssh_file/original