Skip to content

Commit

Permalink
[fix] linting
Browse files Browse the repository at this point in the history
  • Loading branch information
grindsa committed Jan 2, 2025
1 parent 9fb5a58 commit deb8cd1
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 30 deletions.
33 changes: 18 additions & 15 deletions dkb_robo/exemptionorder.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
""" Module for handling dkb standing orders """
from typing import Dict, List
from dataclasses import dataclass, field
from typing import Dict, List, Optional
from dataclasses import dataclass
import logging
import requests
from dkb_robo.utilities import Amount, DKBRoboError, filter_unexpected_fields, object2dictionary
Expand All @@ -13,25 +13,28 @@
@dataclass
class PartnerItem:
""" class for a single partner """
dateOfBirth: str = None
firstName: str = None
lastName: str = None
salutation: str = None
taxId: str = None
# pylint: disable=C0103
dateOfBirth: Optional[str] = None
firstName: Optional[str] = None
lastName: Optional[str] = None
salutation: Optional[str] = None
taxId: Optional[str] = None


@filter_unexpected_fields
@dataclass
class ExemptionOrderItem:
""" class for a single exemption order """
exemptionAmount: str = None
exemptionOrderType: str = None
partner: str = None
receivedAt: str = None
utilizedAmount: str = None
remainingAmount: str = None
validFrom: str = None
validUntil: str = None
# pylint: disable=C0103
exemptionAmount: Optional[str] = None
exemptionOrderType: Optional[str] = None
partner: Optional[str] = None
receivedAt: Optional[str] = None
utilizedAmount: Optional[str] = None
remainingAmount: Optional[str] = None
validFrom: Optional[str] = None
validUntil: Optional[str] = None

def __post_init__(self):
self.exemptionAmount = Amount(**self.exemptionAmount)
self.remainingAmount = Amount(**self.remainingAmount)
Expand Down
24 changes: 12 additions & 12 deletions dkb_robo/standingorder.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,28 @@
@dataclass
class CreditorAccount:
""" class for a single creditor account """
iban: str = None
bic: str = None
name: str = None
iban: Optional[str] = None
bic: Optional[str] = None
name: Optional[str] = None


@filter_unexpected_fields
@dataclass
class DebtorAccount:
""" class for a single debitor account """
iban: str = None
accountId: str = None # pylint: disable=C0103 # NOSONAR
iban: Optional[str] = None
accountId: Optional[str] = None # pylint: disable=C0103 # NOSONAR


@filter_unexpected_fields
@dataclass
class Recurrence:
""" class for frequency account """
frm: str = None
frequency: str = None
holidayExecutionStrategy: str = None # pylint: disable=C0103 # NOSONAR
nextExecutionAt: str = None # pylint: disable=C0103 # NOSONAR
until: str = None
frm: Optional[str] = None
frequency: Optional[str] = None
holidayExecutionStrategy: Optional[str] = None # pylint: disable=C0103 # NOSONAR
nextExecutionAt: Optional[str] = None # pylint: disable=C0103 # NOSONAR
until: Optional[str] = None


@filter_unexpected_fields
Expand All @@ -44,10 +44,10 @@ class StandingOrderItem:
amount: Optional[Amount] = None
creditor: Optional[CreditorAccount] = None
debtor: Optional[DebtorAccount] = None
description: str = None
description: Optional[str] = None
messages: List[str] = field(default_factory=list)
recurrence: Optional[Recurrence] = None
status: str = None
status: Optional[str] = None

def __post_init__(self):
self.amount = Amount(**self.amount)
Expand Down
7 changes: 4 additions & 3 deletions dkb_robo/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def get_dateformat():
@dataclass
class Amount:
""" Amount data class, roughly based on the JSON API response. """
# pylint: disable=c0103
value: float = None
currencyCode: str = None

Expand Down Expand Up @@ -94,13 +95,13 @@ def get_valid_filename(name):
s = f'{generate_random_string(8)}.pdf'
return s + p.suffix

def object2dictionary(obj, key_lc=False, skip_list = []):

def object2dictionary(obj, key_lc=False, skip_list=None):
""" convert object to dict """

output_dict = {}

for k, v in asdict(obj).items():
if k in skip_list:
if isinstance(skip_list, list) and k in skip_list:
continue
if isinstance(v, dict):
output_dict[k] = object2dictionary(v, key_lc=key_lc)
Expand Down

0 comments on commit deb8cd1

Please sign in to comment.