From bb8a48fd4d85ba4f8224c68aaaf9069d5d79dae2 Mon Sep 17 00:00:00 2001 From: mia Date: Wed, 4 Sep 2024 04:47:13 -0700 Subject: desktop changes --- 2_filter.py | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) (limited to '2_filter.py') diff --git a/2_filter.py b/2_filter.py index 816e762..8e77945 100644 --- a/2_filter.py +++ b/2_filter.py @@ -4,32 +4,14 @@ from typing import Callable, List import psycopg -from ty import FilterableNote, Visibility +from com import FilterableNote, Visibility, eval_config, parse_graph, progressbar -try: - import progressbar2 as progressbar -except ImportError: - import progressbar - -print("configuring") -config = {} -exec(Path("config.py").read_text(), config) +config = eval_config() conn: psycopg.Connection = config["connect"]() criteria: Callable[[FilterableNote], bool] = config["criteria"] -intermediate = {} - -print("parsing") -for line in Path("graph.db").read_text().splitlines(): - id, replies, quotes, flags = line.split("\t") - intermediate[id] = { - "id": id, - "replies": replies.split(",") if len(replies) > 0 else [], - "quotes": quotes.split(",") if len(quotes) > 0 else [], - "flags": flags.split(",") if len(flags) > 0 else [], - } - +intermediate = parse_graph() def transform(entry: dict) -> FilterableNote: note = conn.execute( -- cgit 1.4.1