Skip to content

Commit

Permalink
Fix isort and mypy issues after refactor; add newsfragment.
Browse files Browse the repository at this point in the history
  • Loading branch information
fselmo committed Jan 5, 2023
1 parent 32ef26e commit e8118fe
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 24 deletions.
1 change: 1 addition & 0 deletions newsfragments/2753.internal.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Organize the ``eth`` module into separate files for better readability.
2 changes: 1 addition & 1 deletion web3/_utils/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ async def deploy(self, async_w3: "Web3") -> "AsyncLogFilter":
arg._immutable = True
self._immutable = True

log_filter = await async_w3.eth.filter(self.filter_params) # type: ignore
log_filter = await async_w3.eth.filter(self.filter_params)
log_filter.filter_params = self.filter_params
log_filter.set_data_filters(self.data_argument_values)
log_filter.builder = self
Expand Down
10 changes: 5 additions & 5 deletions web3/_utils/module_testing/eth_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@
construct_error_generator_middleware,
)
from web3.types import ( # noqa: F401
BlockData,
ENS,
BlockData,
FilterParams,
LogReceipt,
Nonce,
Expand Down Expand Up @@ -1468,7 +1468,7 @@ async def test_eth_getBlockTransactionCountByNumber_block_with_txn(

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

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

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

changes = await async_w3.eth.get_filter_changes(
Expand All @@ -1501,7 +1501,7 @@ async def test_async_eth_new_block_filter(self, async_w3: "Web3") -> None:
async def test_async_eth_new_pending_transaction_filter(
self, async_w3: "Web3"
) -> None:
filter = await async_w3.eth.filter("pending") # type: ignore
filter = await async_w3.eth.filter("pending")
assert is_string(filter.filter_id)

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

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

success = await async_w3.eth.uninstall_filter(filter.filter_id) # type: ignore
Expand Down
29 changes: 16 additions & 13 deletions web3/eth/async_eth.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import asyncio
import warnings
from typing import (
Awaitable,
Callable,
Expand All @@ -9,27 +8,28 @@
Type,
Union,
)

from hexbytes import (
HexBytes,
)
from web3._utils.blocks import (
select_method_for_block_identifier,
)
from web3._utils.filters import AsyncFilter, select_filter_method
from web3.utils import (
async_handle_offchain_lookup,
)
import warnings

from eth_typing import (
Address,
BlockNumber,
ChecksumAddress,
HexStr,
)
from hexbytes import (
HexBytes,
)

from web3._utils.blocks import (
select_method_for_block_identifier,
)
from web3._utils.fee_utils import (
async_fee_history_priority_fee,
)
from web3._utils.filters import (
AsyncFilter,
select_filter_method,
)
from web3._utils.rpc_abi import (
RPC,
)
Expand All @@ -51,11 +51,11 @@
default_root_munger,
)
from web3.types import (
ENS,
BlockData,
BlockIdentifier,
BlockParams,
CallOverride,
ENS,
FeeHistory,
FilterParams,
LogReceipt,
Expand All @@ -67,6 +67,9 @@
Wei,
_Hash32,
)
from web3.utils import (
async_handle_offchain_lookup,
)


class AsyncEth(BaseEth):
Expand Down
5 changes: 3 additions & 2 deletions web3/eth/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
List,
NoReturn,
Optional,
overload,
Sequence,
Tuple,
Type,
Union,
overload,
)

from eth_account import (
Expand All @@ -25,6 +25,7 @@
from eth_utils.toolz import (
assoc,
)

from web3._utils.empty import (
Empty,
empty,
Expand All @@ -39,9 +40,9 @@
Module,
)
from web3.types import (
ENS,
BlockIdentifier,
CallOverride,
ENS,
FilterParams,
GasPriceStrategy,
TxParams,
Expand Down
3 changes: 0 additions & 3 deletions web3/eth/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@
ChecksumAddress,
HexStr,
)
from eth_utils import (
is_string,
)
from eth_utils.toolz import (
merge,
)
Expand Down

0 comments on commit e8118fe

Please sign in to comment.