-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove web3py from dependencies (#14)
* Remove web3py from dependencies Signed-off-by: cyc60 <avsysoev60@gmail.com> * Review fix Signed-off-by: cyc60 <avsysoev60@gmail.com> --------- Signed-off-by: cyc60 <avsysoev60@gmail.com>
- Loading branch information
Showing
6 changed files
with
398 additions
and
1,661 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,28 @@ | ||
from typing import Optional | ||
|
||
from eth_typing import HexStr, Primitives | ||
from eth_utils import keccak as eth_utils_keccak | ||
from eth_utils import to_bytes | ||
|
||
|
||
def check_bounds(array: list, index: int) -> None: | ||
if index < 0 or index >= len(array): | ||
raise ValueError("Index out of bounds") | ||
|
||
|
||
def keccak( | ||
primitive: Optional[Primitives] = None, | ||
text: Optional[str] = None, | ||
hexstr: Optional[HexStr] = None, | ||
) -> bytes: | ||
""" Taken from web3py """ | ||
if isinstance(primitive, (bytes, int, type(None))): | ||
input_bytes = to_bytes(primitive, hexstr=hexstr, text=text) | ||
return eth_utils_keccak(input_bytes) | ||
|
||
raise TypeError( | ||
f"You called keccak with first arg {primitive!r} and keywords " | ||
f"{{'text': {text!r}, 'hexstr': {hexstr!r}}}. You must call it with " | ||
"one of these approaches: keccak(text='txt'), keccak(hexstr='0x747874'), " | ||
"keccak(b'\\x74\\x78\\x74'), or keccak(0x747874)." | ||
) |
Oops, something went wrong.