Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions requirements-dev.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@

-c requirements.txt

black==24.4.2
black==24.8.0
bumpversion==0.5.3
coverage==7.5.4
flake8==7.1.0
coverage==7.6.1
flake8==7.1.1
isort==5.13.2
mypy==1.10.1
mypy==1.11.1
pip-tools==7.4.1
tox==4.16.0
tox==4.18.0
twine==5.1.1
types-jsonschema==4.22.0.20240610
types-pyOpenSSL==24.1.0.20240425
types-jsonschema==4.23.0.20240813
types-pyOpenSSL==24.1.0.20240722
types-pytz==2024.1.0.20240417
wheel==0.44.0
16 changes: 8 additions & 8 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ attrs==23.2.0
# via
# -c requirements.txt
# referencing
black==24.4.2
black==24.8.0
# via -r requirements-dev.in
bleach==5.0.1
# via readme-renderer
build==1.0.3
# via pip-tools
bumpversion==0.5.3
# via -r requirements-dev.in
cachetools==5.3.3
cachetools==5.5.0
# via tox
certifi==2024.7.4
# via
Expand All @@ -36,7 +36,7 @@ click==8.0.3
# pip-tools
colorama==0.4.6
# via tox
coverage==7.5.4
coverage==7.6.1
# via -r requirements-dev.in
cryptography==42.0.8
# via
Expand All @@ -51,7 +51,7 @@ filelock==3.15.4
# via
# tox
# virtualenv
flake8==7.1.0
flake8==7.1.1
# via -r requirements-dev.in
idna==3.7
# via requests
Expand All @@ -74,7 +74,7 @@ mccabe==0.7.0
# via flake8
mdurl==0.1.2
# via markdown-it-py
mypy==1.10.1
mypy==1.11.1
# via -r requirements-dev.in
mypy-extensions==1.0.0
# via
Expand Down Expand Up @@ -151,15 +151,15 @@ tomli==2.0.1
# pyproject-api
# pyproject-hooks
# tox
tox==4.16.0
tox==4.18.0
# via -r requirements-dev.in
twine==5.1.1
# via -r requirements-dev.in
types-cffi==1.16.0.20240331
# via types-pyopenssl
types-jsonschema==4.22.0.20240610
types-jsonschema==4.23.0.20240813
# via -r requirements-dev.in
types-pyopenssl==24.1.0.20240425
types-pyopenssl==24.1.0.20240722
# via -r requirements-dev.in
types-pytz==2024.1.0.20240417
# via -r requirements-dev.in
Expand Down
20 changes: 8 additions & 12 deletions src/scripts/clean_dte_xml_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,16 @@ def clean_dte_xml_file(input_file_path: str, output_file_path: str) -> Iterable[
# note: another way to compute the difference in a similar format is
# `diff -Naur $input_file_path $output_file_path`
file_bytes_diff_gen = difflib.diff_bytes(
dfunc=difflib.unified_diff,
a=file_bytes.splitlines(),
b=file_bytes_rewritten.splitlines())
dfunc=difflib.unified_diff, a=file_bytes.splitlines(), b=file_bytes_rewritten.splitlines()
)

return file_bytes_diff_gen


def main_single_file(input_file_path: str, output_file_path: str) -> None:
file_bytes_diff_gen = clean_dte_xml_file(
input_file_path=input_file_path,
output_file_path=output_file_path)
input_file_path=input_file_path, output_file_path=output_file_path
)

for diff_line in file_bytes_diff_gen:
print(diff_line)
Expand All @@ -89,8 +88,8 @@ def main_dir_files(input_files_dir_path: str) -> None:

print(f"\n\nWill clean file '{input_file_path}' and save it to '{output_file_path}'.")
file_bytes_diff_gen = clean_dte_xml_file(
input_file_path=input_file_path,
output_file_path=output_file_path)
input_file_path=input_file_path, output_file_path=output_file_path
)

print("Difference between input and output files:")
diff_line = None
Expand All @@ -102,11 +101,8 @@ def main_dir_files(input_files_dir_path: str) -> None:

if __name__ == '__main__':
if sys.argv[1] == 'file':
main_single_file(
input_file_path=sys.argv[2],
output_file_path=sys.argv[3])
main_single_file(input_file_path=sys.argv[2], output_file_path=sys.argv[3])
elif sys.argv[1] == 'dir':
main_dir_files(
input_files_dir_path=sys.argv[2])
main_dir_files(input_files_dir_path=sys.argv[2])
else:
raise ValueError(f"Invalid option: '{sys.argv[1]}'")
4 changes: 2 additions & 2 deletions src/scripts/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
# script
###############################################################################


def main(args: Sequence[str]) -> None:
start_ts = datetime.now()

Expand All @@ -57,8 +58,7 @@ def main(args: Sequence[str]) -> None:
try:
print("Action: do something")
except FileNotFoundError:
logger.exception(
"Process aborted: a file could not be opened.", exc_info=True)
logger.exception("Process aborted: a file could not be opened.", exc_info=True)
except KeyboardInterrupt:
logger.error("Process interrupted by user.")
except Exception:
Expand Down