Skip to content

Commit 017e206

Browse files
Bhargavasomucburgdorf
authored andcommitted
Enable complete type hinting for eth.rlp
1 parent 88c7256 commit 017e206

File tree

2 files changed

+22
-19
lines changed

2 files changed

+22
-19
lines changed

eth/rlp/headers.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -108,22 +108,22 @@ def __init__(self,
108108
nonce: bytes=GENESIS_NONCE) -> None:
109109
...
110110

111-
def __init__(self, # noqa: F811
112-
difficulty,
113-
block_number,
114-
gas_limit,
115-
timestamp=None,
116-
coinbase=ZERO_ADDRESS,
117-
parent_hash=ZERO_HASH32,
118-
uncles_hash=EMPTY_UNCLE_HASH,
119-
state_root=BLANK_ROOT_HASH,
120-
transaction_root=BLANK_ROOT_HASH,
121-
receipt_root=BLANK_ROOT_HASH,
122-
bloom=0,
123-
gas_used=0,
124-
extra_data=b'',
125-
mix_hash=ZERO_HASH32,
126-
nonce=GENESIS_NONCE):
111+
def __init__(self, # type: ignore # noqa: F811
112+
difficulty: int,
113+
block_number: int,
114+
gas_limit: int,
115+
timestamp: int=None,
116+
coinbase: Address=ZERO_ADDRESS,
117+
parent_hash: Hash32=ZERO_HASH32,
118+
uncles_hash: Hash32=EMPTY_UNCLE_HASH,
119+
state_root: Hash32=BLANK_ROOT_HASH,
120+
transaction_root: Hash32=BLANK_ROOT_HASH,
121+
receipt_root: Hash32=BLANK_ROOT_HASH,
122+
bloom: int=0,
123+
gas_used: int=0,
124+
extra_data: bytes=b'',
125+
mix_hash: Hash32=ZERO_HASH32,
126+
nonce: bytes=GENESIS_NONCE) -> None:
127127
if timestamp is None:
128128
timestamp = int(time.time())
129129
super().__init__(
@@ -163,7 +163,7 @@ def mining_hash(self) -> Hash32:
163163
return keccak(rlp.encode(self[:-2], MiningHeader))
164164

165165
@property
166-
def hex_hash(self):
166+
def hex_hash(self) -> str:
167167
return encode_hex(self.hash)
168168

169169
@classmethod

eth/rlp/logs.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44
binary,
55
)
66

7-
from typing import List
7+
from typing import (
8+
List,
9+
Tuple,
10+
)
811

912
from .sedes import (
1013
address,
@@ -23,7 +26,7 @@ def __init__(self, address: bytes, topics: List[int], data: bytes) -> None:
2326
super().__init__(address, topics, data)
2427

2528
@property
26-
def bloomables(self):
29+
def bloomables(self) -> Tuple[bytes, ...]:
2730
return (
2831
self.address,
2932
) + tuple(

0 commit comments

Comments
 (0)