fixes to use the program with repr
This commit is contained in:
parent
c38274b58e
commit
221aa5d3aa
@ -1,20 +1,18 @@
|
||||
#!python
|
||||
# pyright: basic
|
||||
import sys
|
||||
from os import makedirs, mkdir
|
||||
from shutil import rmtree
|
||||
|
||||
from articles import Article, Articles
|
||||
from config import config
|
||||
from converter import highlight_unknown_chars
|
||||
from database import db
|
||||
|
||||
if __name__ != "__main__":
|
||||
exit()
|
||||
|
||||
import sys
|
||||
from os import makedirs, mkdir
|
||||
from shutil import rmtree
|
||||
|
||||
# Clean the output dir & create a new
|
||||
rmtree(config.output_dir, True)
|
||||
mkdir(config.output_dir)
|
||||
# Clean the output dir & create a new
|
||||
rmtree(config.output_dir, True)
|
||||
mkdir(config.output_dir)
|
||||
|
||||
# Connect to the MySQL database with Peewee ORM
|
||||
db.init(config.db, host=config.db_host, user=config.db_user, password=config.db_pass)
|
||||
@ -36,8 +34,9 @@ RESET: str = "\033[0m"
|
||||
# Articles that contains unknown chars
|
||||
unknown_chars_articles: list[Article] = []
|
||||
|
||||
# Loop among first maxexport articles & export them
|
||||
for counter, article in Articles(maxexport):
|
||||
if __name__ != "__main__":
|
||||
# Loop among first maxexport articles & export them
|
||||
for counter, article in Articles(maxexport):
|
||||
if (counter["exported"] - 1) % 100 == 0:
|
||||
print(
|
||||
f"\n{BOLD}Exporting {R}{counter['remaining']+1}{RESET}"
|
||||
@ -57,7 +56,7 @@ for counter, article in Articles(maxexport):
|
||||
if len(article.get_unknown_chars()) > 0:
|
||||
unknown_chars_articles.append(article)
|
||||
|
||||
for article in unknown_chars_articles:
|
||||
for article in unknown_chars_articles:
|
||||
unknown_chars_apparitions: list = article.get_unknown_chars()
|
||||
nb: int = len(unknown_chars_apparitions)
|
||||
s: str = "s" if nb > 1 else ""
|
||||
@ -68,4 +67,4 @@ for article in unknown_chars_articles:
|
||||
for text in unknown_chars_apparitions:
|
||||
print(f" {BOLD}…{RESET} " + highlight_unknown_chars(text))
|
||||
|
||||
db.close() # Close the database connection
|
||||
db.close() # Close the database connection
|
||||
|
Loading…
Reference in New Issue
Block a user