Skip to content

Commit 7facf72

Browse files
committed
Update web3.py
1 parent 02a4ccd commit 7facf72

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

brownie/network/web3.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import time
55
from json.decoder import JSONDecodeError
66
from pathlib import Path
7-
from typing import Dict, Optional, Set
7+
from typing import Dict, Final, Optional, Set, final
88

99
from ens import ENS
1010
from eth_typing import ChecksumAddress, HexStr
@@ -22,9 +22,10 @@
2222
from brownie.exceptions import MainnetUndefined, UnsetENSName
2323
from brownie.network.middlewares import get_middlewares
2424

25-
_chain_uri_cache: Dict = {}
25+
_chain_uri_cache: Final[Dict] = {}
2626

2727

28+
@final
2829
class Web3(_Web3):
2930
"""Brownie Web3 subclass"""
3031

@@ -217,11 +218,15 @@ def _resolve_address(domain: str) -> ChecksumAddress:
217218
return _ens_cache[domain][0]
218219

219220

220-
web3 = Web3()
221+
web3: Final = Web3()
221222
web3.eth.set_gas_price_strategy(rpc_gas_price_strategy)
222223

223224
try:
224225
with _get_path().open() as fp:
225-
_ens_cache: Dict = json_load(fp)
226+
__ens_cache: Dict = json_load(fp)
226227
except (FileNotFoundError, JSONDecodeError):
227-
_ens_cache = {}
228+
__ens_cache = {}
229+
230+
_ens_cache: Final[Dict] = __ens_cache
231+
del __ens_cache
232+

0 commit comments

Comments
 (0)