コード例 #1
0
ファイル: replay_wal.py プロジェクト: hackaugusto/raiden
 def _address_rxp(self, addr):
     """ Create a regex string for addresses, that matches several representations:
         - with(out) '0x' prefix
         - `pex` version
         This function takes care of maintaining additional lookup keys for substring matches.
         In case the given string is no address, it returns the original string.
     """
     try:
         addr = to_checksum_address(addr)
         rxp = '(?:0x)?' + pex(address_checksum_and_decode(addr)) + f'(?:{addr.lower()[10:]})?'
         self._extra_keys[pex(address_checksum_and_decode(addr))] = addr.lower()
         self._extra_keys[addr[2:].lower()] = addr.lower()
     except ValueError:
         rxp = addr
     return rxp
コード例 #2
0
ファイル: replay_wal.py プロジェクト: pirapira/raiden
 def _address_rxp(self, addr):
     """ Create a regex string for addresses, that matches several representations:
         - with(out) '0x' prefix
         - `pex` version
         This function takes care of maintaining additional lookup keys for substring matches.
         In case the given string is no address, it returns the original string.
     """
     try:
         addr = to_checksum_address(addr)
         rxp = '(?:0x)?' + pex(address_checksum_and_decode(addr)) + f'(?:{addr.lower()[10:]})?'
         self._extra_keys[pex(address_checksum_and_decode(addr))] = addr.lower()
         self._extra_keys[addr[2:].lower()] = addr.lower()
     except ValueError:
         rxp = addr
     return rxp