From a05d3d21dce0450cf3951d362351a937ff336bd3 Mon Sep 17 00:00:00 2001 From: dromanov Date: Sat, 18 May 2024 22:50:50 +0300 Subject: [PATCH] Use `__all__` in `__init__.py` --- ens/__init__.py | 15 +++++++++++++-- web3/beacon/__init__.py | 5 +++++ web3/contract/__init__.py | 7 +++++++ web3/eth/__init__.py | 7 +++++++ web3/middleware/__init__.py | 22 ++++++++++++++++++++++ web3/providers/__init__.py | 15 +++++++++++++++ web3/providers/eth_tester/__init__.py | 5 +++++ web3/providers/persistent/__init__.py | 8 ++++++++ web3/providers/rpc/__init__.py | 5 +++++ web3/utils/__init__.py | 19 ++++++++++++++----- 10 files changed, 101 insertions(+), 7 deletions(-) diff --git a/ens/__init__.py b/ens/__init__.py index cb9a0d618a..2b28bc531c 100644 --- a/ens/__init__.py +++ b/ens/__init__.py @@ -1,5 +1,3 @@ -# flake8: noqa - from .async_ens import ( AsyncENS, ) @@ -18,3 +16,16 @@ UnderfundedBid, UnownedName, ) + +__all__ = [ + "AsyncENS", + "BaseENS", + "ENS", + "AddressMismatch", + "BidTooLow", + "InvalidLabel", + "InvalidName", + "UnauthorizedError", + "UnderfundedBid", + "UnownedName", +] diff --git a/web3/beacon/__init__.py b/web3/beacon/__init__.py index d10472a91d..a964633843 100644 --- a/web3/beacon/__init__.py +++ b/web3/beacon/__init__.py @@ -1,2 +1,7 @@ from .async_beacon import AsyncBeacon from .beacon import Beacon + +__all__ = [ + "AsyncBeacon", + "Beacon", +] diff --git a/web3/contract/__init__.py b/web3/contract/__init__.py index 11602cf6d7..6bca3bdb66 100644 --- a/web3/contract/__init__.py +++ b/web3/contract/__init__.py @@ -7,3 +7,10 @@ ContractCaller, ContractConstructor, ) + +__all__ = [ + "AsyncContract", + "AsyncContractCaller", + "Contract", + "ContractConstructor", +] diff --git a/web3/eth/__init__.py b/web3/eth/__init__.py index 6b692229bb..a65f64d1fb 100644 --- a/web3/eth/__init__.py +++ b/web3/eth/__init__.py @@ -8,3 +8,10 @@ Contract, Eth, ) + +__all__ = [ + "AsyncEth", + "BaseEth", + "Contract", + "Eth", +] diff --git a/web3/middleware/__init__.py b/web3/middleware/__init__.py index a04ec92010..eb554b021a 100644 --- a/web3/middleware/__init__.py +++ b/web3/middleware/__init__.py @@ -92,3 +92,25 @@ async def async_combine_middleware( initialized = mw(async_w3) accumulator_fn = await initialized.async_wrap_make_request(accumulator_fn) return accumulator_fn + + +__all__ = [ + "AttributeDictMiddleware", + "Middleware", + "Web3Middleware", + "BufferedGasEstimateMiddleware", + "LocalFilterMiddleware", + "FormattingMiddlewareBuilder", + "GasPriceStrategyMiddleware", + "ENSNameToAddressMiddleware", + "ExtraDataToPOAMiddleware", + "PythonicMiddleware", + "SignAndSendRawMiddlewareBuilder", + "StalecheckMiddlewareBuilder", + "ValidationMiddleware", + "AsyncWeb3", + "Web3", + "RPCResponse", + "combine_middleware", + "async_combine_middleware", +] diff --git a/web3/providers/__init__.py b/web3/providers/__init__.py index afd303f42e..4c0151a6dd 100644 --- a/web3/providers/__init__.py +++ b/web3/providers/__init__.py @@ -26,3 +26,18 @@ from .auto import ( AutoProvider, ) + +__all__ = [ + "AsyncBaseProvider", + "AsyncHTTPProvider", + "BaseProvider", + "JSONBaseProvider", + "IPCProvider", + "HTTPProvider", + "LegacyWebSocketProvider", + "AsyncIPCProvider", + "PersistentConnection", + "PersistentConnectionProvider", + "WebSocketProvider", + "AutoProvider", +] diff --git a/web3/providers/eth_tester/__init__.py b/web3/providers/eth_tester/__init__.py index dd3c39a06c..77e230cc80 100644 --- a/web3/providers/eth_tester/__init__.py +++ b/web3/providers/eth_tester/__init__.py @@ -2,3 +2,8 @@ AsyncEthereumTesterProvider, EthereumTesterProvider, ) + +__all__ = [ + "AsyncEthereumTesterProvider", + "EthereumTesterProvider", +] diff --git a/web3/providers/persistent/__init__.py b/web3/providers/persistent/__init__.py index 3538bd967c..3fcd540526 100644 --- a/web3/providers/persistent/__init__.py +++ b/web3/providers/persistent/__init__.py @@ -13,3 +13,11 @@ from .websocket import ( WebSocketProvider, ) + +__all__ = [ + "PersistentConnectionProvider", + "PersistentConnection", + "RequestProcessor", + "AsyncIPCProvider", + "WebSocketProvider", +] diff --git a/web3/providers/rpc/__init__.py b/web3/providers/rpc/__init__.py index cbac394616..9d1b2255cb 100644 --- a/web3/providers/rpc/__init__.py +++ b/web3/providers/rpc/__init__.py @@ -4,3 +4,8 @@ from .rpc import ( HTTPProvider, ) + +__all__ = [ + "AsyncHTTPProvider", + "HTTPProvider", +] diff --git a/web3/utils/__init__.py b/web3/utils/__init__.py index 13c24de6a0..b5d26527df 100644 --- a/web3/utils/__init__.py +++ b/web3/utils/__init__.py @@ -3,17 +3,26 @@ classify as breaking changes. """ -from .abi import ( # NOQA +from .abi import ( get_abi_input_names, get_abi_output_names, ) -from .address import get_create_address # NOQA -from .async_exception_handling import ( # NOQA +from .address import get_create_address +from .async_exception_handling import ( async_handle_offchain_lookup, ) -from .caching import ( # NOQA +from .caching import ( SimpleCache, ) -from .exception_handling import ( # NOQA +from .exception_handling import ( handle_offchain_lookup, ) + +__all__ = [ + "get_abi_input_names", + "get_abi_output_names", + "get_create_address", + "async_handle_offchain_lookup", + "SimpleCache", + "handle_offchain_lookup", +]