Skip to content

Commit 3e2f68d

Browse files
committed
perf: and fix, avoid calling get_test_account
1 parent 1d6b56c commit 3e2f68d

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/ape/managers/accounts.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,12 @@ def __getitem__(self, account_id):
8282

8383
@__getitem__.register
8484
def __getitem_int(self, account_id: int):
85-
if account_id in self._accounts_by_index:
86-
return self._accounts_by_index[account_id]
87-
88-
original_account_id = account_id
8985
if account_id < 0:
9086
account_id = len(self) + account_id
9187

88+
if account_id in self._accounts_by_index:
89+
return self._accounts_by_index[account_id]
90+
9291
account = self.containers["test"].get_test_account(account_id)
9392
self._accounts_by_index[original_account_id] = account
9493
return account

0 commit comments

Comments
 (0)