diff scobot/index/access.py @ 16:7a87ba2f00d9

reformat, fix some types, make more async
author drewp@bigasterisk.com
date Fri, 19 Jul 2024 00:49:38 -0700
parents 6ed25bcaaf1f
children
line wrap: on
line diff
--- a/scobot/index/access.py	Fri Jul 19 00:30:47 2024 -0700
+++ b/scobot/index/access.py	Fri Jul 19 00:49:38 2024 -0700
@@ -1,11 +1,13 @@
+import logging
 from pathlib import Path
 import shutil
+from typing import cast
 
 from whoosh.index import create_in, open_dir
 
 from scobot.index.schema import schema
 
-log = None  # set by flow
+log = cast(logging.Logger, None)  # set by flow
 
 
 class SearchIndex:
@@ -27,8 +29,10 @@
         with self.ix.searcher() as searcher:
             log.info(f'index doc count = {searcher.doc_count()}')
 
+
 class SearchIndexRO:
+
     def __init__(self, indexDir: Path):
         self.ix = open_dir(indexDir, readonly=True)
         self.searcher = self.ix.searcher()
-        print(f'{self.searcher.doc_count()=}')
\ No newline at end of file
+        print(f'{self.searcher.doc_count()=}')