Used early outs to reduce indentation

This commit is contained in:
2023-08-29 07:58:23 +00:00
parent 6a948fc69f
commit b51df093dc

View File

@@ -170,43 +170,43 @@ class StarlingClient:
if count == 0:
# I don't think this should happen!
print('This holder has no accounts.')
return
if count == 1:
print('This holder has one account:')
else:
if count == 1:
print('This holder has one account:')
else:
print(f'This holder has {count} accounts:')
for account in accounts:
balance = self.formatted_balance(account.accountUid)
print(f' {account.name}:')
print(f' Balance: {balance}')
print(f' Account type: {account.accountType}')
print(f' Account UID: {account.accountUid}')
print(f' Default category: {account.defaultCategory}')
print(f'This holder has {count} accounts:')
for account in accounts:
balance = self.formatted_balance(account.accountUid)
print(f' {account.name}:')
print(f' Balance: {balance}')
print(f' Account type: {account.accountType}')
print(f' Account UID: {account.accountUid}')
print(f' Default category: {account.defaultCategory}')
def list_payees(self):
payees = self.payees().payees
count = len(payees)
if count == 0:
print('There are no payees for this customer.')
print('There are no payees for this account holder.')
return
if count == 1:
print('There is one payee for this account holder:')
else:
print(f'There are {count} payees for this account holder:')
for payee in payees:
sys.stdout.write(f' {payee.payeeName} ({payee.payeeType}) - ')
count = len(payee.accounts)
if count == 0:
print('no accounts.')
continue
if count == 1:
print('There is one payee for this customer:')
print('one account:')
else:
print(f'There are {count} payees for this customer:')
for payee in payees:
sys.stdout.write(f' {payee.payeeName} ({payee.payeeType}) - ')
count = len(payee.accounts)
if count == 0:
print('no accounts.')
else:
if count == 1:
print('one account:')
else:
print(f'{count} accounts:')
for account in payee.accounts:
sort_code = f'{account.bankIdentifier[0:2]}-{account.bankIdentifier[2:4]}-{account.bankIdentifier[4:6]}'
account_number = account.accountIdentifier
print(f' {account.payeeAccountUid}: {sort_code} {account_number} {account.description}')
print(f'{count} accounts:')
for account in payee.accounts:
sort_code = f'{account.bankIdentifier[0:2]}-{account.bankIdentifier[2:4]}-{account.bankIdentifier[4:6]}'
account_number = account.accountIdentifier
print(f' {account.payeeAccountUid}: {sort_code} {account_number} {account.description}')
def add_payee(self):
details = self.new_payee_form.complete()