Skip to content

Commit 33433c8

Browse files
committed
pyright fixes (fork_criteria.py)
1 parent 4fd0bdd commit 33433c8

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/ethereum/fork_criteria.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
from typing import Final, Literal, SupportsInt, Tuple
3030

3131
from ethereum_types.numeric import U256, Uint
32+
from typing_extensions import override
3233

3334

3435
@functools.total_ordering
@@ -68,6 +69,7 @@ class ForkCriteria(ABC):
6869

6970
_internal: Tuple[int, int]
7071

72+
@override
7173
def __eq__(self, other: object) -> bool:
7274
"""
7375
Equality for fork criteria.
@@ -92,6 +94,7 @@ def __lt__(self, other: object) -> bool:
9294
return self._internal < other._internal
9395
return NotImplemented
9496

97+
@override
9598
def __hash__(self) -> int:
9699
"""
97100
Compute a hash for this instance, so it can be stored in dictionaries.
@@ -108,6 +111,7 @@ def check(self, block_number: Uint, timestamp: U256) -> bool:
108111
"""
109112
raise NotImplementedError()
110113

114+
@override
111115
@abstractmethod
112116
def __repr__(self) -> str:
113117
"""
@@ -127,9 +131,11 @@ class ByBlockNumber(ForkCriteria):
127131
"""
128132

129133
def __init__(self, block_number: SupportsInt):
134+
super().__init__()
130135
self._internal = (ForkCriteria.BLOCK_NUMBER, int(block_number))
131136
self.block_number = Uint(int(block_number))
132137

138+
@override
133139
def check(self, block_number: Uint, timestamp: U256) -> bool:
134140
"""
135141
Check whether the block number has been reached.
@@ -141,6 +147,7 @@ def check(self, block_number: Uint, timestamp: U256) -> bool:
141147
"""
142148
return block_number >= self.block_number
143149

150+
@override
144151
def __repr__(self) -> str:
145152
"""
146153
String representation of this object.
@@ -159,9 +166,11 @@ class ByTimestamp(ForkCriteria):
159166
"""
160167

161168
def __init__(self, timestamp: SupportsInt):
169+
super().__init__()
162170
self._internal = (ForkCriteria.TIMESTAMP, int(timestamp))
163171
self.timestamp = U256(timestamp)
164172

173+
@override
165174
def check(self, block_number: Uint, timestamp: U256) -> bool:
166175
"""
167176
Check whether the timestamp has been reached.
@@ -173,6 +182,7 @@ def check(self, block_number: Uint, timestamp: U256) -> bool:
173182
"""
174183
return timestamp >= self.timestamp
175184

185+
@override
176186
def __repr__(self) -> str:
177187
"""
178188
String representation of this object.
@@ -186,14 +196,17 @@ class Unscheduled(ForkCriteria):
186196
"""
187197

188198
def __init__(self) -> None:
199+
super().__init__()
189200
self._internal = (ForkCriteria.UNSCHEDULED, 0)
190201

202+
@override
191203
def check(self, block_number: Uint, timestamp: U256) -> Literal[False]:
192204
"""
193205
Unscheduled forks never occur; always returns `False`.
194206
"""
195207
return False
196208

209+
@override
197210
def __repr__(self) -> str:
198211
"""
199212
String representation of this object.

0 commit comments

Comments
 (0)