Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
kclowes committed May 6, 2021
1 parent ab914a7 commit 5a76a89
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 13 deletions.
14 changes: 7 additions & 7 deletions tests/integration/go_ethereum/test_goethereum_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
get_open_port,
)
from web3 import Web3
from web3.eth import (
AsyncEth,
)
from web3.providers.rpc import (
AsyncHTTPProvider,
)

from .common import (
GoEthereumAdminModuleTest,
Expand All @@ -15,14 +21,8 @@
GoEthereumVersionModuleTest,
)
from .utils import (
wait_for_http,
wait_for_aiohttp,
)
from web3.providers.rpc import (
AsyncHTTPProvider,
)
from web3.eth import (
AsyncEth,
wait_for_http,
)


Expand Down
2 changes: 1 addition & 1 deletion tests/integration/go_ethereum/utils.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import aiohttp
import signal
import socket
import time

import aiohttp
import requests


Expand Down
8 changes: 5 additions & 3 deletions web3/eth.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from typing import (
Any,
Awaitable,
Callable,
Coroutine,
List,
NoReturn,
Optional,
Expand Down Expand Up @@ -105,21 +107,21 @@


class BaseEth(Module):
_gas_price: Method[Callable[[], Wei]] = Method(
_gas_price: Method[Callable[[], Union[Wei, Awaitable[Any]]]] = Method(
RPC.eth_gasPrice,
mungers=None,
)

@property
def gas_price(self) -> Wei:
def gas_price(self) -> Union[Coroutine[Any, Any, Wei], Wei]:
return self._gas_price()


class AsyncEth(BaseEth):
is_async = True

@property
async def gas_price(self) -> Wei:
async def gas_price(self) -> Coroutine[Any, Any, Wei]:
return await self._gas_price()


Expand Down
6 changes: 4 additions & 2 deletions web3/providers/async_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
from typing import (
TYPE_CHECKING,
Any,
Awaitable,
Callable,
Coroutine,
Tuple,
cast,
)
Expand Down Expand Up @@ -44,7 +46,7 @@ def middlewares(

def request_func(
self, web3: "Web3", outer_middlewares: MiddlewareOnion
) -> Callable[..., RPCResponse]:
) -> Coroutine[Any, Any, RPCResponse]:
# Placeholder - manager calls self.provider.request_func
# Eventually this will handle caching and return make_request
# along with all the middleware
Expand Down Expand Up @@ -75,7 +77,7 @@ async def decode_rpc_response(self, raw_response: bytes) -> RPCResponse:
text_response = to_text(raw_response)
return cast(RPCResponse, FriendlyJsonSerde().json_decode(text_response))

async def isConnected(self) -> bool:
async def isConnected(self) -> Awaitable[Any]:
try:
response = await self.make_request(RPCEndpoint('web3_clientVersion'), [])
except IOError:
Expand Down

0 comments on commit 5a76a89

Please sign in to comment.