From 3e2f68d1cd9cbdd81432c082cef207840496f572 Mon Sep 17 00:00:00 2001 From: antazoey Date: Mon, 6 Jan 2025 19:01:32 -0600 Subject: [PATCH] perf: and fix, avoid calling get_test_account --- src/ape/managers/accounts.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/ape/managers/accounts.py b/src/ape/managers/accounts.py index 860925710f..3c2630eab4 100644 --- a/src/ape/managers/accounts.py +++ b/src/ape/managers/accounts.py @@ -82,13 +82,12 @@ def __getitem__(self, account_id): @__getitem__.register def __getitem_int(self, account_id: int): - if account_id in self._accounts_by_index: - return self._accounts_by_index[account_id] - - original_account_id = account_id if account_id < 0: account_id = len(self) + account_id + if account_id in self._accounts_by_index: + return self._accounts_by_index[account_id] + account = self.containers["test"].get_test_account(account_id) self._accounts_by_index[original_account_id] = account return account