#NEWLINE# def run( self , files , all_ ) : #NEWLINE# #INDENT# reprounzip . common . record_usage ( download_files = len ( files ) ) #NEWLINE# output_files = { n : f . path for ( n , f ) in iteritems ( self . get_config ( ) . inputs_outputs ) if f . write_runs } #NEWLINE# if ( not ( all_ or files ) ) : #NEWLINE# #INDENT# print ( 'Output files:' ) #NEWLINE# for output_name in output_files : #NEWLINE# #INDENT# print ( ( '    %s' % output_name ) ) #NEWLINE# #UNINDENT# return #NEWLINE# #UNINDENT# resolved_files = [ ] #NEWLINE# all_files = set ( output_files ) #NEWLINE# for filespec in files : #NEWLINE# #INDENT# filespec_split = filespec . split ( ':' , 1 ) #NEWLINE# if ( len ( filespec_split ) == 1 ) : #NEWLINE# #INDENT# output_name = local_path = filespec #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( len ( filespec_split ) == 2 ) : #NEWLINE# #INDENT# ( output_name , local_path ) = filespec_split #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# logging . critical ( 'Invalid file specification: %r' , filespec ) #NEWLINE# sys . exit ( 1 ) #NEWLINE# #UNINDENT# #UNINDENT# local_path = ( Path ( local_path ) if local_path else None ) #NEWLINE# all_files . discard ( output_name ) #NEWLINE# resolved_files . append ( ( output_name , local_path ) ) #NEWLINE# #UNINDENT# if all_ : #NEWLINE# #INDENT# for output_name in all_files : #NEWLINE# #INDENT# resolved_files . append ( ( output_name , Path ( output_name ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# self . prepare_download ( resolved_files ) #NEWLINE# success = True #NEWLINE# try : #NEWLINE# #INDENT# for ( output_name , local_path ) in resolved_files : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# remote_path = output_files [ output_name ] #NEWLINE# #UNINDENT# except KeyError : #NEWLINE# #INDENT# logging . critical ( 'Invalid output file: %r' , output_name ) #NEWLINE# sys . exit ( 1 ) #NEWLINE# #UNINDENT# logging . debug ( 'Downloading file %s' , remote_path ) #NEWLINE# if ( local_path is None ) : #NEWLINE# #INDENT# ret = self . download_and_print ( remote_path ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# ret = self . download ( remote_path , local_path ) #NEWLINE# #UNINDENT# if ( ret is None ) : #NEWLINE# #INDENT# ret = True #NEWLINE# warnings . warn ( 'download() returned None instead of True/False, assuming True' , category = DeprecationWarning ) #NEWLINE# #UNINDENT# if ( not ret ) : #NEWLINE# #INDENT# success = False #NEWLINE# #UNINDENT# #UNINDENT# if ( not success ) : #NEWLINE# #INDENT# sys . exit ( 1 ) #NEWLINE# #UNINDENT# #UNINDENT# finally : #NEWLINE# #INDENT# self . finalize ( )