def __init__(self): self.url = url_manager.UrlManager() self.downloader = html_downloader.HtmlDownloader() self.outputer = html_output.HtmlOutput() self.parser = html_parser.HtmlParser()
def __init__(self): self.urls = url_manager.Urlmanager() # url管理器对象 self.download = html_download.HtmlDownloader() # 网页下载器对象 self.parser = html_parser.HtmlParse() # 网页解析器对象 self.output = html_output.HtmlOutput() # 网页输出对象
def process(stuff): if isinstance(stuff, dict): l = [(k, process(v)) for (k, v) in stuff.iteritems()] keys = set(stuff) for order in orders: if keys.issubset(order) or keys.issuperset(order): return OrderedDict( sorted(l, key=lambda x: order.get(x[0], 0))) return OrderedDict(sorted(l)) if isinstance(stuff, list): return [process(x) for x in stuff] return stuff return process SCHEMA_HTML_FILE = "schema.html" schema = json.dumps(CONFIG_SCHEMA, sort_keys=True) schema = json.loads(schema, object_pairs_hook=OrderedDict) req = sorted(schema["required"]) custom_sort = make_custom_sort([req]) schema = custom_sort(schema) parsed_items = docsmodel.DocsModel().parse(schema)[1:] output = html_output.HtmlOutput().generate_output(parsed_items) with open(SCHEMA_HTML_FILE, 'wt') as f: f.write(output)
def __init__(self): self.download = html_download.HtmlDowmload() self.parser = html_parser.HtmlParser() self.output = html_output.HtmlOutput()
def __init__(self): self.urls = url_manager.UrlManager() #url管理器 self.downloader = html_downloader.HtmlDownLoader() #下载器 self.parser = html_parser.HtmlParser() #解析器 self.out_put = html_output.HtmlOutput() #输出器