From 92ae1f615e912fff87bb70efb4c9a8005b67ed67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Richard=20Kub=C3=AD=C4=8Dek?= Date: Mon, 3 Mar 2025 19:43:58 +0100 Subject: [PATCH] examples: simplify add_invoice --- examples/add_invoice.py | 6 ++++-- examples/tools.py | 16 ---------------- 2 files changed, 4 insertions(+), 18 deletions(-) delete mode 100644 examples/tools.py diff --git a/examples/add_invoice.py b/examples/add_invoice.py index 9184a9b..e085ad0 100644 --- a/examples/add_invoice.py +++ b/examples/add_invoice.py @@ -21,7 +21,8 @@ Dependencies: - superfaktura.utils.data_types.Date """ -from examples.tools import save_file_as_pdf +from pathlib import Path + from superfaktura.bank_account import BankAccount from superfaktura.client_contacts import ClientContactModel from superfaktura.enumerations.currency import Currencies @@ -72,7 +73,8 @@ def main(): ) _pdf = invoice.get_pdf(invoice=resp, language=Language.English) - save_file_as_pdf(_pdf, "invoice.pdf") + p = Path("invoice.pdf") + p.write_bytes(_pdf) if __name__ == "__main__": diff --git a/examples/tools.py b/examples/tools.py deleted file mode 100644 index 840552e..0000000 --- a/examples/tools.py +++ /dev/null @@ -1,16 +0,0 @@ -""" -This module contains tools for working with these examples. -""" - -from pathlib import Path - - -def save_file_as_pdf(input_data: bytes, output_path: str = "output.pdf") -> None: - """ - Save the input data as a PDF file. - :param input_data: - :param output_path: - :return: - """ - p = Path(output_path) - p.write_bytes(input_data)