def recurse(self, config_obj): if isinstance(config_obj, BoundContainer): if is_anonymous(config_obj.config.key): key = "__many__" else: key = config_obj.config.key if self.level != 0: self.p("%s" % "[" * self.level + key + "]" * self.level) self.indent += 2 self.level += 1 sections = [] for v in config_obj.get().values(): if isinstance(v, BoundContainer): sections.append(v) else: self.p("%s=" % (v.config.key)) if isinstance(config_obj.config, UnspecifiedConfigSection) and sections: self.recurse(sections[0]) else: for sec in sections: self.recurse(sec) self.indent -= 2 self.level -= 1
def recurse_conf(modules): attrs = [] for module in modules: if not show_private and module.config.private: continue conf = { 'help': module.config.help or _('No help available.'), 'key': module.config.key, 'is_anonymous': is_anonymous(module.config.key) } if isinstance(module, BoundContainer): conf['values'] = recurse_conf(module.get().values()) else: conf['default'] = str(module.config.default) if 'password' in module.config.key: conf['value'] = '*' * 10 elif sys.version_info[0] > 2: conf['value'] = str(module.get_raw()) else: conf['value'] = str(module.get_raw()).decode( 'utf-8', 'replace') attrs.append(conf) return attrs
def recurse(self, config_obj): if isinstance(config_obj, BoundContainer): if is_anonymous(config_obj.config.key): key = "__many__" else: key = config_obj.config.key if self.level != 0: self.p("%s" % "[" * self.level + key + "]" * self.level) self.indent += 2 self.level += 1 sections = [] for v in list(config_obj.get().values()): if isinstance(v, BoundContainer): sections.append(v) else: self.p("%s=" % (v.config.key)) if isinstance(config_obj.config, UnspecifiedConfigSection) and sections: self.recurse(sections[0]) else: for sec in sections: self.recurse(sec) self.indent -= 2 self.level -= 1
def recurse(self, config_obj): if isinstance(config_obj, BoundContainer): if is_anonymous(config_obj.config.key): key = "/default/" else: key = config_obj.config.key self.p("%s:" % key) self.indent += 2 print textwrap.fill(config_obj.config.help or "No help available.", initial_indent=" "*self.indent, subsequent_indent=" "*self.indent) print for v in config_obj.get().values(): self.recurse(v) self.indent -= 2 else: self.p("%s=%s" % (config_obj.config.key, config_obj.get())) self.indent += 2 self.fill(config_obj.config.help or "No help available.") self.indent -= 2
def recurse(self, config_obj): if isinstance(config_obj, BoundContainer): if is_anonymous(config_obj.config.key): key = "/default/" else: key = config_obj.config.key self.p("%s:" % key) self.indent += 2 print textwrap.fill(config_obj.config.help or _("No help available."), initial_indent=" "*self.indent, subsequent_indent=" "*self.indent) print for v in config_obj.get().values(): self.recurse(v) self.indent -= 2 else: self.p("%s=%s" % (config_obj.config.key, config_obj.get())) self.indent += 2 self.fill(config_obj.config.help or _("No help available.")) self.indent -= 2
def recurse(self, config_obj): if isinstance(config_obj, BoundContainer): if is_anonymous(config_obj.config.key): key = "__many__" if 'notebook.interpreters.' in config_obj.prefix: key = config_obj.prefix.split('notebook.interpreters.')[1] else: key = config_obj.config.key if self.level != 0: self.p("%s" % "[" * self.level + key + "]" * self.level) self.indent += 2 self.level += 1 sections = [] for v in config_obj.get().values(): if isinstance(v, BoundContainer): sections.append(v) else: self.p("%s=%s" % (v.config.key, v.get())) for sec in sections: self.recurse(sec) self.indent -= 2 self.level -= 1