<s> from dotify import dotify <EOL> import matplotlib as mpl <EOL> import types <EOL> from types import ModuleType <EOL> _set = types . __builtins__ [ "<STR_LIT>" ] <EOL> def get ( key = False ) : <EOL> params = mpl . rcParams <EOL> return params [ key ] if key else dotify ( params ) <EOL> def set ( obj , * args , ** kwargs ) : <EOL> if type ( obj ) == ModuleType : <EOL> props = obj . style ( * args , ** kwargs ) <EOL> else : <EOL> props = obj <EOL> dotted = dotify ( props ) <EOL> for key in dotted : <EOL> val = dotted [ key ] <EOL> try : <EOL> mpl . rcParams [ key ] = val <EOL> except : pass <EOL> DEFAULT_PARAMS = dict ( ( k , v [ <NUM_LIT:0> ] ) for k , v in <EOL> mpl . rcsetup . defaultParams . iteritems ( ) ) <EOL> def reset ( params = DEFAULT_PARAMS ) : <EOL> old_keys = mpl . rcParams . keys ( ) <EOL> set ( params ) <EOL> new_keys = mpl . rcParams . keys ( ) <EOL> keys_to_del = list ( _set ( old_keys ) - _set ( new_keys ) ) <EOL> for key in keys_to_del : del mpl . rcParams [ key ] </s>
