def debug_eprint_all(self) -> None: t = self.seen with self._lock: all_ = t.all() u.eprint("====db.all") u.eprint_pprint(all_) u.eprint("db.all====")
def get_word_count(self, word: str) -> int: t = self.seen with self._lock: Q = Query() q = t.search(Q.word == word) lenq = len(q) if lenq == 0: return 0 elif lenq == 1: return q[0]['count'] else: u.eprint( f"db.py: corrupt data! word '{word}' occured {lenq} times in db, expected 0 or 1" )
def eprint(x: str) -> None: u.eprint(f"test_db.py: {x}")
def pp_db() -> None: with Db() as db: u.eprint_pprint(db.words_with_count()) u.eprint(f"total words seen = {db.total_words_seen()}") u.eprint(f"unique words seen = {db.unique_words_seen()}")
def eprint(x: str) -> None: u.eprint(f"app.py: {x}")
def run(): atexit.register(lambda: u.eprint("====UWB EXITING=====")) u.eprint(f"====UWB STARTING [time={u.now_str()}]====") # pp_db() collect_words_forever()
def eprint(x: str) -> None: u.eprint(f"clean.py: {x}")
def eprint(x: str) -> None: u.eprint(f"dictionary.py: {x}")
def eprint(x: str) -> None: u.eprint(f"reddit.py: {x}")