def mock_ssh_file(host, path, contents):
 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

def mock_ssh_file ( host , path , contents ) : 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
create a directory at path relative to the temp directory for host .