Skip to content

Commit

Permalink
[res] logging
Browse files Browse the repository at this point in the history
  • Loading branch information
kokes committed Dec 18, 2023
1 parent 57b575a commit 6e1c3b4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions data/res/main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import csv
import gzip
import io
import logging
import os
from contextlib import contextmanager
from urllib.request import Request, urlopen
Expand Down Expand Up @@ -104,8 +105,10 @@ def open_remote_gzipped(url: str, partial: bool):


def main(outdir: str, partial: bool = False):
logging.getLogger().setLevel(logging.INFO)
cls_data = dict()
for cls_url in CLS_URLS:
logging.info("Nacitam %s", cls_url)
with open_remote_gzipped(cls_url, partial) as r:
cr = csv.DictReader(r)
for row in cr:
Expand All @@ -121,7 +124,10 @@ def main(outdir: str, partial: bool = False):

cls_data[(int(kodcis), chodnota)] = text

logging.info("Ciselniky hotove")

for url, filename in [DATA, NACE]:
logging.info("Nacitam %s", url)
path = os.path.join(outdir, filename)
with open_remote_gzipped(url, partial) as r, open(
path, "wt", encoding="utf-8"
Expand Down

0 comments on commit 6e1c3b4

Please sign in to comment.