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() ).json()
accounts.extend(accounts_json.get('data')) accounts.extend(accounts_json.get('data'))
asset_accounts = [] return (
for account in accounts: asset_account for asset_account in accounts
if account.get('attributes').get('type') == "asset": if asset_account.get('attributes').get('type') == 'asset'
asset_accounts.append(account) )
return asset_accounts
def get_account_metrics(): def get_account_metrics():

View file

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