New progress bar
This commit is contained in:
13
src/wani.py
13
src/wani.py
@@ -9,11 +9,7 @@ import subprocess
|
||||
import concurrent.futures
|
||||
import tempfile
|
||||
|
||||
try:
|
||||
from tqdm import tqdm
|
||||
except ImportError:
|
||||
tqdm = lambda x: x
|
||||
|
||||
from progress_bar import progress
|
||||
from word import Word
|
||||
from syntactic_structure import build_structures
|
||||
from match_store import MatchStore
|
||||
@@ -22,11 +18,10 @@ from writer import Writer
|
||||
from loader import load_files
|
||||
|
||||
|
||||
|
||||
def match_file(words, structures):
|
||||
matches = {s: [] for s in structures}
|
||||
|
||||
for s in structures:
|
||||
for s in progress(structures, "matching", infile=True):
|
||||
for w in words:
|
||||
mhere = s.match(w)
|
||||
for match in mhere:
|
||||
@@ -77,7 +72,7 @@ def main(args):
|
||||
word_stats.add_words(words)
|
||||
|
||||
else:
|
||||
for words in tqdm(load_files(args)):
|
||||
for words in progress(load_files(args), "files", outfile=True):
|
||||
matches = match_file(words, structures)
|
||||
# just save to temporary file, used for children of a parallel process
|
||||
# MUST NOT have more than one file
|
||||
@@ -151,9 +146,11 @@ if __name__ == '__main__':
|
||||
|
||||
parser.add_argument('--match-to-file', help='Do not use!')
|
||||
parser.add_argument('--pickled-structures', help='Do not use!', action='store_true')
|
||||
parser.add_argument('--hide-inner-progress', help='Do not use!', action='store_true')
|
||||
|
||||
args = parser.parse_args()
|
||||
logging.basicConfig(stream=sys.stderr, level=args.verbose.upper())
|
||||
progress.init(args)
|
||||
|
||||
start = time.time()
|
||||
main(args)
|
||||
|
||||
Reference in New Issue
Block a user