From 9f42ebe71f24a30895cebccb790dde4239541dc4 Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Wed, 12 Dec 2018 16:10:27 +0100 Subject: [PATCH] More linting issues --- drafthorse/models/accounting.py | 6 ++++-- drafthorse/models/delivery.py | 10 ++++++---- drafthorse/models/document.py | 6 ++++-- drafthorse/models/fields.py | 5 +++-- drafthorse/models/payment.py | 7 ++++--- drafthorse/models/product.py | 5 +++-- drafthorse/models/trade.py | 21 ++++++++++++--------- drafthorse/models/tradelines.py | 24 +++++++++++++----------- drafthorse/pdf.py | 8 ++++---- setup.cfg | 9 +++++++++ 10 files changed, 62 insertions(+), 39 deletions(-) diff --git a/drafthorse/models/accounting.py b/drafthorse/models/accounting.py index 4316610..d3da9cc 100644 --- a/drafthorse/models/accounting.py +++ b/drafthorse/models/accounting.py @@ -1,7 +1,9 @@ from . import BASIC, COMFORT, EXTENDED, NS_RAM from .elements import Element -from .fields import (CurrencyField, DateTimeField, DecimalField, - IndicatorField, MultiField, QuantityField, StringField) +from .fields import ( + CurrencyField, DateTimeField, DecimalField, IndicatorField, MultiField, + QuantityField, StringField, +) class LineApplicableTradeTax(Element): diff --git a/drafthorse/models/delivery.py b/drafthorse/models/delivery.py index 8bec84d..ecf2a77 100644 --- a/drafthorse/models/delivery.py +++ b/drafthorse/models/delivery.py @@ -1,10 +1,12 @@ from . import BASIC, EXTENDED, NS_RAM from .elements import Element from .fields import DateTimeField, Field, IDField, StringField -from .party import (ShipFromTradeParty, ShipToTradeParty, - UltimateShipToTradeParty) -from .references import (DeliveryNoteReferencedDocument, - DespatchAdviceReferencedDocument) +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 c1c5b08..dc50883 100644 --- a/drafthorse/models/document.py +++ b/drafthorse/models/document.py @@ -4,8 +4,10 @@ from drafthorse.models.note import IncludedNote from . import BASIC, EXTENDED, NS_RAM, NS_UDT, NS_FERD_1p0 from .elements import Element -from .fields import (DateTimeField, Field, IndicatorField, MultiField, - MultiStringField, StringField) +from .fields import ( + DateTimeField, Field, IndicatorField, MultiField, MultiStringField, + StringField, +) from .trade import TradeTransaction diff --git a/drafthorse/models/fields.py b/drafthorse/models/fields.py index d558370..079494d 100644 --- a/drafthorse/models/fields.py +++ b/drafthorse/models/fields.py @@ -1,6 +1,7 @@ from . import BASIC -from .container import (Container, CurrencyContainer, IDContainer, - StringContainer) +from .container import ( + Container, CurrencyContainer, IDContainer, StringContainer, +) class Field: diff --git a/drafthorse/models/payment.py b/drafthorse/models/payment.py index dc41d6b..9a36cf9 100644 --- a/drafthorse/models/payment.py +++ b/drafthorse/models/payment.py @@ -1,8 +1,9 @@ from . import BASIC, COMFORT, EXTENDED, NS_RAM from .elements import Element -from .fields import (AgencyIDField, CurrencyField, DateTimeField, DecimalField, - Field, MultiCurrencyField, MultiStringField, - QuantityField, StringField) +from .fields import ( + AgencyIDField, CurrencyField, DateTimeField, DecimalField, Field, + MultiCurrencyField, MultiStringField, QuantityField, StringField, +) class PayerFinancialAccount(Element): diff --git a/drafthorse/models/product.py b/drafthorse/models/product.py index d153794..fc066d4 100644 --- a/drafthorse/models/product.py +++ b/drafthorse/models/product.py @@ -1,7 +1,8 @@ from . import COMFORT, EXTENDED, NS_RAM from .elements import Element -from .fields import (ClassificationField, IDField, MultiField, QuantityField, - StringField) +from .fields import ( + ClassificationField, IDField, MultiField, QuantityField, StringField, +) class ProductCharacteristic(Element): diff --git a/drafthorse/models/trade.py b/drafthorse/models/trade.py index 892d58b..985d78b 100644 --- a/drafthorse/models/trade.py +++ b/drafthorse/models/trade.py @@ -1,17 +1,20 @@ from . import BASIC, COMFORT, EXTENDED, NS_RAM, NS_FERD_1p0 -from .accounting import (ApplicableTradeTax, AppliedTradeTax, - BillingSpecifiedPeriod, MonetarySummation, - ReceivableAccountingAccount, TradeAllowanceCharge) +from .accounting import ( + ApplicableTradeTax, AppliedTradeTax, BillingSpecifiedPeriod, + MonetarySummation, ReceivableAccountingAccount, TradeAllowanceCharge, +) from .delivery import TradeDelivery from .elements import Element from .fields import CurrencyField, Field, MultiField, StringField -from .party import (BuyerTradeParty, EndUserTradeParty, InvoiceeTradeParty, - PayeeTradeParty, SellerTradeParty) +from .party import ( + BuyerTradeParty, EndUserTradeParty, InvoiceeTradeParty, PayeeTradeParty, + SellerTradeParty, +) from .payment import PaymentMeans, PaymentTerms -from .references import (AdditionalReferencedDocument, - BuyerOrderReferencedDocument, - ContractReferencedDocument, - CustomerOrderReferencedDocument) +from .references import ( + AdditionalReferencedDocument, BuyerOrderReferencedDocument, + ContractReferencedDocument, CustomerOrderReferencedDocument, +) from .tradelines import LineItem diff --git a/drafthorse/models/tradelines.py b/drafthorse/models/tradelines.py index b4082a7..f2d05c6 100644 --- a/drafthorse/models/tradelines.py +++ b/drafthorse/models/tradelines.py @@ -1,20 +1,22 @@ from . import BASIC, COMFORT, EXTENDED, NS_RAM -from .accounting import (AccountingAccount, ApplicableTradeTax, - BillingSpecifiedPeriod, TradeAllowanceCharge) +from .accounting import ( + AccountingAccount, ApplicableTradeTax, BillingSpecifiedPeriod, + TradeAllowanceCharge, +) from .delivery import SupplyChainEvent from .elements import Element -from .fields import (CurrencyField, Field, MultiField, QuantityField, - StringField) +from .fields import ( + CurrencyField, Field, MultiField, QuantityField, StringField, +) from .note import IncludedNote from .party import ShipToTradeParty, UltimateShipToTradeParty from .product import TradeProduct -from .references import (LineAdditionalReferencedDocument, - LineBuyerOrderReferencedDocument, - LineContractReferencedDocument, - LineCustomerOrderReferencedDocument, - LineDeliveryNoteReferencedDocument, - LineDespatchAdviceReferencedDocument, - LineReceivingAdviceReferencedDocument) +from .references import ( + LineAdditionalReferencedDocument, LineBuyerOrderReferencedDocument, + LineContractReferencedDocument, LineCustomerOrderReferencedDocument, + LineDeliveryNoteReferencedDocument, LineDespatchAdviceReferencedDocument, + LineReceivingAdviceReferencedDocument, +) class AllowanceCharge(TradeAllowanceCharge): diff --git a/drafthorse/pdf.py b/drafthorse/pdf.py index ca02266..2497634 100644 --- a/drafthorse/pdf.py +++ b/drafthorse/pdf.py @@ -25,15 +25,15 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. import datetime -import hashlib import os from io import BytesIO from lxml import etree - from PyPDF2 import PdfFileReader, PdfFileWriter -from PyPDF2.generic import (ArrayObject, DecodedStreamObject, DictionaryObject, - NameObject, createStringObject) +from PyPDF2.generic import ( + ArrayObject, DecodedStreamObject, DictionaryObject, NameObject, + createStringObject, +) def attach_xml(original_pdf, xml_data, level='BASIC'): diff --git a/setup.cfg b/setup.cfg index 1fd4893..3ea7da9 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,2 +1,11 @@ [flake8] max-line-length = 160 + +[isort] +combine_as_imports = true +default_section = THIRDPARTY +include_trailing_comma = true +known_first_party = drafthorse +known_standard_library = typing,enum,mimetypes +multi_line_output = 5 +not_skip = __init__.py -- 2.47.3