<s> import six <EOL> from django . conf import settings as django_settings <EOL> from django . utils . functional import LazyObject <EOL> from inline_media . conf import defaults as app_settings <EOL> class LazySettings ( LazyObject ) : <EOL> def _setup ( self ) : <EOL> self . _wrapped = Settings ( app_settings , django_settings ) <EOL> def update_dict_in_depth ( a , b ) : <EOL> """<STR_LIT>""" <EOL> for k , v in six . iteritems ( b ) : <EOL> if a . get ( k , None ) and type ( v ) == dict : <EOL> update_dict_in_depth ( a [ k ] , v ) <EOL> else : <EOL> a [ k ] = v <EOL> class Settings ( object ) : <EOL> def __init__ ( self , * args ) : <EOL> for item in args : <EOL> for attr in dir ( item ) : <EOL> if attr == attr . upper ( ) : <EOL> setattr ( self , attr , getattr ( item , attr ) ) <EOL> def __setattr__ ( self , name , value ) : <EOL> obj_attr = getattr ( self , name , None ) <EOL> if obj_attr and type ( obj_attr ) == dict : <EOL> update_dict_in_depth ( obj_attr , value ) <EOL> else : <EOL> object . __setattr__ ( self , name , value ) <EOL> settings = LazySettings ( ) </s>
