<s> from couchdbkit import ResourceNotFound <EOL> from django . conf import settings <EOL> from corehq . util . quickcache import quickcache <EOL> from dimagi . utils . couch . database import get_db <EOL> @ quickcache ( [ ] , timeout = <NUM_LIT> ) <EOL> def get_indicator_config ( ) : <EOL> try : <EOL> doc = get_db ( ) . open_doc ( '<STR_LIT>' ) <EOL> except ResourceNotFound : <EOL> return { } <EOL> else : <EOL> return doc . get ( '<STR_LIT>' , { } ) <EOL> def get_namespaces ( domain , as_choices = False ) : <EOL> available_namespaces = get_indicator_config ( ) <EOL> if as_choices : <EOL> return available_namespaces . get ( domain , ( ) ) <EOL> else : <EOL> return [ n [ <NUM_LIT:0> ] for n in available_namespaces . get ( domain , [ ] ) ] <EOL> def get_namespace_name ( domain , namespace ) : <EOL> namespaces = get_namespaces ( domain , as_choices = True ) <EOL> namespaces = dict ( namespaces ) <EOL> return namespaces . get ( namespace ) <EOL> def get_indicator_domains ( ) : <EOL> return get_indicator_config ( ) . keys ( ) <EOL> def get_mvp_domains ( ) : <EOL> from mvp . models import MVP <EOL> if settings . UNIT_TESTING : <EOL> return MVP . DOMAINS <EOL> return get_indicator_domains ( ) or MVP . DOMAINS </s>
