#NEWLINE# def get_resolver( order = None , options = None , modules = None ) : #NEWLINE# #INDENT# "Return a location resolver.  The *order* argument, if given,\n    should be a list of resolver names; results from resolvers named\n    earlier in the list are preferred over later ones.  For a list of\n    built-in resolver names, see :doc:`/resolvers`.  The *options*\n    argument can be used to pass configuration options to individual\n    resolvers, in the form of a dictionary mapping resolver names to\n    keyword arguments::\n\n        {'geocode': {'max_distance': 50}}\n\n    The *modules* argument can be used to specify a list of additional\n    modules to look for resolvers in.  See :doc:`/develop` for details.\n    " #NEWLINE# if ( not known_resolvers ) : #NEWLINE# #INDENT# from . import resolvers as carmen_resolvers #NEWLINE# modules = ( [ carmen_resolvers ] + ( modules or [ ] ) ) #NEWLINE# for module in order : #NEWLINE# #INDENT# for ( loader , name , _ ) in pkgutil . iter_modules ( module . __path__ ) : #NEWLINE# #INDENT# full_name = ( ( module . __name__ + '.' ) + name ) #NEWLINE# loader . find_module ( name ) . load_module ( full_name ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if ( order is None ) : #NEWLINE# #INDENT# order = ( 'place' , 'geocode' , 'profile' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# order = tuple ( order ) #NEWLINE# #UNINDENT# if ( options is None ) : #NEWLINE# #INDENT# options = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# resolvers = [ ] #NEWLINE# for resolver_name in order : #NEWLINE# #INDENT# if ( resolver_name not in known_resolvers ) : #NEWLINE# #INDENT# raise ValueError ( ( 'unknown resolver name "%s"' % resolver_name ) ) #NEWLINE# #UNINDENT# resolvers . append ( ( resolver_name , known_resolvers [ resolver_name ] ( ** options . get ( resolver_name , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) ) ) ) #NEWLINE# #UNINDENT# return ResolverCollection ( resolvers )