From eb4518f45dfc71d65be150e185a1a7aa0d7376bc Mon Sep 17 00:00:00 2001 From: Daniel Schiavini Date: Mon, 23 Sep 2024 12:46:23 +0200 Subject: [PATCH] Extract regex --- boa/contracts/vvm/vvm_contract.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/boa/contracts/vvm/vvm_contract.py b/boa/contracts/vvm/vvm_contract.py index 5275a80d..3df6c8d1 100644 --- a/boa/contracts/vvm/vvm_contract.py +++ b/boa/contracts/vvm/vvm_contract.py @@ -246,13 +246,14 @@ class VVMStorageVariable(_VVMInternal): It will temporarily change the bytecode at the contract's address. """ + _hashmap_regex = re.compile(r"^HashMap\[([^[]+), (.+)]$") + def __init__(self, name, spec, contract): value_type = spec["type"] inputs = [] - regex = re.compile(r"^HashMap\[([^[]+), (.+)]$") while value_type.startswith("HashMap"): - key_type, value_type = regex.match(value_type).groups() + key_type, value_type = self._hashmap_regex.match(value_type).groups() inputs.append({"name": f"key{len(inputs)}", "type": key_type}) abi = {