<s> import copy <EOL> from django . utils . functional import empty <EOL> from django . utils . functional import LazyObject <EOL> from django . utils . functional import SimpleLazyObject <EOL> class LazySettings ( LazyObject ) : <EOL> def _setup ( self , name = None ) : <EOL> from django . conf import settings <EOL> from horizon . conf . default import HORIZON_CONFIG as DEFAULT_CONFIG <EOL> HORIZON_CONFIG = copy . copy ( DEFAULT_CONFIG ) <EOL> HORIZON_CONFIG . update ( settings . HORIZON_CONFIG ) <EOL> for exc_category in [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] : <EOL> if exc_category not in HORIZON_CONFIG [ '<STR_LIT>' ] : <EOL> default_exc_config = DEFAULT_CONFIG [ '<STR_LIT>' ] [ exc_category ] <EOL> HORIZON_CONFIG [ '<STR_LIT>' ] [ exc_category ] = default_exc_config <EOL> if '<STR_LIT>' not in HORIZON_CONFIG [ '<STR_LIT>' ] : <EOL> default_pw_regex = DEFAULT_CONFIG [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> HORIZON_CONFIG [ '<STR_LIT>' ] [ '<STR_LIT>' ] = default_pw_regex <EOL> if '<STR_LIT>' not in HORIZON_CONFIG [ '<STR_LIT>' ] : <EOL> default_pw_help = DEFAULT_CONFIG [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> HORIZON_CONFIG [ '<STR_LIT>' ] [ '<STR_LIT>' ] = default_pw_help <EOL> self . _wrapped = HORIZON_CONFIG <EOL> def __getitem__ ( self , name , fallback = None ) : <EOL> if self . _wrapped is empty : <EOL> self . _setup ( name ) <EOL> return self . _wrapped . get ( name , fallback ) <EOL> def get_webroot ( ) : <EOL> from django . conf import settings <EOL> return settings . WEBROOT <EOL> HORIZON_CONFIG = LazySettings ( ) <EOL> WEBROOT = SimpleLazyObject ( get_webroot ) </s>
