@@ -0,0 +1,1503 @@
+%22%22%22%0AVarious global options/parameters.%0A%0ANotes%0A-----%0AInspired by rcParams of matplotlib.%0A%22%22%22%0A%0Adef validate_bool(val):%0A    %22%22%22%0A    Convert b to a boolean or raise a ValueError.%0A    %22%22%22%0A    if type(val) is str:%0A        val = val.lower()%0A%0A    if val in ('t', 'y', 'yes', 'on', 'true', '1', 1, True):%0A        return True%0A%0A    elif val in ('f', 'n', 'no', 'off', 'false', '0', 0, False):%0A        return False%0A%0A    else:%0A        raise ValueError('Could not convert %22%25s%22 to boolean!' %25 val)%0A%0Adefault_goptions = %7B%0A    'verbose' : %5BTrue, validate_bool%5D%0A%7D%0A%0Aclass ValidatedDict(dict):%0A    %22%22%22%0A    A dictionary object including validation.%0A    %22%22%22%0A    validate = dict(%5B(key, validator) for key, (default, validator) in %5C%0A                     default_goptions.iteritems()%5D)%0A%0A    def __setitem__(self, key, val):%0A        try:%0A            cval = self.validate%5Bkey%5D(val)%0A            dict.__setitem__(self, key, cval)%0A        except KeyError:%0A            raise KeyError('%25s is not a valid option.'%0A                           ' See goptions.keys() for a list of valid'%0A                           ' options.' %25 (key,))%0A%0A    def keys(self):%0A        %22%22%22%0A        Return sorted list of keys.%0A        %22%22%22%0A        ks = dict.keys(self)%0A        ks.sort()%0A        return ks%0A%0A    def values(self):%0A        %22%22%22%0A        Return values in order of sorted keys.%0A        %22%22%22%0A        return %5Bself%5Bkey%5D for key in self.keys()%5D%0A%0Agoptions = ValidatedDict(%5B(key, val%5B0%5D)%0A                          for key, val in default_goptions.iteritems()%5D)%0A

support global options (closes Issue 190)