web3 7.0.0b3__py3-none-any.whl → 7.0.0b4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. ens/_normalization.py +1 -3
  2. ens/async_ens.py +12 -9
  3. ens/contract_data.py +2 -2
  4. ens/ens.py +8 -5
  5. ens/exceptions.py +19 -27
  6. ens/specs/nf.json +1 -1
  7. ens/specs/normalization_spec.json +1 -1
  8. ens/utils.py +17 -10
  9. web3/__init__.py +2 -7
  10. web3/_utils/abi.py +30 -29
  11. web3/_utils/async_transactions.py +7 -4
  12. web3/_utils/blocks.py +6 -2
  13. web3/_utils/caching.py +7 -3
  14. web3/_utils/compat/__init__.py +0 -3
  15. web3/_utils/contract_sources/compile_contracts.py +1 -1
  16. web3/_utils/contracts.py +12 -12
  17. web3/_utils/datatypes.py +5 -1
  18. web3/_utils/decorators.py +6 -1
  19. web3/_utils/empty.py +1 -1
  20. web3/_utils/encoding.py +15 -10
  21. web3/_utils/error_formatters_utils.py +5 -3
  22. web3/_utils/events.py +20 -18
  23. web3/_utils/fee_utils.py +2 -4
  24. web3/_utils/filters.py +17 -12
  25. web3/_utils/formatters.py +2 -2
  26. web3/_utils/math.py +3 -2
  27. web3/_utils/method_formatters.py +24 -5
  28. web3/_utils/module.py +2 -1
  29. web3/_utils/module_testing/eth_module.py +62 -69
  30. web3/_utils/module_testing/go_ethereum_personal_module.py +1 -1
  31. web3/_utils/module_testing/module_testing_utils.py +1 -3
  32. web3/_utils/module_testing/utils.py +14 -7
  33. web3/_utils/normalizers.py +3 -3
  34. web3/_utils/request.py +4 -4
  35. web3/_utils/rpc_abi.py +5 -1
  36. web3/_utils/threads.py +8 -7
  37. web3/_utils/transactions.py +14 -12
  38. web3/_utils/type_conversion.py +5 -1
  39. web3/_utils/validation.py +12 -10
  40. web3/contract/async_contract.py +12 -7
  41. web3/contract/base_contract.py +50 -56
  42. web3/contract/contract.py +12 -6
  43. web3/contract/utils.py +11 -6
  44. web3/datastructures.py +22 -12
  45. web3/eth/async_eth.py +33 -28
  46. web3/eth/base_eth.py +7 -3
  47. web3/eth/eth.py +18 -13
  48. web3/exceptions.py +30 -59
  49. web3/gas_strategies/time_based.py +2 -4
  50. web3/geth.py +1 -3
  51. web3/main.py +6 -2
  52. web3/manager.py +7 -5
  53. web3/method.py +13 -5
  54. web3/middleware/base.py +4 -2
  55. web3/middleware/filter.py +27 -17
  56. web3/middleware/formatting.py +6 -3
  57. web3/middleware/names.py +4 -1
  58. web3/middleware/signing.py +6 -2
  59. web3/middleware/stalecheck.py +2 -1
  60. web3/providers/eth_tester/defaults.py +1 -1
  61. web3/providers/eth_tester/main.py +5 -4
  62. web3/providers/eth_tester/middleware.py +10 -1
  63. web3/providers/ipc.py +7 -3
  64. web3/providers/persistent/async_ipc.py +6 -7
  65. web3/providers/persistent/persistent.py +11 -1
  66. web3/providers/persistent/request_processor.py +7 -7
  67. web3/providers/persistent/websocket.py +3 -3
  68. web3/providers/rpc/async_rpc.py +23 -6
  69. web3/providers/rpc/rpc.py +27 -16
  70. web3/testing.py +4 -4
  71. web3/tools/benchmark/main.py +13 -9
  72. web3/tools/benchmark/utils.py +1 -1
  73. web3/tracing.py +9 -5
  74. web3/types.py +19 -22
  75. {web3-7.0.0b3.dist-info → web3-7.0.0b4.dist-info}/METADATA +13 -28
  76. {web3-7.0.0b3.dist-info → web3-7.0.0b4.dist-info}/RECORD +79 -79
  77. {web3-7.0.0b3.dist-info → web3-7.0.0b4.dist-info}/LICENSE +0 -0
  78. {web3-7.0.0b3.dist-info → web3-7.0.0b4.dist-info}/WHEEL +0 -0
  79. {web3-7.0.0b3.dist-info → web3-7.0.0b4.dist-info}/top_level.txt +0 -0
web3/contract/utils.py CHANGED
@@ -43,6 +43,7 @@ from web3._utils.transactions import (
43
43
  )
44
44
  from web3.exceptions import (
45
45
  BadFunctionCallOutput,
46
+ Web3ValueError,
46
47
  )
47
48
  from web3.types import (
48
49
  ABI,
@@ -185,7 +186,8 @@ def estimate_gas_for_function(
185
186
  *args: Any,
186
187
  **kwargs: Any,
187
188
  ) -> int:
188
- """Estimates gas cost a function call would take.
189
+ """
190
+ Estimates gas cost a function call would take.
189
191
 
190
192
  Don't call this directly, instead use :meth:`Contract.estimate_gas`
191
193
  on your contract instance.
@@ -214,7 +216,8 @@ def build_transaction_for_function(
214
216
  *args: Any,
215
217
  **kwargs: Any,
216
218
  ) -> TxParams:
217
- """Builds a dictionary with the fields required to make the given transaction
219
+ """
220
+ Builds a dictionary with the fields required to make the given transaction
218
221
 
219
222
  Don't call this directly, instead use :meth:`Contract.build_transaction`
220
223
  on your contract instance.
@@ -261,11 +264,11 @@ def get_function_by_identifier(
261
264
  fns: Sequence[TContractFn], identifier: str
262
265
  ) -> TContractFn:
263
266
  if len(fns) > 1:
264
- raise ValueError(
267
+ raise Web3ValueError(
265
268
  f"Found multiple functions with matching {identifier}. " f"Found: {fns!r}"
266
269
  )
267
270
  elif len(fns) == 0:
268
- raise ValueError(f"Could not find any function with matching {identifier}")
271
+ raise Web3ValueError(f"Could not find any function with matching {identifier}")
269
272
  return fns[0]
270
273
 
271
274
 
@@ -394,7 +397,8 @@ async def async_estimate_gas_for_function(
394
397
  *args: Any,
395
398
  **kwargs: Any,
396
399
  ) -> int:
397
- """Estimates gas cost a function call would take.
400
+ """
401
+ Estimates gas cost a function call would take.
398
402
 
399
403
  Don't call this directly, instead use :meth:`Contract.estimate_gas`
400
404
  on your contract instance.
@@ -425,7 +429,8 @@ async def async_build_transaction_for_function(
425
429
  *args: Any,
426
430
  **kwargs: Any,
427
431
  ) -> TxParams:
428
- """Builds a dictionary with the fields required to make the given transaction
432
+ """
433
+ Builds a dictionary with the fields required to make the given transaction
429
434
 
430
435
  Don't call this directly, instead use :meth:`Contract.build_transaction`
431
436
  on your contract instance.
web3/datastructures.py CHANGED
@@ -28,6 +28,11 @@ from eth_utils import (
28
28
  from web3._utils.formatters import (
29
29
  recursive_map,
30
30
  )
31
+ from web3.exceptions import (
32
+ Web3AssertionError,
33
+ Web3TypeError,
34
+ Web3ValueError,
35
+ )
31
36
 
32
37
  # Hashable must be immutable:
33
38
  # "the implementation of hashable collections requires that a
@@ -85,7 +90,10 @@ class ReadableAttributeDict(Mapping[TKey, TValue]):
85
90
 
86
91
  @classmethod
87
92
  def recursive(cls, value: TValue) -> "ReadableAttributeDict[TKey, TValue]":
88
- return recursive_map(cls._apply_if_mapping, value)
93
+ return cast(
94
+ "ReadableAttributeDict[TKey, TValue]",
95
+ recursive_map(cls._apply_if_mapping, value),
96
+ )
89
97
 
90
98
 
91
99
  class MutableAttributeDict(
@@ -100,19 +108,21 @@ class MutableAttributeDict(
100
108
 
101
109
  class AttributeDict(ReadableAttributeDict[TKey, TValue], Hashable):
102
110
  """
103
- This provides superficial immutability, someone could hack around it
111
+ Provides superficial immutability, someone could hack around it
104
112
  """
105
113
 
106
114
  def __setattr__(self, attr: str, val: TValue) -> None:
107
115
  if attr == "__dict__":
108
116
  super().__setattr__(attr, val)
109
117
  else:
110
- raise TypeError(
118
+ raise Web3TypeError(
111
119
  "This data is immutable -- create a copy instead of modifying"
112
120
  )
113
121
 
114
122
  def __delattr__(self, key: str) -> None:
115
- raise TypeError("This data is immutable -- create a copy instead of modifying")
123
+ raise Web3TypeError(
124
+ "This data is immutable -- create a copy instead of modifying"
125
+ )
116
126
 
117
127
  def __hash__(self) -> int:
118
128
  return hash(tuple(sorted(tupleize_lists_nested(self).items())))
@@ -143,7 +153,7 @@ def tupleize_lists_nested(d: Mapping[TKey, TValue]) -> AttributeDict[TKey, TValu
143
153
  elif isinstance(v, Mapping):
144
154
  ret[k] = tupleize_lists_nested(v)
145
155
  elif not isinstance(v, Hashable):
146
- raise TypeError(f"Found unhashable type '{type(v).__name__}': {v}")
156
+ raise Web3TypeError(f"Found unhashable type '{type(v).__name__}': {v}")
147
157
  else:
148
158
  ret[k] = v
149
159
  return AttributeDict(ret)
@@ -176,9 +186,9 @@ class NamedElementOnion(Mapping[TKey, TValue]):
176
186
 
177
187
  if name in self._queue:
178
188
  if name is element:
179
- raise ValueError("You can't add the same un-named instance twice")
189
+ raise Web3ValueError("You can't add the same un-named instance twice")
180
190
  else:
181
- raise ValueError(
191
+ raise Web3ValueError(
182
192
  "You can't add the same name again, use replace instead"
183
193
  )
184
194
 
@@ -195,7 +205,7 @@ class NamedElementOnion(Mapping[TKey, TValue]):
195
205
  to calling :meth:`add` .
196
206
  """
197
207
  if not is_integer(layer):
198
- raise TypeError("The layer for insertion must be an int.")
208
+ raise Web3TypeError("The layer for insertion must be an int.")
199
209
  elif layer != 0 and layer != len(self._queue):
200
210
  raise NotImplementedError(
201
211
  f"You can only insert to the beginning or end of a {type(self)}, "
@@ -215,7 +225,7 @@ class NamedElementOnion(Mapping[TKey, TValue]):
215
225
  elif layer == len(self._queue):
216
226
  return
217
227
  else:
218
- raise AssertionError(
228
+ raise Web3AssertionError(
219
229
  "Impossible to reach: earlier validation raises an error"
220
230
  )
221
231
 
@@ -226,7 +236,7 @@ class NamedElementOnion(Mapping[TKey, TValue]):
226
236
  old_name = self._repr_if_not_hashable(old)
227
237
 
228
238
  if old_name not in self._queue:
229
- raise ValueError(
239
+ raise Web3ValueError(
230
240
  "You can't replace unless one already exists, use add instead"
231
241
  )
232
242
 
@@ -248,7 +258,7 @@ class NamedElementOnion(Mapping[TKey, TValue]):
248
258
  def remove(self, old: TKey) -> None:
249
259
  old_name = self._repr_if_not_hashable(old)
250
260
  if old_name not in self._queue:
251
- raise ValueError("You can only remove something that has been added")
261
+ raise Web3ValueError("You can only remove something that has been added")
252
262
  del self._queue[old_name]
253
263
 
254
264
  @property
@@ -310,7 +320,7 @@ class NamedElementOnion(Mapping[TKey, TValue]):
310
320
 
311
321
  def as_tuple_of_middleware(self) -> Tuple[TValue, ...]:
312
322
  """
313
- This helps with type hinting since we return `Iterator[TKey]` type, though it's
323
+ Helps with type hinting since we return `Iterator[TKey]` type, though it's
314
324
  actually a `Iterator[TValue]` type, for the `__iter__()` method. This is in
315
325
  order to satisfy the `Mapping` interface.
316
326
  """
web3/eth/async_eth.py CHANGED
@@ -63,6 +63,7 @@ from web3.exceptions import (
63
63
  TooManyRequests,
64
64
  TransactionIndexingInProgress,
65
65
  TransactionNotFound,
66
+ Web3ValueError,
66
67
  )
67
68
  from web3.method import (
68
69
  Method,
@@ -107,9 +108,9 @@ class AsyncEth(BaseEth):
107
108
 
108
109
  is_async = True
109
110
 
110
- _default_contract_factory: Type[Union[AsyncContract, AsyncContractCaller]] = (
111
- AsyncContract
112
- )
111
+ _default_contract_factory: Type[
112
+ Union[AsyncContract, AsyncContractCaller]
113
+ ] = AsyncContract
113
114
 
114
115
  # eth_accounts
115
116
 
@@ -196,7 +197,8 @@ class AsyncEth(BaseEth):
196
197
  except (ValueError, MethodUnavailable):
197
198
  warnings.warn(
198
199
  "There was an issue with the method eth_maxPriorityFeePerGas. "
199
- "Calculating using eth_feeHistory."
200
+ "Calculating using eth_feeHistory.",
201
+ stacklevel=2,
200
202
  )
201
203
  return await async_fee_history_priority_fee(self)
202
204
 
@@ -283,7 +285,7 @@ class AsyncEth(BaseEth):
283
285
  max_redirects = self.w3.provider.ccip_read_max_redirects
284
286
 
285
287
  if not max_redirects or max_redirects < 4:
286
- raise ValueError(
288
+ raise Web3ValueError(
287
289
  "ccip_read_max_redirects property on provider must be at least 4."
288
290
  )
289
291
 
@@ -391,15 +393,15 @@ class AsyncEth(BaseEth):
391
393
  # eth_getBlockTransactionCountByHash
392
394
  # eth_getBlockTransactionCountByNumber
393
395
 
394
- get_block_transaction_count: Method[Callable[[BlockIdentifier], Awaitable[int]]] = (
395
- Method(
396
- method_choice_depends_on_args=select_method_for_block_identifier(
397
- if_predefined=RPC.eth_getBlockTransactionCountByNumber,
398
- if_hash=RPC.eth_getBlockTransactionCountByHash,
399
- if_number=RPC.eth_getBlockTransactionCountByNumber,
400
- ),
401
- mungers=[default_root_munger],
402
- )
396
+ get_block_transaction_count: Method[
397
+ Callable[[BlockIdentifier], Awaitable[int]]
398
+ ] = Method(
399
+ method_choice_depends_on_args=select_method_for_block_identifier(
400
+ if_predefined=RPC.eth_getBlockTransactionCountByNumber,
401
+ if_hash=RPC.eth_getBlockTransactionCountByHash,
402
+ if_number=RPC.eth_getBlockTransactionCountByNumber,
403
+ ),
404
+ mungers=[default_root_munger],
403
405
  )
404
406
 
405
407
  # eth_sendTransaction
@@ -426,15 +428,15 @@ class AsyncEth(BaseEth):
426
428
  # eth_getBlockByHash
427
429
  # eth_getBlockByNumber
428
430
 
429
- _get_block: Method[Callable[[BlockIdentifier, bool], Awaitable[BlockData]]] = (
430
- Method(
431
- method_choice_depends_on_args=select_method_for_block_identifier(
432
- if_predefined=RPC.eth_getBlockByNumber,
433
- if_hash=RPC.eth_getBlockByHash,
434
- if_number=RPC.eth_getBlockByNumber,
435
- ),
436
- mungers=[BaseEth.get_block_munger],
437
- )
431
+ _get_block: Method[
432
+ Callable[[BlockIdentifier, bool], Awaitable[BlockData]]
433
+ ] = Method(
434
+ method_choice_depends_on_args=select_method_for_block_identifier(
435
+ if_predefined=RPC.eth_getBlockByNumber,
436
+ if_hash=RPC.eth_getBlockByHash,
437
+ if_number=RPC.eth_getBlockByNumber,
438
+ ),
439
+ mungers=[BaseEth.get_block_munger],
438
440
  )
439
441
 
440
442
  async def get_block(
@@ -681,9 +683,9 @@ class AsyncEth(BaseEth):
681
683
 
682
684
  # eth_getFilterChanges, eth_getFilterLogs, eth_uninstallFilter
683
685
 
684
- _get_filter_changes: Method[Callable[[HexStr], Awaitable[List[LogReceipt]]]] = (
685
- Method(RPC.eth_getFilterChanges, mungers=[default_root_munger])
686
- )
686
+ _get_filter_changes: Method[
687
+ Callable[[HexStr], Awaitable[List[LogReceipt]]]
688
+ ] = Method(RPC.eth_getFilterChanges, mungers=[default_root_munger])
687
689
 
688
690
  async def get_filter_changes(self, filter_id: HexStr) -> List[LogReceipt]:
689
691
  return await self._get_filter_changes(filter_id)
@@ -761,12 +763,15 @@ class AsyncEth(BaseEth):
761
763
  # -- contract methods -- #
762
764
 
763
765
  @overload
764
- def contract(self, address: None = None, **kwargs: Any) -> Type[AsyncContract]: ...
766
+ # mypy error: Overloaded function signatures 1 and 2 overlap with incompatible return types # noqa: E501
767
+ def contract(self, address: None = None, **kwargs: Any) -> Type[AsyncContract]: # type: ignore[misc] # noqa: E501
768
+ ...
765
769
 
766
770
  @overload
767
771
  def contract(
768
772
  self, address: Union[Address, ChecksumAddress, ENS], **kwargs: Any
769
- ) -> AsyncContract: ...
773
+ ) -> AsyncContract:
774
+ ...
770
775
 
771
776
  def contract(
772
777
  self,
web3/eth/base_eth.py CHANGED
@@ -30,6 +30,10 @@ from web3._utils.empty import (
30
30
  from web3._utils.encoding import (
31
31
  to_hex,
32
32
  )
33
+ from web3.exceptions import (
34
+ Web3TypeError,
35
+ Web3ValueError,
36
+ )
33
37
  from web3.module import (
34
38
  Module,
35
39
  )
@@ -194,7 +198,7 @@ class BaseEth(Module):
194
198
  filter_id: Optional[HexStr] = None,
195
199
  ) -> Union[List[FilterParams], List[HexStr], List[str]]:
196
200
  if filter_id and filter_params:
197
- raise TypeError(
201
+ raise Web3TypeError(
198
202
  "Ambiguous invocation: provide either a `filter_params` or a "
199
203
  "`filter_id` argument. Both were supplied."
200
204
  )
@@ -204,14 +208,14 @@ class BaseEth(Module):
204
208
  if filter_params in {"latest", "pending"}:
205
209
  return [filter_params]
206
210
  else:
207
- raise ValueError(
211
+ raise Web3ValueError(
208
212
  "The filter API only accepts the values of `pending` or "
209
213
  "`latest` for string based filters"
210
214
  )
211
215
  elif filter_id and not filter_params:
212
216
  return [filter_id]
213
217
  else:
214
- raise TypeError(
218
+ raise Web3TypeError(
215
219
  "Must provide either filter_params as a string or "
216
220
  "a valid filter object, or a filter_id as a string "
217
221
  "or hex."
web3/eth/eth.py CHANGED
@@ -63,6 +63,7 @@ from web3.exceptions import (
63
63
  TooManyRequests,
64
64
  TransactionIndexingInProgress,
65
65
  TransactionNotFound,
66
+ Web3ValueError,
66
67
  )
67
68
  from web3.method import (
68
69
  Method,
@@ -189,7 +190,8 @@ class Eth(BaseEth):
189
190
  except (ValueError, MethodUnavailable):
190
191
  warnings.warn(
191
192
  "There was an issue with the method eth_maxPriorityFeePerGas. "
192
- "Calculating using eth_feeHistory."
193
+ "Calculating using eth_feeHistory.",
194
+ stacklevel=2,
193
195
  )
194
196
  return fee_history_priority_fee(self)
195
197
 
@@ -271,7 +273,7 @@ class Eth(BaseEth):
271
273
  max_redirects = self.w3.provider.ccip_read_max_redirects
272
274
 
273
275
  if not max_redirects or max_redirects < 4:
274
- raise ValueError(
276
+ raise Web3ValueError(
275
277
  "ccip_read_max_redirects property on provider must be at least 4."
276
278
  )
277
279
 
@@ -631,15 +633,15 @@ class Eth(BaseEth):
631
633
 
632
634
  # eth_newFilter, eth_newBlockFilter, eth_newPendingTransactionFilter
633
635
 
634
- filter: Method[Callable[[Optional[Union[str, FilterParams, HexStr]]], Filter]] = (
635
- Method(
636
- method_choice_depends_on_args=select_filter_method(
637
- if_new_block_filter=RPC.eth_newBlockFilter,
638
- if_new_pending_transaction_filter=RPC.eth_newPendingTransactionFilter,
639
- if_new_filter=RPC.eth_newFilter,
640
- ),
641
- mungers=[BaseEth.filter_munger],
642
- )
636
+ filter: Method[
637
+ Callable[[Optional[Union[str, FilterParams, HexStr]]], Filter]
638
+ ] = Method(
639
+ method_choice_depends_on_args=select_filter_method(
640
+ if_new_block_filter=RPC.eth_newBlockFilter,
641
+ if_new_pending_transaction_filter=RPC.eth_newPendingTransactionFilter,
642
+ if_new_filter=RPC.eth_newFilter,
643
+ ),
644
+ mungers=[BaseEth.filter_munger],
643
645
  )
644
646
 
645
647
  # eth_getFilterChanges, eth_getFilterLogs, eth_uninstallFilter
@@ -677,12 +679,15 @@ class Eth(BaseEth):
677
679
  )
678
680
 
679
681
  @overload
680
- def contract(self, address: None = None, **kwargs: Any) -> Type[Contract]: ...
682
+ # type error: Overloaded function signatures 1 and 2 overlap with incompatible return types # noqa: E501
683
+ def contract(self, address: None = None, **kwargs: Any) -> Type[Contract]: # type: ignore[misc] # noqa: E501
684
+ ...
681
685
 
682
686
  @overload
683
687
  def contract(
684
688
  self, address: Union[Address, ChecksumAddress, ENS], **kwargs: Any
685
- ) -> Contract: ...
689
+ ) -> Contract:
690
+ ...
686
691
 
687
692
  def contract(
688
693
  self,
web3/exceptions.py CHANGED
@@ -41,6 +41,34 @@ class Web3Exception(Exception):
41
41
  self.user_message = user_message
42
42
 
43
43
 
44
+ class Web3AssertionError(Web3Exception, AssertionError):
45
+ """
46
+ A web3.py exception wrapper for `AssertionError`, for better control over
47
+ exception handling.
48
+ """
49
+
50
+
51
+ class Web3ValueError(Web3Exception, ValueError):
52
+ """
53
+ A web3.py exception wrapper for `ValueError`, for better control over
54
+ exception handling.
55
+ """
56
+
57
+
58
+ class Web3AttributeError(Web3Exception, AttributeError):
59
+ """
60
+ A web3.py exception wrapper for `AttributeError`, for better control over
61
+ exception handling.
62
+ """
63
+
64
+
65
+ class Web3TypeError(Web3Exception, TypeError):
66
+ """
67
+ A web3.py exception wrapper for `TypeError`, for better control over
68
+ exception handling.
69
+ """
70
+
71
+
44
72
  class BadFunctionCallOutput(Web3Exception):
45
73
  """
46
74
  We failed to decode ABI output.
@@ -48,24 +76,18 @@ class BadFunctionCallOutput(Web3Exception):
48
76
  Most likely ABI mismatch.
49
77
  """
50
78
 
51
- pass
52
-
53
79
 
54
80
  class BlockNumberOutofRange(Web3Exception):
55
81
  """
56
82
  block_identifier passed does not match known block.
57
83
  """
58
84
 
59
- pass
60
-
61
85
 
62
86
  class ProviderConnectionError(Web3Exception):
63
87
  """
64
88
  Raised when unable to connect to a provider
65
89
  """
66
90
 
67
- pass
68
-
69
91
 
70
92
  class CannotHandleRequest(Web3Exception):
71
93
  """
@@ -73,16 +95,12 @@ class CannotHandleRequest(Web3Exception):
73
95
  that the manager should proceed to the next provider.
74
96
  """
75
97
 
76
- pass
77
-
78
98
 
79
99
  class TooManyRequests(Web3Exception):
80
100
  """
81
101
  Raised by a provider to signal that too many requests have been made consecutively.
82
102
  """
83
103
 
84
- pass
85
-
86
104
 
87
105
  class MultipleFailedRequests(Web3Exception):
88
106
  """
@@ -90,16 +108,12 @@ class MultipleFailedRequests(Web3Exception):
90
108
  (or similar) data have failed.
91
109
  """
92
110
 
93
- pass
94
-
95
111
 
96
112
  class InvalidAddress(Web3Exception):
97
113
  """
98
114
  The supplied address does not have a valid checksum, as defined in EIP-55
99
115
  """
100
116
 
101
- pass
102
-
103
117
 
104
118
  class NameNotFound(Web3Exception):
105
119
  """
@@ -107,8 +121,6 @@ class NameNotFound(Web3Exception):
107
121
  does not resolve to an address.
108
122
  """
109
123
 
110
- pass
111
-
112
124
 
113
125
  class StaleBlockchain(Web3Exception):
114
126
  """
@@ -138,8 +150,6 @@ class MismatchedABI(Web3Exception):
138
150
  attempt is made to access a function/event that does not exist in the ABI.
139
151
  """
140
152
 
141
- pass
142
-
143
153
 
144
154
  class ABIEventFunctionNotFound(AttributeError, MismatchedABI):
145
155
  """
@@ -147,8 +157,6 @@ class ABIEventFunctionNotFound(AttributeError, MismatchedABI):
147
157
  that does not exist in the ABI.
148
158
  """
149
159
 
150
- pass
151
-
152
160
 
153
161
  class ABIFunctionNotFound(AttributeError, MismatchedABI):
154
162
  """
@@ -156,56 +164,43 @@ class ABIFunctionNotFound(AttributeError, MismatchedABI):
156
164
  that does not exist in the ABI.
157
165
  """
158
166
 
159
- pass
160
-
161
167
 
162
168
  class FallbackNotFound(Web3Exception):
163
169
  """
164
170
  Raised when fallback function doesn't exist in contract.
165
171
  """
166
172
 
167
- pass
168
-
169
173
 
170
- class Web3ValidationError(Web3Exception, ValidationError):
174
+ # type ignored because subclassing ValidationError which has type Any
175
+ class Web3ValidationError(Web3Exception, ValidationError): # type: ignore[misc]
171
176
  """
172
177
  Raised when a supplied value is invalid.
173
178
  """
174
179
 
175
- pass
176
-
177
180
 
178
181
  class ExtraDataLengthError(Web3ValidationError):
179
182
  """
180
183
  Raised when an RPC call returns >32 bytes of extraData.
181
184
  """
182
185
 
183
- pass
184
-
185
186
 
186
187
  class NoABIFunctionsFound(Web3Exception):
187
188
  """
188
189
  Raised when an ABI is present, but doesn't contain any functions.
189
190
  """
190
191
 
191
- pass
192
-
193
192
 
194
193
  class NoABIFound(Web3Exception):
195
194
  """
196
195
  Raised when no ABI is present.
197
196
  """
198
197
 
199
- pass
200
-
201
198
 
202
199
  class NoABIEventsFound(Web3Exception):
203
200
  """
204
201
  Raised when an ABI doesn't contain any events.
205
202
  """
206
203
 
207
- pass
208
-
209
204
 
210
205
  class InsufficientData(Web3Exception):
211
206
  """
@@ -213,8 +208,6 @@ class InsufficientData(Web3Exception):
213
208
  complete a calculation
214
209
  """
215
210
 
216
- pass
217
-
218
211
 
219
212
  class TimeExhausted(Web3Exception):
220
213
  """
@@ -222,16 +215,12 @@ class TimeExhausted(Web3Exception):
222
215
  result within a specified timeout.
223
216
  """
224
217
 
225
- pass
226
-
227
218
 
228
219
  class TransactionNotFound(Web3Exception):
229
220
  """
230
221
  Raised when a tx hash used to lookup a tx in a jsonrpc call cannot be found.
231
222
  """
232
223
 
233
- pass
234
-
235
224
 
236
225
  class TransactionIndexingInProgress(Web3Exception):
237
226
  """
@@ -239,40 +228,30 @@ class TransactionIndexingInProgress(Web3Exception):
239
228
  still being in progress.
240
229
  """
241
230
 
242
- pass
243
-
244
231
 
245
232
  class BlockNotFound(Web3Exception):
246
233
  """
247
234
  Raised when the block id used to lookup a block in a jsonrpc call cannot be found.
248
235
  """
249
236
 
250
- pass
251
-
252
237
 
253
238
  class InfuraProjectIdNotFound(Web3Exception):
254
239
  """
255
240
  Raised when there is no Infura Project Id set.
256
241
  """
257
242
 
258
- pass
259
-
260
243
 
261
244
  class LogTopicError(Web3Exception):
262
245
  """
263
246
  Raised when the number of log topics is mismatched.
264
247
  """
265
248
 
266
- pass
267
-
268
249
 
269
250
  class InvalidEventABI(Web3Exception):
270
251
  """
271
252
  Raised when the event ABI is invalid.
272
253
  """
273
254
 
274
- pass
275
-
276
255
 
277
256
  class ContractLogicError(Web3Exception):
278
257
  """
@@ -294,16 +273,12 @@ class ContractCustomError(ContractLogicError):
294
273
  Raised on a contract revert custom error
295
274
  """
296
275
 
297
- pass
298
-
299
276
 
300
277
  class ContractPanicError(ContractLogicError):
301
278
  """
302
279
  Raised when a contract reverts with Panic, as of Solidity 0.8.0
303
280
  """
304
281
 
305
- pass
306
-
307
282
 
308
283
  class OffchainLookup(ContractLogicError):
309
284
  """
@@ -341,12 +316,8 @@ class BadResponseFormat(Web3Exception):
341
316
  Raised when a JSON-RPC response comes back in an unexpected format
342
317
  """
343
318
 
344
- pass
345
-
346
319
 
347
320
  class MethodUnavailable(Web3Exception):
348
321
  """
349
322
  Raised when the method is not available on the node
350
323
  """
351
-
352
- pass
@@ -84,8 +84,7 @@ def _get_raw_miner_data(
84
84
  latest = w3.eth.get_block("latest", full_transactions=True)
85
85
 
86
86
  for transaction in latest["transactions"]:
87
- # type ignored b/c actual transaction is TxData not HexBytes
88
- yield (latest["miner"], latest["hash"], transaction["gasPrice"]) # type: ignore
87
+ yield (latest["miner"], latest["hash"], transaction["gasPrice"])
89
88
 
90
89
  block = latest
91
90
 
@@ -97,8 +96,7 @@ def _get_raw_miner_data(
97
96
  # block numbers to make caching the data easier to implement.
98
97
  block = w3.eth.get_block(block["parentHash"], full_transactions=True)
99
98
  for transaction in block["transactions"]:
100
- # type ignored b/c actual transaction is TxData not HexBytes
101
- yield (block["miner"], block["hash"], transaction["gasPrice"]) # type: ignore # noqa: E501
99
+ yield (block["miner"], block["hash"], transaction["gasPrice"])
102
100
 
103
101
 
104
102
  def _aggregate_miner_data(