mirror of
https://github.com/FlipsideCrypto/web3.py.git
synced 2026-02-06 10:56:47 +00:00
Remove the config object
This commit is contained in:
parent
96cf8e15cc
commit
c4b7e5d688
@ -31,20 +31,6 @@ def test_input_address_formatter_errors(value):
|
||||
formatters.input_address_formatter(value)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"value,expected",
|
||||
[
|
||||
('latest', 'latest'),
|
||||
('pending', 'pending'),
|
||||
('earliest', 'earliest'),
|
||||
(1, '0x1'),
|
||||
('0x1', '0x1')
|
||||
]
|
||||
)
|
||||
def test_inputDefaultBlockNumberFormatter(value, expected):
|
||||
assert formatters.inputDefaultBlockNumberFormatter(value) == expected
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"value,expected",
|
||||
[
|
||||
|
||||
@ -31,7 +31,6 @@ from web3.utils.functional import (
|
||||
identity,
|
||||
compose,
|
||||
)
|
||||
import web3.utils.config as config
|
||||
|
||||
|
||||
def isPredefinedBlockNumber(blockNumber):
|
||||
@ -40,13 +39,6 @@ def isPredefinedBlockNumber(blockNumber):
|
||||
return force_text(blockNumber) in {"latest", "pending", "earliest"}
|
||||
|
||||
|
||||
def inputDefaultBlockNumberFormatter(blockNumber=None):
|
||||
if not blockNumber:
|
||||
return config.defaultBlock
|
||||
|
||||
return inputBlockNumberFormatter(blockNumber)
|
||||
|
||||
|
||||
def inputBlockNumberFormatter(blockNumber):
|
||||
if not blockNumber:
|
||||
return None
|
||||
|
||||
17
web3/main.py
17
web3/main.py
@ -39,7 +39,6 @@ from web3.utils.address import (
|
||||
is_checksum_address,
|
||||
to_checksum_address,
|
||||
)
|
||||
from web3.utils import config
|
||||
|
||||
|
||||
class Web3(object):
|
||||
@ -67,22 +66,6 @@ class Web3(object):
|
||||
self.IPCProvider = IPCProvider
|
||||
self.TestRPCProvider = TestRPCProvider
|
||||
|
||||
class Config:
|
||||
|
||||
def __getattr__(self, key):
|
||||
if key == "defaultAccount":
|
||||
return config.defaultAccount
|
||||
elif key == "defaultBlock":
|
||||
return config.defaultBlock
|
||||
|
||||
def __setattr__(self, key, value):
|
||||
if key == "defaultAccount":
|
||||
config.defaultAccount = value
|
||||
elif key == "defaultBlock":
|
||||
config.defaultBlock = value
|
||||
|
||||
self.config = Config()
|
||||
|
||||
# Encoding and Decoding
|
||||
self.toHex = to_hex
|
||||
self.toAscii = decode_hex
|
||||
|
||||
Loading…
Reference in New Issue
Block a user