<s> import sublime <EOL> class Settings : <EOL> """<STR_LIT>""" <EOL> @ staticmethod <EOL> def reset ( ) : <EOL> """<STR_LIT>""" <EOL> Settings . settings = None <EOL> Settings . sublime_settings = None <EOL> Settings . settings_base = "<STR_LIT>" <EOL> Settings . sublime_base = "<STR_LIT>" <EOL> @ staticmethod <EOL> def startup ( ) : <EOL> """<STR_LIT>""" <EOL> Settings . settings = sublime . load_settings ( Settings . settings_base ) <EOL> Settings . sublime_settings = sublime . load_settings ( Settings . sublime_base ) <EOL> @ staticmethod <EOL> def get_global ( key , default = None , as_tuple = False ) : <EOL> """<STR_LIT>""" <EOL> if as_tuple : <EOL> return ( Settings . get_global ( key , default , as_tuple = False ) , False ) <EOL> else : <EOL> return Settings . settings . get ( key , default ) <EOL> @ staticmethod <EOL> def get_local ( key , default = None , as_tuple = False ) : <EOL> """<STR_LIT>""" <EOL> if as_tuple : <EOL> return ( Settings . get_local ( key , default , as_tuple = False ) , True ) <EOL> else : <EOL> project_data = sublime . active_window ( ) . project_data ( ) <EOL> if ( project_data is not None and <EOL> "<STR_LIT>" in project_data and <EOL> key in project_data [ "<STR_LIT>" ] ) : <EOL> return project_data [ "<STR_LIT>" ] [ key ] <EOL> return default <EOL> @ staticmethod <EOL> def get_sublime ( key , default = None ) : <EOL> """<STR_LIT>""" <EOL> return Settings . sublime_settings . get ( key , default ) <EOL> @ staticmethod <EOL> def get ( key , default = None , from_global = None , as_tuple = False ) : <EOL> """<STR_LIT>""" <EOL> if from_global is None : <EOL> value = Settings . get ( <EOL> key , <EOL> default = None , <EOL> from_global = False , <EOL> as_tuple = as_tuple <EOL> ) <EOL> if value is None : <EOL> value = Settings . get ( <EOL> key , <EOL> default = default , <EOL> from_global = True , <EOL> as_tuple = as_tuple <EOL> ) <EOL> return value <EOL> elif from_global : <EOL> return Settings . get_global ( key , default , as_tuple ) <EOL> else : <EOL> return Settings . get_local ( key , default , as_tuple ) <EOL> @ staticmethod <EOL> def set ( key , val , to_global = False ) : <EOL> """<STR_LIT>""" <EOL> if to_global : <EOL> if val is None : <EOL> if Settings . settings . has ( key ) : <EOL> Settings . settings . erase ( key ) <EOL> else : <EOL> return <EOL> else : <EOL> Settings . settings . set ( key , val ) <EOL> sublime . save_settings ( Settings . settings_base ) <EOL> else : <EOL> window = sublime . active_window ( ) <EOL> project_data = window . project_data ( ) <EOL> if val is None : <EOL> if ( project_data is not None and <EOL> "<STR_LIT>" in project_data and <EOL> key in project_data [ "<STR_LIT>" ] ) : <EOL> del project_data [ "<STR_LIT>" ] [ key ] <EOL> else : <EOL> return <EOL> else : <EOL> if "<STR_LIT>" in project_data : <EOL> data = project_data [ "<STR_LIT>" ] <EOL> else : <EOL> data = { } <EOL> data [ key ] = val <EOL> project_data [ "<STR_LIT>" ] = data <EOL> window . set_project_data ( project_data ) <EOL> @ staticmethod <EOL> def ready ( ) : <EOL> """<STR_LIT>""" <EOL> return Settings . settings is not None </s>
