From 62146a3e79b495239d467f09a2e3e0914130bebf Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Mon, 15 Oct 2018 23:51:27 +0200 Subject: [PATCH] Fix style errors --- demo.py | 24 ------------------------ drafthorse/models/elements.py | 8 +++----- drafthorse/models/fields.py | 3 ++- drafthorse/models/tradelines.py | 4 ++-- tests/test_roundtrip.py | 2 +- 5 files changed, 8 insertions(+), 33 deletions(-) delete mode 100644 demo.py diff --git a/demo.py b/demo.py deleted file mode 100644 index ba71c00..0000000 --- a/demo.py +++ /dev/null @@ -1,24 +0,0 @@ -from datetime import date - -from drafthorse.models.document import Document, IncludedNote -from drafthorse.utils import prettify - -""" -doc = Document() -doc.context.guideline_parameter.id = "urn:ferd:CrossIndustryDocument:invoice:1p0:comfort" -doc.header.id = "RE1337" -doc.header.name = "RECHNUNG" -doc.header.type_code = "380" -doc.header.issue_date_time.value = date.today() -doc.header.languages.add("de") -n = IncludedNote() -n.content.add("Test Node 1") -n.content.add("Test Node 2") -doc.header.notes.add(n) - -doc.trade.agreement.seller.name = "Lieferant GmbH" -""" - -samplexml = open("sample.xml", "rb").read() -doc = Document.parse(samplexml) -print(prettify(doc.serialize())) diff --git a/drafthorse/models/elements.py b/drafthorse/models/elements.py index c7fc2c2..16c5b44 100644 --- a/drafthorse/models/elements.py +++ b/drafthorse/models/elements.py @@ -1,16 +1,14 @@ import sys -from decimal import Decimal - -from datetime import date, datetime - import xml.etree.cElementTree as ET from collections import OrderedDict +from datetime import datetime +from decimal import Decimal from drafthorse.utils import validate_xml from . import NS_UDT -from .fields import Field from .container import Container +from .fields import Field class BaseElementMeta(type): diff --git a/drafthorse/models/fields.py b/drafthorse/models/fields.py index 0da21fe..c50d8a3 100644 --- a/drafthorse/models/fields.py +++ b/drafthorse/models/fields.py @@ -1,5 +1,6 @@ -from .container import Container, StringContainer, CurrencyContainer, IDContainer from . import BASIC +from .container import (Container, CurrencyContainer, IDContainer, + StringContainer) class Field: diff --git a/drafthorse/models/tradelines.py b/drafthorse/models/tradelines.py index d4d3d0b..b60e1a0 100644 --- a/drafthorse/models/tradelines.py +++ b/drafthorse/models/tradelines.py @@ -1,6 +1,6 @@ from . import BASIC, COMFORT, EXTENDED, NS_RAM -from .accounting import (AccountingAccount, BillingSpecifiedPeriod, - TradeAllowanceCharge, ApplicableTradeTax) +from .accounting import (AccountingAccount, ApplicableTradeTax, + BillingSpecifiedPeriod, TradeAllowanceCharge) from .delivery import SupplyChainEvent from .elements import Element from .fields import (CurrencyField, Field, MultiField, QuantityField, diff --git a/tests/test_roundtrip.py b/tests/test_roundtrip.py index c4bb25f..e358e93 100644 --- a/tests/test_roundtrip.py +++ b/tests/test_roundtrip.py @@ -15,4 +15,4 @@ def test_sample_roundtrip(filename): origxml = prettify(open(os.path.join(os.path.dirname(__file__), 'samples', filename), 'r').read()) doc = Document.parse(origxml) generatedxml = prettify(doc.serialize()) - assert generatedxml.decode().strip() == origxml.decode().strip() \ No newline at end of file + assert generatedxml.decode().strip() == origxml.decode().strip() -- 2.47.3