diff --git a/firefly/accounts.py b/firefly/accounts.py index aad6806..50aedcb 100644 --- a/firefly/accounts.py +++ b/firefly/accounts.py @@ -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(): diff --git a/firefly/budgets.py b/firefly/budgets.py index be52af8..41ab352 100644 --- a/firefly/budgets.py +++ b/firefly/budgets.py @@ -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):