]> git.ipfire.org Git - thirdparty/python-drafthorse.git/commitdiff
Fixes some typos (Issue #10) (#11)
authorMarko Luther <marko.luther@gmx.net>
Mon, 4 Sep 2023 11:43:32 +0000 (13:43 +0200)
committerGitHub <noreply@github.com>
Mon, 4 Sep 2023 11:43:32 +0000 (13:43 +0200)
* Fixes some typos (Issue #10)

* Apply suggestions from code review

---------

Co-authored-by: Raphael Michel <mail@raphaelmichel.de>
drafthorse/models/elements.py
drafthorse/models/tradelines.py
drafthorse/pdf.py

index 2d24b291146889c30d4cc50f0afb58db875faf08..847820886298e437ce0aa7bae61570d8551cdbba 100644 (file)
@@ -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):
index 9d310403849947e654c36f60a9561516e7a7ce5e..1e0c121e6604fce182fcc1a53b1a698502e7023e 100644 (file)
@@ -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,
index e06c7ad9ec842d31b9a731ed67c98370da676e0b..cc7aa4d747c97f45ffc267f92a479fc526920d90 100644 (file)
@@ -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