#NEWLINE# def download( self , container = None , objects = None , options = None ) : #NEWLINE# #INDENT# "\n        Download operations on an account, optional container and optional list\n        of objects.\n\n        :param container: The container to download from.\n        :param objects: A list of object names to download (a list of strings).\n        :param options: A dictionary containing options to override the global\n                        options specified during the service object creation::\n\n                            {\n                                'yes_all': False,\n                                'marker': '',\n                                'prefix': None,\n                                'no_download': False,\n                                'header': [],\n                                'skip_identical': False,\n                                'out_directory': None,\n                                'out_file': None,\n                                'remove_prefix': False,\n                                'shuffle' : False\n                            }\n\n        :returns: A generator for returning the results of the download\n                  operations. Each result yielded from the generator is a\n                  'download_object' dictionary containing the results of an\n                  individual file download.\n\n        :raises: ClientException\n        :raises: SwiftError\n        " #NEWLINE# if ( options is not None ) : #NEWLINE# #INDENT# options = dict ( self . _options , ** options ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# options = self . _options #NEWLINE# #UNINDENT# if ( not container ) : #NEWLINE# #INDENT# if options [ 'yes_all' ] : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# options_copy = deepcopy ( options ) #NEWLINE# options_copy [ 'long' ] = False #NEWLINE# for part in self . list ( options = options_copy ) : #NEWLINE# #INDENT# if part [ 'success' ] : #NEWLINE# #INDENT# containers = [ i [ 'name' ] for i in part [ 'listing' ] ] #NEWLINE# if options [ 'shuffle' ] : #NEWLINE# #INDENT# shuffle ( containers ) #NEWLINE# #UNINDENT# for con in containers : #NEWLINE# #INDENT# for res in self . _download_container ( con , options_copy ) : #NEWLINE# #INDENT# ( yield res ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# raise part [ 'error' ] #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# except ClientException as err : #NEWLINE# #INDENT# if ( err . http_status != 404 ) : #NEWLINE# #INDENT# raise #NEWLINE# #UNINDENT# raise SwiftError ( 'Account not found' , exc = err ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( objects is None ) : #NEWLINE# #INDENT# if ( '/' in container ) : #NEWLINE# #INDENT# raise SwiftError ( "'/' in container name" , container = container ) #NEWLINE# #UNINDENT# for res in self . _download_container ( container , options ) : #NEWLINE# #INDENT# ( yield res ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( '/' in container ) : #NEWLINE# #INDENT# raise SwiftError ( "'/' in container name" , container = container ) #NEWLINE# #UNINDENT# if ( options [ 'out_file' ] and ( len ( objects ) > 1 ) ) : #NEWLINE# #INDENT# options [ 'out_file' ] = None #NEWLINE# #UNINDENT# o_downs = [ self . thread_manager . object_dd_pool . submit ( o_down . _download_object_job , container , obj , options ) for obj in objects ] #NEWLINE# for o_down in interruptable_as_completed ( o_downs ) : #NEWLINE# #INDENT# ( yield o_down . result ( ) )