def dump(self, keys=None, sparse=False, pnative=False, prefix='', none_str=''): """Override parse.config.dump(). To restore the list-nature of theme state items. """ cfg = deepcopy(self.get([], sparse)) try: for theme in cfg['themes'].values(): for state in theme: clist = [] for attr, val in theme[state].items(): clist.append('%s=%s' % (attr, val)) theme[state] = clist except (KeyError, AttributeError): pass parents = [] for key in keys: try: cfg = cfg[key] except KeyError: raise ItemNotFoundError(itemstr(parents, key)) else: parents.append(key) if pnative: print(cfg) else: printcfg(cfg, prefix=prefix, level=len(keys))
def dump(self, keys=[], sparse=False, pnative=False, prefix='', none_str=''): # override parse.config.dump() to restore the list-nature of # theme state items cfg = deepcopy(self.get([], sparse)) try: for theme in cfg['themes'].values(): for state in theme.keys(): clist = [] for attr, val in theme[state].items(): clist.append(attr + '=' + val) theme[state] = clist except: pass parents = [] for key in keys: try: cfg = cfg[key] except KeyError, x: raise ItemNotFoundError(itemstr(parents, key)) else: parents.append(key)
def dump(self, keys, sparse=False, pnative=False, prefix='', none_str=''): """Override parse.config.dump(). To restore the list-nature of theme state items. """ cfg = deepcopy(self.get([], sparse)) try: for theme in cfg['themes'].values(): for state in theme: clist = [] for attr, val in theme[state].items(): clist.append('%s=%s' % (attr, val)) theme[state] = clist except (KeyError, AttributeError): pass parents = [] for key in keys: try: cfg = cfg[key] except KeyError: raise ItemNotFoundError(itemstr(parents, key)) else: parents.append(key) if pnative: print cfg else: printcfg(cfg, prefix=prefix, level=len(keys))
def dump(self, keys=[], sparse=False, pnative=False, prefix="", none_str=""): # override parse.config.dump() to restore the list-nature of # theme state items cfg = deepcopy(self.get([], sparse)) try: for theme in cfg["themes"].values(): for state in theme.keys(): clist = [] for attr, val in theme[state].items(): clist.append(attr + "=" + val) theme[state] = clist except: pass parents = [] for key in keys: try: cfg = cfg[key] except KeyError, x: raise ItemNotFoundError(itemstr(parents, key)) else: parents.append(key)