code style

This commit is contained in:
chris 2020-10-25 21:13:36 +01:00
parent a9de27fdef
commit 38416fc6d7
2 changed files with 8 additions and 10 deletions

View File

@ -22,11 +22,10 @@ def _get_asset_accounts():
).json()
accounts.extend(accounts_json.get('data'))
asset_accounts = []
for account in accounts:
if account.get('attributes').get('type') == "asset":
asset_accounts.append(account)
return asset_accounts
return (
asset_account for asset_account in accounts
if asset_account.get('attributes').get('type') == 'asset'
)
def get_account_metrics():

View File

@ -35,12 +35,11 @@ def _get_current_limit(budget_id):
).json()
budgets.extend(budget_json.get('data'))
current_budgets = []
today = datetime.datetime.today()
for budget in budgets:
if today > dateutil.parser.parse(budget.get('attributes').get('start')) and today < dateutil.parser.parse(budget.get('attributes').get('end')):
current_budgets.append(budget)
return current_budgets[0]
return [
budget for budget in budgets
if today > dateutil.parser.parse(budget.get('attributes').get('start')) and today < dateutil.parser.parse(budget.get('attributes').get('end'))
][0]
def _get_current_transactions(budget_id):