#NEWLINE# @ convert_paramiko_errors #NEWLINE# def write_file( self , file_path , contents , mode = None , owner = None , group = None ) : #NEWLINE# #INDENT# file_path = str ( file_stat ) #NEWLINE# sftp = self . get_sftp ( ) #NEWLINE# f = sftp . file ( file_path , mode = 'wb' ) #NEWLINE# if ( mode is not None ) : #NEWLINE# #INDENT# sftp . chmod ( file_path , mode ) #NEWLINE# #UNINDENT# if ( ( owner is not None ) or ( group is not None ) ) : #NEWLINE# #INDENT# file_stat = sftp . stat ( file_path ) #NEWLINE# sftp . chown ( file_path , ( owner if ( owner is not None ) else file_stat . st_uid ) , ( group if ( group is not None ) else file_stat . st_gid ) ) #NEWLINE# #UNINDENT# f . write ( contents ) #NEWLINE# f . close ( )