#NEWLINE# def lookup( self , uri = None , uris = None ) : #NEWLINE# #INDENT# '\n        Lookup the given URIs.\n\n        If the URI expands to multiple tracks, the returned list will contain\n        them all.\n\n        :param uri: track URI\n        :type uri: string or :class:`None`\n        :param uris: track URIs\n        :type uris: list of string or :class:`None`\n        :rtype: list of :class:`mopidy.models.Track` if uri was set or\n            {uri: list of :class:`mopidy.models.Track`} if uris was set.\n\n        .. versionadded:: 1.0\n            The ``uris`` argument.\n\n        .. deprecated:: 1.0\n            The ``uri`` argument. Use ``uris`` instead.\n        ' #NEWLINE# if ( sum ( ( ( o is not None ) for o in [ uri , uris ] ) ) != 1 ) : #NEWLINE# #INDENT# raise ValueError ( 'Exactly one of "uri" or "uris" must be set' ) #NEWLINE# #UNINDENT# ( ( uris is None ) or validation . check_uris ( uris ) ) #NEWLINE# ( ( uri is None ) or validation . check_uri ( uri ) ) #NEWLINE# if uri : #NEWLINE# #INDENT# deprecation . warn ( 'core.library.lookup:uri_arg' ) #NEWLINE# #UNINDENT# if ( uri is not None ) : #NEWLINE# #INDENT# uris = [ uri ] #NEWLINE# #UNINDENT# futures = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# results = { u : [ ] for u in uris } #NEWLINE# for ( backend , backend_uris ) in self . _get_backends_to_uris ( uris ) . items ( ) : #NEWLINE# #INDENT# for u in backend_uris : #NEWLINE# #INDENT# futures [ ( backend , u ) ] = backend . library . lookup ( u ) #NEWLINE# #UNINDENT# #UNINDENT# for ( ( backend , u ) , future ) in futures . items ( ) : #NEWLINE# #INDENT# with _backend_error_handling ( backend ) : #NEWLINE# #INDENT# result = future . get ( ) #NEWLINE# if ( result is not None ) : #NEWLINE# #INDENT# validation . check_instances ( result , models . Track ) #NEWLINE# results [ u ] = [ r for r in result if r . uri ] #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if uri : #NEWLINE# #INDENT# return results [ uri ] #NEWLINE# #UNINDENT# return results