Skip to content

Commit c6abd37

Browse files
committed
Snakecase clientVersion
1 parent c150caf commit c6abd37

File tree

12 files changed

+18
-17
lines changed

12 files changed

+18
-17
lines changed

docs/middleware.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ The easiest way to connect to a default ``geth --dev`` instance which loads the
389389
>>> from web3.auto.gethdev import w3
390390
391391
# confirm that the connection succeeded
392-
>>> w3.clientVersion
392+
>>> w3.client_version
393393
'Geth/v1.7.3-stable-4bb3c89d/linux-amd64/go1.9'
394394
395395
This example connects to a local ``geth --dev`` instance on Linux with a
@@ -408,7 +408,7 @@ unique IPC location and loads the middleware:
408408
>>> w3.middleware_onion.inject(geth_poa_middleware, layer=0)
409409
410410
# confirm that the connection succeeded
411-
>>> w3.clientVersion
411+
>>> w3.client_version
412412
'Geth/v1.7.3-stable-4bb3c89d/linux-amd64/go1.9'
413413
414414
Why is ``geth_poa_middleware`` necessary?

docs/providers.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,10 @@ For example, the following retrieves the client enode endpoint for both geth and
134134
135135
connected = w3.is_connected()
136136
137-
if connected and w3.clientVersion.startswith('Parity'):
137+
if connected and w3.client_version.startswith('Parity'):
138138
enode = w3.parity.enode
139139
140-
elif connected and w3.clientVersion.startswith('Geth'):
140+
elif connected and w3.client_version.startswith('Geth'):
141141
enode = w3.geth.admin.node_info['enode']
142142
143143
else:

docs/web3.main.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,15 @@ Attributes
3737
>>> web3.api
3838
"4.7.0"
3939
40-
.. py:attribute:: Web3.clientVersion
40+
.. py:attribute:: Web3.client_version
4141
4242
* Delegates to ``web3_clientVersion`` RPC Method
4343

4444
Returns the current client version.
4545

4646
.. code-block:: python
4747
48-
>>> web3.clientVersion
48+
>>> web3.client_version
4949
'Geth/v1.4.11-stable-fed692f6/darwin/go1.7'
5050
5151

newsfragments/2686.doc.rst

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Snakecase the clientVersion method

tests/core/version-module/test_version_module.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,4 @@ def test_legacy_version_deprecation(blocking_w3):
5555
async def test_async_blocking_version(async_w3, blocking_w3):
5656
assert async_w3.async_version.api == blocking_w3.api
5757

58-
assert await async_w3.async_version.node == blocking_w3.clientVersion
58+
assert await async_w3.async_version.node == blocking_w3.client_version

tests/core/web3-module/test_clientVersion.py

-2
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
def test_web3_client_version(w3):
2+
assert w3.client_version.startswith("EthereumTester/")

tests/integration/go_ethereum/common.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030

3131
class GoEthereumTest(Web3ModuleTest):
32-
def _check_web3_clientVersion(self, client_version):
32+
def _check_web3_client_version(self, client_version):
3333
assert client_version.startswith("Geth/")
3434

3535

tests/integration/test_ethereum_tester.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ def funded_account_for_raw_txn(w3):
251251

252252

253253
class TestEthereumTesterWeb3Module(Web3ModuleTest):
254-
def _check_web3_clientVersion(self, client_version):
254+
def _check_web3_client_version(self, client_version):
255255
assert client_version.startswith("EthereumTester/")
256256

257257

web3/_utils/module_testing/web3_module.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@
2525

2626

2727
class Web3ModuleTest:
28-
def test_web3_clientVersion(self, w3: Web3) -> None:
29-
client_version = w3.clientVersion
30-
self._check_web3_clientVersion(client_version)
28+
def test_web3_client_version(self, w3: Web3) -> None:
29+
client_version = w3.client_version
30+
self._check_web3_client_version(client_version)
3131

32-
def _check_web3_clientVersion(self, client_version: str) -> NoReturn:
32+
def _check_web3_client_version(self, client_version: str) -> NoReturn:
3333
raise NotImplementedError("Must be implemented by subclasses")
3434

3535
# Contract that calculated test values can be found at

web3/main.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ def provider(self, provider: Union[BaseProvider, AsyncBaseProvider]) -> None:
274274
self.manager.provider = provider
275275

276276
@property
277-
def clientVersion(self) -> str:
277+
def client_version(self) -> str:
278278
return self.manager.request_blocking(RPC.web3_clientVersion, [])
279279

280280
@property

web3/version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def api(self) -> NoReturn:
6060
@property
6161
def node(self) -> NoReturn:
6262
raise DeprecationWarning(
63-
"This method has been deprecated ... Please use web3.clientVersion instead."
63+
"This method has been deprecated ... Please use web3.client_version instead."
6464
)
6565

6666
@property

0 commit comments

Comments
 (0)