-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
69 lines (53 loc) · 2.15 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import logging
import sys
from dotenv import load_dotenv
from src.new_data_processors.SR_table_processors.category_prediction.category_prediction import CategoryPredictor
from src.new_data_processors.SR_table_processors.files import NewFilesRegistrar
from src.new_data_processors.helper_table_updaters.countries import CountriesUpdater
from src.new_data_processors.helper_table_updaters.companies import CompaniesUpdater
from src.new_data_processors.helper_table_updaters.operating_sites import (
OperatingSitesUpdater,
)
from src.new_data_processors.SR_table_processors.companies.MÁV import MavUpdater
from src.new_data_processors.SR_table_processors.companies.GYSEV import GysevUpdater
from src.OSM_data_processors.mapper import Mapper
# future: mark all packages as namespace packages in the IDE when https://youtrack.jetbrains.com/issue/PY-55212/ is fixed
def main(
demonstration=True,
show_lines_with_no_data=True,
) -> None:
configure_logging(demonstration)
logging.getLogger(__name__).info("Program started...")
load_dotenv()
# CountriesUpdater().run()
# CompaniesUpdater().run()
# OperatingSitesUpdater().run()
# NewFilesRegistrar().run()
with CategoryPredictor() as category_predictor:
MavUpdater(category_predictor).run()
GysevUpdater(category_predictor).run()
# Mapper(show_lines_with_no_data).run()
logging.getLogger(__name__).info("...program finished!")
def configure_logging(demonstration: bool) -> None:
if demonstration:
logging.basicConfig(
encoding="utf-8",
handlers=[
logging.StreamHandler(sys.stdout),
logging.FileHandler("kalauz.log"),
],
format="%(asctime)s [%(levelname)s]: %(message)s",
level=logging.INFO,
)
else:
logging.basicConfig(
encoding="utf-8",
handlers=[
logging.StreamHandler(),
logging.FileHandler("kalauz.log"),
],
format='%(asctime)s [%(levelname)s] "%(pathname)s:%(lineno)d": %(message)s',
level=logging.DEBUG,
)
if __name__ == "__main__":
main()