From: Marko Luther Date: Mon, 4 Sep 2023 11:43:32 +0000 (+0200) Subject: Fixes some typos (Issue #10) (#11) X-Git-Tag: 2.4.0~8 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=78b360d4874cb86557c9b8335a33cf51aa80b957;p=thirdparty%2Fpython-drafthorse.git Fixes some typos (Issue #10) (#11) * Fixes some typos (Issue #10) * Apply suggestions from code review --------- Co-authored-by: Raphael Michel --- diff --git a/drafthorse/models/elements.py b/drafthorse/models/elements.py index 2d24b29..8478208 100644 --- a/drafthorse/models/elements.py +++ b/drafthorse/models/elements.py @@ -106,7 +106,7 @@ class Element(metaclass=BaseElementMeta): if child.tag == ET.Comment: continue if child.tag in field_index: - name, childel = field_index[child.tag] + name, _childel = field_index[child.tag] if isinstance(getattr(self, name), Container): getattr(self, name).add_from_etree(child) else: @@ -135,7 +135,7 @@ class StringElement(Element): return "<{}: {}>".format(type(self).__name__, str(self)) def __str__(self): - return str(self.text) + return str(self._text) def is_empty(self, el): return super().is_empty(el) and not self._set_on_input @@ -165,7 +165,7 @@ class DecimalElement(StringElement): return node def __str__(self): - return self.value + return self._value def from_etree(self, root): self._value = Decimal(root.text) @@ -217,7 +217,7 @@ class CurrencyElement(StringElement): return self def __str__(self): - return "{} {}".format(self.amount, self.currency) + return "{} {}".format(self._amount, self._currency) class ClassificationElement(StringElement): @@ -229,7 +229,7 @@ class ClassificationElement(StringElement): def to_etree(self): node = self._etree_node() - node.text = self.text + node.text = self._text node.attrib["listID"] = self._list_id node.attrib["listVersionID"] = self._list_version_id return node @@ -267,7 +267,7 @@ class BinaryObjectElement(StringElement): return self def __str__(self): - return "{} ({} {})".format(self._text, self._mime_code) + return "{} ({} {})".format(self._text, self._filename, self._mime_code) class AgencyIDElement(StringElement): diff --git a/drafthorse/models/tradelines.py b/drafthorse/models/tradelines.py index 9d31040..1e0c121 100644 --- a/drafthorse/models/tradelines.py +++ b/drafthorse/models/tradelines.py @@ -1,6 +1,5 @@ from . import BASIC, COMFORT, EXTENDED, NS_RAM from .accounting import ( - AccountingAccount, ApplicableTradeTax, BillingSpecifiedPeriod, ReceivableAccountingAccount, @@ -9,7 +8,6 @@ from .accounting import ( from .delivery import SupplyChainEvent from .elements import Element from .fields import ( - DateTimeField, DecimalField, Field, MultiField, diff --git a/drafthorse/pdf.py b/drafthorse/pdf.py index e06c7ad..cc7aa4d 100644 --- a/drafthorse/pdf.py +++ b/drafthorse/pdf.py @@ -169,7 +169,7 @@ def _prepare_pdf_metadata_xml(level, pdf_metadata): xmp_file = os.path.join( os.path.dirname(__file__), "schema", - "ZUGFeRD2p2_extension_schema.xmp".format(level), + "ZUGFeRD2p2_extension_schema.xmp", ) # Reason for defining a parser below: # http://lxml.de/FAQ.html#why-doesn-t-the-pretty-print-option-reformat-my-xml-output