<s> """<STR_LIT>""" <EOL> import sys <EOL> from carrot . utils import rpartition <EOL> DEFAULT_BACKEND = "<STR_LIT>" <EOL> BACKEND_ALIASES = { <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> } <EOL> _backend_cache = { } <EOL> def resolve_backend ( backend = None ) : <EOL> backend = BACKEND_ALIASES . get ( backend , backend ) <EOL> backend_module_name , _ , backend_cls_name = rpartition ( backend , "<STR_LIT:.>" ) <EOL> return backend_module_name , backend_cls_name <EOL> def _get_backend_cls ( backend = None ) : <EOL> backend_module_name , backend_cls_name = resolve_backend ( backend ) <EOL> __import__ ( backend_module_name ) <EOL> backend_module = sys . modules [ backend_module_name ] <EOL> return getattr ( backend_module , backend_cls_name ) <EOL> def get_backend_cls ( backend = None ) : <EOL> """<STR_LIT>""" <EOL> backend = backend or DEFAULT_BACKEND <EOL> if backend not in _backend_cache : <EOL> _backend_cache [ backend ] = _get_backend_cls ( backend ) <EOL> return _backend_cache [ backend ] </s>
