Skip to content

converted Web3 instance variables to 'w3'. #1186

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions docs/internals.rst
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ a list when instantiating your ``Web3`` object.

.. code-block:: python

>>> web3 = Web3([provider_a, provider_b])
>>> w3 = Web3([provider_a, provider_b])



Expand Down Expand Up @@ -145,7 +145,7 @@ business logic for web3 requests. Writing middleware is simple.

.. code-block:: python

def simple_middleware(make_request, web3):
def simple_middleware(make_request, w3):
# do one-time setup operations here

def middleware(method, params):
Expand All @@ -167,8 +167,8 @@ It is also possible to implement middlewares as a class.
.. code-block:: python

class SimpleMiddleware:
def __init__(self, make_request, web3):
self.web3 = web3
def __init__(self, make_request, w3):
self.w3 = w3
self.make_request = make_request

def __call__(self, method, params):
Expand Down
12 changes: 6 additions & 6 deletions docs/overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ local development this would be something like ``ws://127.0.0.1:8546``.
# Note that you should create only one RPCProvider per
# process, as it recycles underlying TCP/IP network connections between
# your process and Ethereum node
>>> web3 = Web3(HTTPProvider('http://localhost:8545'))
>>> w3 = Web3(HTTPProvider('http://localhost:8545'))

# or for an IPC based connection
>>> web3 = Web3(IPCProvider())
>>> w3 = Web3(IPCProvider())

# or for Websocket based connection
>>> web3 = Web3(WebsocketProvider('ws://127.0.0.1:8546'))
>>> w3 = Web3(WebsocketProvider('ws://127.0.0.1:8546'))


Base API
Expand Down Expand Up @@ -207,7 +207,7 @@ Addresses

.. code-block:: python

>>> web3.isAddress('0xd3CdA913deB6f67967B99D67aCDFa1712C293601')
>>> wch3.isAddress('0xd3CdA913deB6f67967B99D67aCDFa1712C293601')
True


Expand All @@ -218,9 +218,9 @@ Addresses

.. code-block:: python

>>> web3.isChecksumAddress('0xd3CdA913deB6f67967B99D67aCDFa1712C293601')
>>> wch3.isChecksumAddress('0xd3CdA913deB6f67967B99D67aCDFa1712C293601')
True
>>> web3.isChecksumAddress('0xd3cda913deb6f67967b99d67acdfa1712c293601')
>>> wch3.isChecksumAddress('0xd3cda913deb6f67967b99d67acdfa1712c293601')
False


Expand Down
12 changes: 6 additions & 6 deletions docs/providers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ HTTPProvider
.. code-block:: python

>>> from web3 import Web3
>>> web3 = Web3(Web3.HTTPProvider("http://127.0.0.1:8545"))
>>> w3 = Web3(Web3.HTTPProvider("http://127.0.0.1:8545"))

Note that you should create only one HTTPProvider per python
process, as the HTTPProvider recycles underlying TCP/IP network connections,
Expand All @@ -225,7 +225,7 @@ HTTPProvider
.. code-block:: python

>>> from web3 import Web3
>>> web3 = Web3(Web3.HTTPProvider("http://127.0.0.1:8545", request_kwargs={'timeout': 60}))
>>> w3 = Web3(Web3.HTTPProvider("http://127.0.0.1:8545", request_kwargs={'timeout': 60}))


IPCProvider
Expand All @@ -241,7 +241,7 @@ IPCProvider
.. code-block:: python

>>> from web3 import Web3
>>> web3 = Web3(Web3.IPCProvider("~/Library/Ethereum/geth.ipc"))
>>> w3 = Web3(Web3.IPCProvider("~/Library/Ethereum/geth.ipc"))

If no ``ipc_path`` is specified, it will use the first IPC file
it can find from this list:
Expand Down Expand Up @@ -275,7 +275,7 @@ WebsocketProvider
.. code-block:: python

>>> from web3 import Web3
>>> web3 = Web3(Web3.WebsocketProvider("ws://127.0.0.1:8546"))
>>> w3 = Web3(Web3.WebsocketProvider("ws://127.0.0.1:8546"))

Under the hood, the ``WebsocketProvider`` uses the python websockets library for
making requests. If you would like to modify how requests are made, you can
Expand All @@ -286,7 +286,7 @@ WebsocketProvider
.. code-block:: python

>>> from web3 import Web3
>>> web3 = Web3(Web3.WebsocketProvider("http://127.0.0.1:8546", websocket_kwargs={'timeout': 60}))
>>> w3 = Web3(Web3.WebsocketProvider("http://127.0.0.1:8546", websocket_kwargs={'timeout': 60}))

.. py:currentmodule:: web3.providers.eth_tester

Expand Down Expand Up @@ -366,7 +366,7 @@ simply instantiate your web3 instance with an iterable of provider instances.
>>> from . import MySpecialProvider
>>> special_provider = MySpecialProvider()
>>> infura_provider = HTTPProvider('https://ropsten.infura.io')
>>> web3 = Web3([special_provider, infura_provider])
>>> w3 = Web3([special_provider, infura_provider])


When web3 has multiple providers it will iterate over them in order, trying the
Expand Down