Skip to content

Commit e8118fe

Browse files
committed
Fix isort and mypy issues after refactor; add newsfragment.
1 parent 32ef26e commit e8118fe

File tree

6 files changed

+26
-24
lines changed

6 files changed

+26
-24
lines changed

newsfragments/2753.internal.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Organize the ``eth`` module into separate files for better readability.

web3/_utils/events.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ async def deploy(self, async_w3: "Web3") -> "AsyncLogFilter":
439439
arg._immutable = True
440440
self._immutable = True
441441

442-
log_filter = await async_w3.eth.filter(self.filter_params) # type: ignore
442+
log_filter = await async_w3.eth.filter(self.filter_params)
443443
log_filter.filter_params = self.filter_params
444444
log_filter.set_data_filters(self.data_argument_values)
445445
log_filter.builder = self

web3/_utils/module_testing/eth_module.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@
7575
construct_error_generator_middleware,
7676
)
7777
from web3.types import ( # noqa: F401
78-
BlockData,
7978
ENS,
79+
BlockData,
8080
FilterParams,
8181
LogReceipt,
8282
Nonce,
@@ -1468,7 +1468,7 @@ async def test_eth_getBlockTransactionCountByNumber_block_with_txn(
14681468

14691469
@pytest.mark.asyncio
14701470
async def test_async_eth_new_filter(self, async_w3: "Web3") -> None:
1471-
filter = await async_w3.eth.filter({}) # type: ignore
1471+
filter = await async_w3.eth.filter({})
14721472

14731473
changes = await async_w3.eth.get_filter_changes(
14741474
filter.filter_id
@@ -1485,7 +1485,7 @@ async def test_async_eth_new_filter(self, async_w3: "Web3") -> None:
14851485

14861486
@pytest.mark.asyncio
14871487
async def test_async_eth_new_block_filter(self, async_w3: "Web3") -> None:
1488-
filter = await async_w3.eth.filter("latest") # type: ignore
1488+
filter = await async_w3.eth.filter("latest")
14891489
assert is_string(filter.filter_id)
14901490

14911491
changes = await async_w3.eth.get_filter_changes(
@@ -1501,7 +1501,7 @@ async def test_async_eth_new_block_filter(self, async_w3: "Web3") -> None:
15011501
async def test_async_eth_new_pending_transaction_filter(
15021502
self, async_w3: "Web3"
15031503
) -> None:
1504-
filter = await async_w3.eth.filter("pending") # type: ignore
1504+
filter = await async_w3.eth.filter("pending")
15051505
assert is_string(filter.filter_id)
15061506

15071507
changes = await async_w3.eth.get_filter_changes(
@@ -1515,7 +1515,7 @@ async def test_async_eth_new_pending_transaction_filter(
15151515

15161516
@pytest.mark.asyncio
15171517
async def test_async_eth_uninstall_filter(self, async_w3: "Web3") -> None:
1518-
filter = await async_w3.eth.filter({}) # type: ignore
1518+
filter = await async_w3.eth.filter({})
15191519
assert is_string(filter.filter_id)
15201520

15211521
success = await async_w3.eth.uninstall_filter(filter.filter_id) # type: ignore

web3/eth/async_eth.py

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import asyncio
2-
import warnings
32
from typing import (
43
Awaitable,
54
Callable,
@@ -9,27 +8,28 @@
98
Type,
109
Union,
1110
)
12-
13-
from hexbytes import (
14-
HexBytes,
15-
)
16-
from web3._utils.blocks import (
17-
select_method_for_block_identifier,
18-
)
19-
from web3._utils.filters import AsyncFilter, select_filter_method
20-
from web3.utils import (
21-
async_handle_offchain_lookup,
22-
)
11+
import warnings
2312

2413
from eth_typing import (
2514
Address,
2615
BlockNumber,
2716
ChecksumAddress,
2817
HexStr,
2918
)
19+
from hexbytes import (
20+
HexBytes,
21+
)
22+
23+
from web3._utils.blocks import (
24+
select_method_for_block_identifier,
25+
)
3026
from web3._utils.fee_utils import (
3127
async_fee_history_priority_fee,
3228
)
29+
from web3._utils.filters import (
30+
AsyncFilter,
31+
select_filter_method,
32+
)
3333
from web3._utils.rpc_abi import (
3434
RPC,
3535
)
@@ -51,11 +51,11 @@
5151
default_root_munger,
5252
)
5353
from web3.types import (
54+
ENS,
5455
BlockData,
5556
BlockIdentifier,
5657
BlockParams,
5758
CallOverride,
58-
ENS,
5959
FeeHistory,
6060
FilterParams,
6161
LogReceipt,
@@ -67,6 +67,9 @@
6767
Wei,
6868
_Hash32,
6969
)
70+
from web3.utils import (
71+
async_handle_offchain_lookup,
72+
)
7073

7174

7275
class AsyncEth(BaseEth):

web3/eth/base.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
List,
44
NoReturn,
55
Optional,
6-
overload,
76
Sequence,
87
Tuple,
98
Type,
109
Union,
10+
overload,
1111
)
1212

1313
from eth_account import (
@@ -25,6 +25,7 @@
2525
from eth_utils.toolz import (
2626
assoc,
2727
)
28+
2829
from web3._utils.empty import (
2930
Empty,
3031
empty,
@@ -39,9 +40,9 @@
3940
Module,
4041
)
4142
from web3.types import (
43+
ENS,
4244
BlockIdentifier,
4345
CallOverride,
44-
ENS,
4546
FilterParams,
4647
GasPriceStrategy,
4748
TxParams,

web3/eth/main.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@
1717
ChecksumAddress,
1818
HexStr,
1919
)
20-
from eth_utils import (
21-
is_string,
22-
)
2320
from eth_utils.toolz import (
2421
merge,
2522
)

0 commit comments

Comments
 (0)