Skip to content

Commit a0ba33a

Browse files
committed
ignore no-untyped-call errors, all are from eth-abi and can be removed once it has better typing
1 parent 97c4f99 commit a0ba33a

File tree

4 files changed

+27
-25
lines changed

4 files changed

+27
-25
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ check_untyped_defs = true
2121
disallow_any_generics = true
2222
disallow_incomplete_defs = true
2323
disallow_subclassing_any = true
24-
disallow_untyped_calls = false
24+
disallow_untyped_calls = true
2525
disallow_untyped_decorators = false
2626
disallow_untyped_defs = true
2727
ignore_missing_imports = true

web3/_utils/abi.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ def validate_value(cls, value: Any) -> None:
153153
if is_ens_name(value):
154154
return
155155

156-
super().validate_value(value)
156+
super().validate_value(value) # type: ignore[no-untyped-call]
157157

158158

159159
class AcceptsHexStrEncoder(encoding.BaseEncoder):
@@ -168,7 +168,7 @@ def __init__(
168168
subencoder: encoding.BaseEncoder,
169169
**kwargs: Dict[str, Any],
170170
) -> None:
171-
super().__init__(**kwargs)
171+
super().__init__(**kwargs) # type: ignore[no-untyped-call]
172172
self.subencoder = subencoder
173173
self.is_dynamic = subencoder.is_dynamic
174174

@@ -180,7 +180,7 @@ def from_type_str(
180180
# cast b/c expects BaseCoder but `from_type_string`
181181
# restricted to BaseEncoder subclasses
182182
subencoder = cast(
183-
encoding.BaseEncoder, subencoder_cls.from_type_str(abi_type, registry)
183+
encoding.BaseEncoder, subencoder_cls.from_type_str(abi_type, registry) # type: ignore[no-untyped-call] # noqa: E501
184184
)
185185
return cls(subencoder)
186186

@@ -245,7 +245,7 @@ class ExactLengthBytesEncoder(BytesEncoder):
245245
is_strict = True
246246

247247
def validate(self) -> None:
248-
super().validate()
248+
super().validate() # type: ignore[no-untyped-call]
249249
if self.value_bit_size is None:
250250
raise Web3ValueError("`value_bit_size` may not be none")
251251
if self.data_byte_size is None:
@@ -262,12 +262,12 @@ def validate(self) -> None:
262262
if self.value_bit_size > self.data_byte_size * 8:
263263
raise Web3ValueError("Value byte size exceeds data size")
264264

265-
@parse_type_str("bytes")
265+
@parse_type_str("bytes") # type: ignore[no-untyped-call]
266266
def from_type_str(
267267
cls, abi_type: BasicType, registry: ABIRegistry
268268
) -> "ExactLengthBytesEncoder":
269269
subencoder_cls = cls.get_subencoder_class()
270-
subencoder = subencoder_cls.from_type_str(abi_type.to_type_str(), registry)
270+
subencoder = subencoder_cls.from_type_str(abi_type.to_type_str(), registry) # type: ignore[no-untyped-call] # noqa: E501
271271
return cast(
272272
ExactLengthBytesEncoder,
273273
# type ignored b/c mypy thinks the __call__ is from BaseEncoder, but it's
@@ -303,7 +303,7 @@ def validate_value(cls, value: Any) -> None:
303303
msg="not decodable as unicode string",
304304
)
305305

306-
super().validate_value(value)
306+
super().validate_value(value) # type: ignore[no-untyped-call]
307307

308308

309309
TUPLE_TYPE_STR_RE = re.compile(r"^(tuple)((\[([1-9]\d*\b)?])*)??$")
@@ -676,33 +676,33 @@ def strip_abi_type(elements: Any) -> Any:
676676
def build_non_strict_registry() -> ABIRegistry:
677677
# We make a copy here just to make sure that eth-abi's default registry is not
678678
# affected by our custom encoder subclasses
679-
registry = default_registry.copy()
679+
registry = default_registry.copy() # type: ignore[no-untyped-call]
680680

681681
registry.unregister("address")
682682
registry.unregister("bytes<M>")
683683
registry.unregister("bytes")
684684
registry.unregister("string")
685685

686686
registry.register(
687-
BaseEquals("address"),
687+
BaseEquals("address"), # type: ignore[no-untyped-call]
688688
AddressEncoder,
689689
decoding.AddressDecoder,
690690
label="address",
691691
)
692692
registry.register(
693-
BaseEquals("bytes", with_sub=True),
693+
BaseEquals("bytes", with_sub=True), # type: ignore[no-untyped-call]
694694
BytesEncoder,
695695
decoding.BytesDecoder,
696696
label="bytes<M>",
697697
)
698698
registry.register(
699-
BaseEquals("bytes", with_sub=False),
699+
BaseEquals("bytes", with_sub=False), # type: ignore[no-untyped-call]
700700
ByteStringEncoder,
701701
decoding.ByteStringDecoder,
702702
label="bytes",
703703
)
704704
registry.register(
705-
BaseEquals("string"),
705+
BaseEquals("string"), # type: ignore[no-untyped-call]
706706
TextStringEncoder,
707707
decoding.StringDecoder,
708708
label="string",
@@ -711,33 +711,33 @@ def build_non_strict_registry() -> ABIRegistry:
711711

712712

713713
def build_strict_registry() -> ABIRegistry:
714-
registry = default_registry.copy()
714+
registry = default_registry.copy() # type: ignore[no-untyped-call]
715715

716716
registry.unregister("address")
717717
registry.unregister("bytes<M>")
718718
registry.unregister("bytes")
719719
registry.unregister("string")
720720

721721
registry.register(
722-
BaseEquals("address"),
722+
BaseEquals("address"), # type: ignore[no-untyped-call]
723723
AddressEncoder,
724724
decoding.AddressDecoder,
725725
label="address",
726726
)
727727
registry.register(
728-
BaseEquals("bytes", with_sub=True),
728+
BaseEquals("bytes", with_sub=True), # type: ignore[no-untyped-call]
729729
ExactLengthBytesEncoder,
730730
decoding.BytesDecoder,
731731
label="bytes<M>",
732732
)
733733
registry.register(
734-
BaseEquals("bytes", with_sub=False),
734+
BaseEquals("bytes", with_sub=False), # type: ignore[no-untyped-call]
735735
StrictByteStringEncoder,
736736
decoding.ByteStringDecoder,
737737
label="bytes",
738738
)
739739
registry.register(
740-
BaseEquals("string"),
740+
BaseEquals("string"), # type: ignore[no-untyped-call]
741741
encoding.TextStringEncoder,
742742
decoding.StringDecoder,
743743
label="string",

web3/_utils/encoding.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ class DynamicArrayPackedEncoder(BaseArrayEncoder):
259259
is_dynamic = True
260260

261261
def encode(self, value: Sequence[Any]) -> bytes:
262-
encoded_elements = self.encode_elements(value)
262+
encoded_elements = self.encode_elements(value) # type: ignore[no-untyped-call]
263263
encoded_value = encoded_elements
264264

265265
return encoded_value
@@ -278,10 +278,10 @@ def encode_single_packed(_type: TypeStr, value: Any) -> bytes:
278278
)
279279

280280
abi_type = abi_type_parser.parse(_type)
281-
if has_arrlist(_type):
281+
if has_arrlist(_type): # type: ignore[no-untyped-call]
282282
item_encoder = registry.get_encoder(abi_type.item_type.to_type_str())
283283
if abi_type.arrlist[-1] != 1:
284-
return DynamicArrayPackedEncoder(item_encoder=item_encoder).encode(value)
284+
return DynamicArrayPackedEncoder(item_encoder=item_encoder).encode(value) # type: ignore[no-untyped-call] # noqa: E501
285285
else:
286286
raise NotImplementedError(
287287
"Fixed arrays are not implemented in this packed encoder prototype"

web3/middleware/signing.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,10 +218,12 @@ async def async_request_processor(self, method: "RPCEndpoint", params: Any) -> A
218218
account = self._accounts[to_checksum_address(tx_from)]
219219
EthAccountTxParams: TypeAlias = Dict[
220220
str,
221-
Sequence[Dict[str, HexStr | Sequence[HexStr]]]
222-
| bytes
223-
| HexStr
224-
| int,
221+
Union[
222+
Sequence[Dict[str, Union[HexStr, Sequence[HexStr]]]],
223+
bytes,
224+
HexStr,
225+
int,
226+
],
225227
]
226228
raw_tx = account.sign_transaction(
227229
cast(EthAccountTxParams, filled_transaction)

0 commit comments

Comments
 (0)