From: Raphael Michel Date: Mon, 15 Oct 2018 18:52:56 +0000 (+0200) Subject: Fix lint errors X-Git-Tag: 1.0.0~22 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8e063d095e2552e396b7ea901871075305b57b2c;p=thirdparty%2Fpython-drafthorse.git Fix lint errors --- diff --git a/drafthorse/models/accounting.py b/drafthorse/models/accounting.py index f2c5653..af0cce6 100644 --- a/drafthorse/models/accounting.py +++ b/drafthorse/models/accounting.py @@ -1,6 +1,7 @@ -from . import NS_RAM, COMFORT, EXTENDED, BASIC +from . import BASIC, COMFORT, EXTENDED, NS_RAM from .elements import Element -from .fields import DateTimeField, StringField, CurrencyField, DecimalField, MultiField, IndicatorField +from .fields import (CurrencyField, DateTimeField, DecimalField, + IndicatorField, MultiField, StringField) class LineApplicableTradeTax(Element): diff --git a/drafthorse/models/delivery.py b/drafthorse/models/delivery.py index aaf071c..be6d9c7 100644 --- a/drafthorse/models/delivery.py +++ b/drafthorse/models/delivery.py @@ -1,8 +1,10 @@ -from . import NS_RAM, BASIC, EXTENDED +from . import BASIC, EXTENDED, NS_RAM from .elements import Element -from .fields import DateTimeField, StringField, IDField, Field -from .party import ShipToTradeParty, ShipFromTradeParty, UltimateShipToTradeParty -from .references import DespatchAdviceReferencedDocument, DeliveryNoteReferencedDocument +from .fields import DateTimeField, Field, IDField, StringField +from .party import (ShipFromTradeParty, ShipToTradeParty, + UltimateShipToTradeParty) +from .references import (DeliveryNoteReferencedDocument, + DespatchAdviceReferencedDocument) class SupplyChainEvent(Element): diff --git a/drafthorse/models/document.py b/drafthorse/models/document.py index ea212c4..7aa4113 100644 --- a/drafthorse/models/document.py +++ b/drafthorse/models/document.py @@ -1,9 +1,11 @@ import xml.etree.cElementTree as ET from drafthorse.models.note import IncludedNote -from . import NS_FERD_1p0, NS_UDT, NS_RAM, EXTENDED, BASIC + +from . import BASIC, EXTENDED, NS_RAM, NS_UDT, NS_FERD_1p0 from .elements import Element -from .fields import DateTimeField, Field, MultiField, StringField, IndicatorField, MultiStringField +from .fields import (DateTimeField, Field, IndicatorField, MultiField, + MultiStringField, StringField) from .trade import TradeTransaction diff --git a/drafthorse/models/elements.py b/drafthorse/models/elements.py index 404be1b..bc3c2b4 100644 --- a/drafthorse/models/elements.py +++ b/drafthorse/models/elements.py @@ -3,6 +3,7 @@ import xml.etree.cElementTree as ET from collections import OrderedDict from drafthorse.utils import validate_xml + from . import NS_UDT from .fields import Field @@ -52,7 +53,6 @@ class Element(metaclass=BaseElementMeta): return xml - class StringElement(Element): def __init__(self, namespace, tag, text=""): super().__init__() diff --git a/drafthorse/models/note.py b/drafthorse/models/note.py index 0be9225..997a632 100644 --- a/drafthorse/models/note.py +++ b/drafthorse/models/note.py @@ -1,6 +1,6 @@ -from . import NS_RAM, BASIC, COMFORT, EXTENDED +from . import BASIC, COMFORT, EXTENDED, NS_RAM from .elements import Element -from .fields import StringField, MultiStringField +from .fields import MultiStringField, StringField class IncludedNote(Element): diff --git a/drafthorse/models/party.py b/drafthorse/models/party.py index ae15492..b037339 100644 --- a/drafthorse/models/party.py +++ b/drafthorse/models/party.py @@ -1,6 +1,6 @@ -from . import NS_RAM, COMFORT, BASIC, EXTENDED +from . import BASIC, COMFORT, EXTENDED, NS_RAM from .elements import Element -from .fields import StringField, Field, IDField, MultiField, MultiIDField +from .fields import Field, IDField, MultiField, MultiIDField, StringField class PostalTradeAddress(Element): diff --git a/drafthorse/models/payment.py b/drafthorse/models/payment.py index 2028db5..c6c6232 100644 --- a/drafthorse/models/payment.py +++ b/drafthorse/models/payment.py @@ -1,7 +1,8 @@ -from . import NS_RAM, COMFORT, BASIC, EXTENDED +from . import BASIC, COMFORT, EXTENDED, NS_RAM from .elements import Element -from .fields import Field, StringField, IDField, DateTimeField, DecimalField, CurrencyField, MultiStringField, \ - MultiCurrencyField +from .fields import (CurrencyField, DateTimeField, DecimalField, Field, + IDField, MultiCurrencyField, MultiStringField, + StringField) class PayerFinancialAccount(Element): diff --git a/drafthorse/models/product.py b/drafthorse/models/product.py index 47a83b9..62c0126 100644 --- a/drafthorse/models/product.py +++ b/drafthorse/models/product.py @@ -1,6 +1,7 @@ -from . import NS_RAM, EXTENDED, COMFORT +from . import COMFORT, EXTENDED, NS_RAM from .elements import Element -from .fields import StringField, QuantityField, IDField, MultiField, ClassificationField +from .fields import (ClassificationField, IDField, MultiField, QuantityField, + StringField) class ProductCharacteristic(Element): diff --git a/drafthorse/models/trade.py b/drafthorse/models/trade.py index b1536c7..1860d72 100644 --- a/drafthorse/models/trade.py +++ b/drafthorse/models/trade.py @@ -1,15 +1,17 @@ -from . import NS_RAM, COMFORT, EXTENDED, BASIC, NS_FERD_1p0 -from .accounting import ApplicableTradeTax, BillingSpecifiedPeriod, MonetarySummation, \ - AccountingAccount -from .accounting import TradeAllowanceCharge +from . import BASIC, COMFORT, EXTENDED, NS_RAM, NS_FERD_1p0 +from .accounting import (AccountingAccount, ApplicableTradeTax, + BillingSpecifiedPeriod, MonetarySummation, + TradeAllowanceCharge) from .delivery import TradeDelivery from .elements import Element -from .fields import Field, MultiField, StringField, CurrencyField -from .party import PayeeTradeParty, SellerTradeParty, BuyerTradeParty, \ - EndUserTradeParty, InvoiceeTradeParty +from .fields import CurrencyField, Field, MultiField, StringField +from .party import (BuyerTradeParty, EndUserTradeParty, InvoiceeTradeParty, + PayeeTradeParty, SellerTradeParty) from .payment import PaymentMeans, PaymentTerms -from .references import CustomerOrderReferencedDocument, ContractReferencedDocument, BuyerOrderReferencedDocument, \ - AdditionalReferencedDocument +from .references import (AdditionalReferencedDocument, + BuyerOrderReferencedDocument, + ContractReferencedDocument, + CustomerOrderReferencedDocument) from .tradelines import LineItem diff --git a/drafthorse/models/tradelines.py b/drafthorse/models/tradelines.py index c79a8e8..ad0e0db 100644 --- a/drafthorse/models/tradelines.py +++ b/drafthorse/models/tradelines.py @@ -1,14 +1,21 @@ from drafthorse.models.delivery import SupplyChainEvent -from . import NS_RAM, BASIC, COMFORT, EXTENDED -from .accounting import TradeAllowanceCharge, BillingSpecifiedPeriod, AccountingAccount + +from . import BASIC, COMFORT, EXTENDED, NS_RAM +from .accounting import (AccountingAccount, BillingSpecifiedPeriod, + TradeAllowanceCharge) from .elements import Element -from .fields import CurrencyField, QuantityField, Field, MultiField, StringField +from .fields import (CurrencyField, Field, MultiField, QuantityField, + StringField) from .note import IncludedNote -from .party import UltimateShipToTradeParty, ShipToTradeParty +from .party import ShipToTradeParty, UltimateShipToTradeParty from .product import TradeProduct -from .references import LineReceivingAdviceReferencedDocument, LineDespatchAdviceReferencedDocument, \ - LineDeliveryNoteReferencedDocument, LineCustomerOrderReferencedDocument, LineContractReferencedDocument, \ - LineBuyerOrderReferencedDocument, LineAdditionalReferencedDocument +from .references import (LineAdditionalReferencedDocument, + LineBuyerOrderReferencedDocument, + LineContractReferencedDocument, + LineCustomerOrderReferencedDocument, + LineDeliveryNoteReferencedDocument, + LineDespatchAdviceReferencedDocument, + LineReceivingAdviceReferencedDocument) class AllowanceCharge(TradeAllowanceCharge): diff --git a/drafthorse/utils.py b/drafthorse/utils.py index 1e190c8..4ad6e3d 100644 --- a/drafthorse/utils.py +++ b/drafthorse/utils.py @@ -1,11 +1,10 @@ import logging import os - from xml.dom import minidom - logger = logging.getLogger("drafthorse") + def prettify(xml): reparsed = minidom.parseString(xml) return reparsed.toprettyxml(indent="\t") diff --git a/setup.py b/setup.py index 0117954..17178f3 100644 --- a/setup.py +++ b/setup.py @@ -1,16 +1,17 @@ from codecs import open from os import path -from sepadd import version from setuptools import find_packages, setup +from sepadd import version + here = path.abspath(path.dirname(__file__)) try: # Get the long description from the relevant file with open(path.join(here, 'README.rst'), encoding='utf-8') as f: long_description = f.read() -except: +except: # noqa long_description = '' setup( @@ -34,6 +35,7 @@ setup( keywords='xml banking sepa', install_requires=[ + 'lxml' ], packages=find_packages(include=['sepadd', 'sepadd.*']),