Skip to content

Commit

Permalink
Fixes some typos (Issue #10) (#11)
Browse files Browse the repository at this point in the history
* Fixes some typos (Issue #10)

* Apply suggestions from code review

---------

Co-authored-by: Raphael Michel <[email protected]>
  • Loading branch information
MAKOMO and raphaelm authored Sep 4, 2023
1 parent 4a3e65a commit 78b360d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
12 changes: 6 additions & 6 deletions drafthorse/models/elements.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def from_etree(self, root):
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:
Expand Down Expand Up @@ -135,7 +135,7 @@ def __repr__(self):
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
Expand Down Expand Up @@ -165,7 +165,7 @@ def to_etree(self):
return node

def __str__(self):
return self.value
return self._value

def from_etree(self, root):
self._value = Decimal(root.text)
Expand Down Expand Up @@ -217,7 +217,7 @@ def from_etree(self, root):
return self

def __str__(self):
return "{} {}".format(self.amount, self.currency)
return "{} {}".format(self._amount, self._currency)


class ClassificationElement(StringElement):
Expand All @@ -229,7 +229,7 @@ def __init__(self, namespace, tag, text="", list_id="", list_version_id=""):

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
Expand Down Expand Up @@ -267,7 +267,7 @@ def from_etree(self, root):
return self

def __str__(self):
return "{} ({} {})".format(self._text, self._mime_code)
return "{} ({} {})".format(self._text, self._filename, self._mime_code)


class AgencyIDElement(StringElement):
Expand Down
2 changes: 0 additions & 2 deletions drafthorse/models/tradelines.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from . import BASIC, COMFORT, EXTENDED, NS_RAM
from .accounting import (
AccountingAccount,
ApplicableTradeTax,
BillingSpecifiedPeriod,
ReceivableAccountingAccount,
Expand All @@ -9,7 +8,6 @@
from .delivery import SupplyChainEvent
from .elements import Element
from .fields import (
DateTimeField,
DecimalField,
Field,
MultiField,
Expand Down
2 changes: 1 addition & 1 deletion drafthorse/pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 78b360d

Please sign in to comment.