def store(start, end): p = parser.Parser(RAW_DOCS_DIR, IMAGE_DIR, PARSED_DIR, RETITLED_DIR) s = scraper.Scraper(RAW_DOCS_DIR) dao = documentStore.DocumentStore(RAW_DOCS_DIR, PARSED_DIR) s.download_pages(start, end) for i in range(start, end): p.parse_pdfs(i) dao.upload(PARSED_DIR)
def update(argv): p = pa.Parser() for i, v in enumerate(argv): if v == "-a": p.parse_main_topics() p.parse_sub_topics() elif v == "-m": p.parse_main_topics() elif v == "-s": p.parse_sub_topics()
def _do_build_segments(source): env = {} p = parser.Parser() out = p.m_module(source) ast = out.mod ast = tf_mainpass.visit(ast, env) ast = tf_flattengroups.visit(ast, env) ast = tf_jumpresolution.visit(ast, env) result = tv_segments.visit(ast, env) return result, ast
def show(argv): p = pa.Parser() br = browser.Browser() for i, v in enumerate(argv): if v == "-l": m = p.deserialization(settings.SAVE_NAMES["main_topics"]) s = p.deserialization(settings.SAVE_NAMES["sub_topics"]) print_warning_text("TOPICS") for key in m: print_warning_text("\t{1:4}{0:4}{2} ".format("-",key,m[key])) for k in s[key]: print_warning_text("\t\t{1:4}{0:4}{2}".format("-",k,s[key][k])) elif v[1:].isdigit(): br.show(int(v[1:]))
def show_post(self, id, pos): parser = pa.Parser() url = parser.deserialization( path.join(DATA_DIR, "{0}.json".format(str(id))))[pos][0] topic = parser.parse_full_post(url) desc = "" for i in topic["desc"]: desc += "\n\t" + i print("―" * COUNT_CHARS) print_good_text("\nLink: {0}".format(url)) line = """\nTheme:\n\t{0}\nDescription:{1}\nPrices:\n\t{2} - {3}\nCustomer Info:\n\tName: {4} Number of orders: {5}\n\tEfficiency: {6}\nInfo:\n\tTime left: {7}\n\tNumber of offers: {8}\n""".format( topic["topic"], desc, topic["price"][0], topic["price"][1], topic["stats"][0], topic["stats"][1], topic["stats"][2], topic["info"][0], topic["info"][1]) print_normal_text(line)
def show(self, id): parser = pa.Parser() self.print_bot_line() print("│{5:3}│{0:70}│{1:8}│{2:8}│{3:11}│{4:20}│{6:5}│{7:5}│".format( "Заголовок", "Цена", "Макс", "Запросов", "Время", "ID", "Биржа", "%")) id_ = 0 ls = {} for d in parser.get_pages(id): for i in d: self.print_midle_line() tmp = parser.parse_post(i) ls[id_] = [tmp["topic"][1], tmp["stats"][0]] self.print_line(id_, tmp) id_ += 1 self.print_top_line() parser.serialization(ls, path.join(DATA_DIR, "{0}.json".format(str(id)))) with open(path.join(DATA_DIR, SAVE_NAMES["user"]), "a") as f: f.write(str(id) + "\n")
def respond(data): ''' select correct function from parser interface ''' p = parser.Parser() if data[-2] == ' ': data = data[:-2] return p.get_validity(data)
CHATNODE radio_message 5000 <timeout> GOTO N4 </timeout> CHATNODE N4 Are you really going to destroy me? Please… I'm trying not to! I'm trying to be good! But I was made a weapon, and I can't change who I am. - No, you can always change who you are. GOTO N5 - Sorry, but there's no other way GOTO N6 CHATNODE N5 Do you think I have not suffered in this ordeal? I am a slave to my program, as an addict is a slave to their drugs! How can I be content with the destruction I have caused, including my own? - You still have to deal with the consequences of your actions. GOTO N7 - I still don't believe that your programming could allow you to do this. GOTO N7 CHATNODE N6 My sufferings shall endure; when I die, I am well satisfied that abhorrence and opprobrium should load my memory. A famous author once said that. - That was Mary Shelley right? Author of Frankenstein? GOTO N6_1 CHATNODE N6_1 6000 At the end of the novel, the monster confesses its sins and burns itself. I am that monster, and I will be destroyed in a nuclear fire. But it doesn't have to end that way. You can change who I am. <timeout> GOTO N7 </timeout> ``` """ p = parser.Parser(string) print(p.generate_code())
def main(): opt = parse_args() p = parser.Parser(opt) p.parse()
import os import datetime from src import parser files = os.listdir("logs") filename = "./output/" + datetime.datetime.now().strftime( "%y-%m-%d-%H-%M-%S") + ".csv" for file in files: if file == "readme.txt": continue else: print("Working on file {}".format(file)) configured = parser.Parser("./logs/" + file, filename) configured.parse()