Skip to content

Commit

Permalink
Replace web3._utils.toolz imports
Browse files Browse the repository at this point in the history
This commit replaces all `web3._utils.toolz` imports with
`eth_utils.toolz` imports via basic text substitution.

The only exception worth noting is in `web3/middleware/pythonic.py`,
where an import from `web3._utils.toolz.curried` has been replaced by
`cytoolz.curried`.
  • Loading branch information
jmcph4 authored and kclowes committed May 9, 2019
1 parent 388cd2d commit 404bcd4
Show file tree
Hide file tree
Showing 40 changed files with 145 additions and 198 deletions.
3 changes: 1 addition & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
from eth_utils import (
to_bytes,
)

from web3._utils.toolz import (
from eth_utils.toolz import (
identity,
)

Expand Down
9 changes: 4 additions & 5 deletions tests/core/contracts/test_contract_ambiguous_functions.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import pytest

from hexbytes import (
HexBytes,
)

from web3._utils.toolz import (
from eth_utils.toolz import (
compose,
curry,
)
from hexbytes import (
HexBytes,
)

AMBIGUOUS_CONTRACT_ABI = [
{
Expand Down
3 changes: 2 additions & 1 deletion tests/core/contracts/test_contract_buildTransaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

import pytest

from web3._utils.toolz import (
from eth_utils.toolz import (
dissoc,
)

from web3.exceptions import (
ValidationError,
)
Expand Down
6 changes: 3 additions & 3 deletions tests/core/contracts/test_contract_call_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@
import pytest

import eth_abi
from eth_utils.toolz import (
identity,
)
from hexbytes import (
HexBytes,
)

from web3._utils.ens import (
contract_ens_addresses,
)
from web3._utils.toolz import (
identity,
)
from web3.exceptions import (
BadFunctionCallOutput,
BlockNumberOutofRange,
Expand Down
3 changes: 2 additions & 1 deletion tests/core/contracts/test_contract_caller_interface.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import pytest

from web3._utils.toolz import (
from eth_utils.toolz import (
identity,
)

from web3.exceptions import (
MismatchedABI,
NoABIFound,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import pytest

from eth_utils.toolz import (
partial,
)

from web3._utils.blocks import (
select_method_for_block_identifier,
)
from web3._utils.toolz import (
partial,
)

selector_fn = partial(
select_method_for_block_identifier,
Expand Down
6 changes: 3 additions & 3 deletions tests/core/eth-module/test_accounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
from eth_utils import (
is_checksum_address,
)
from eth_utils.toolz import (
dissoc,
)
from hexbytes import (
HexBytes,
)
Expand All @@ -20,9 +23,6 @@
to_bytes,
to_hex,
)
from web3._utils.toolz import (
dissoc,
)
from web3.providers.eth_tester import (
EthereumTesterProvider,
)
Expand Down
10 changes: 5 additions & 5 deletions tests/core/middleware/test_transaction_signing.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@
to_bytes,
to_hex,
)
from eth_utils.toolz import (
identity,
merge,
valfilter,
)
from hexbytes import (
HexBytes,
)

from web3 import Web3
from web3._utils.toolz import (
identity,
merge,
valfilter,
)
from web3.exceptions import (
InvalidAddress,
)
Expand Down
8 changes: 4 additions & 4 deletions tests/generate_go_ethereum_fixture.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
to_text,
to_wei,
)
from eth_utils.toolz import (
merge,
valmap,
)

from tests.utils import (
get_open_port,
Expand All @@ -35,10 +39,6 @@
MATH_ABI,
MATH_BYTECODE,
)
from web3._utils.toolz import (
merge,
valmap,
)

COINBASE = '0xdc544d1aa88ff8bbd2f2aec754b1f1e99e1812fd'
COINBASE_PK = '0x58d23b55bc9cdce1f18c2500f40ff4ab7245df9a89505e9b1fa4851f623d241d'
Expand Down
6 changes: 3 additions & 3 deletions tests/integration/generate_fixtures/go_ethereum.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
is_dict,
is_same_address,
)
from eth_utils.toolz import (
merge,
)

import common
from tests.utils import (
Expand All @@ -24,9 +27,6 @@
MATH_ABI,
MATH_BYTECODE,
)
from web3._utils.toolz import (
merge,
)

# this script is used for generating the parity fixture
# to generate geth fixtures use tests/generate_go_ethereum_fixture.py
Expand Down
6 changes: 3 additions & 3 deletions tests/integration/generate_fixtures/parity.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@
from eth_utils import (
to_text,
)
from eth_utils.toolz import (
merge,
)

import common
import go_ethereum
from tests.utils import (
get_open_port,
)
from web3 import Web3
from web3._utils.toolz import (
merge,
)

CHAIN_CONFIG = {
"name": "CrossClient",
Expand Down
10 changes: 5 additions & 5 deletions web3/_utils/abi.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,18 @@
from eth_utils.abi import (
collapse_if_tuple,
)
from eth_utils.toolz import (
curry,
partial,
pipe,
)

from web3._utils.ens import (
is_ens_name,
)
from web3._utils.formatters import (
recursive_map,
)
from web3._utils.toolz import (
curry,
partial,
pipe,
)
from web3.exceptions import (
FallbackNotFound,
)
Expand Down
8 changes: 4 additions & 4 deletions web3/_utils/contracts.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
function_abi_to_4byte_selector,
is_text,
)
from eth_utils.toolz import (
pipe,
valmap,
)
from hexbytes import (
HexBytes,
)
Expand Down Expand Up @@ -39,10 +43,6 @@
abi_ens_resolver,
abi_string_to_text,
)
from web3._utils.toolz import (
pipe,
valmap,
)
from web3.exceptions import (
ValidationError,
)
Expand Down
5 changes: 3 additions & 2 deletions web3/_utils/datatypes.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import web3._utils.formatters
from web3._utils.toolz import (
from eth_utils.toolz import (
concat,
)

import web3._utils.formatters


def verify_attr(class_name, key, namespace):
if key not in namespace:
Expand Down
6 changes: 3 additions & 3 deletions web3/_utils/encoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
remove_0x_prefix,
to_hex,
)
from eth_utils.toolz import (
curry,
)
from hexbytes import (
HexBytes,
)
Expand All @@ -34,9 +37,6 @@
size_of_type,
sub_type_of_array_type,
)
from web3._utils.toolz import (
curry,
)
from web3._utils.validation import (
assert_one_val,
validate_abi_type,
Expand Down
14 changes: 7 additions & 7 deletions web3/_utils/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@
to_hex,
to_tuple,
)
from eth_utils.toolz import (
complement,
compose,
cons,
curry,
valfilter,
)

import web3
from web3._utils.encoding import (
Expand All @@ -35,13 +42,6 @@
from web3._utils.normalizers import (
BASE_RETURN_NORMALIZERS,
)
from web3._utils.toolz import (
complement,
compose,
cons,
curry,
valfilter,
)
from web3.datastructures import (
AttributeDict,
)
Expand Down
8 changes: 4 additions & 4 deletions web3/_utils/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
is_string,
is_text,
)
from eth_utils.toolz import (
complement,
curry,
)
from hexbytes import (
HexBytes,
)
Expand All @@ -20,10 +24,6 @@
from web3._utils.threads import (
TimerClass,
)
from web3._utils.toolz import (
complement,
curry,
)
from web3._utils.validation import (
validate_address,
)
Expand Down
10 changes: 5 additions & 5 deletions web3/_utils/formatters.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@
to_dict,
to_list,
)

from web3._utils.decorators import (
reject_recursive_repeats,
)
from web3._utils.toolz import (
from eth_utils.toolz import (
compose,
curry,
dissoc,
)

from web3._utils.decorators import (
reject_recursive_repeats,
)


def hex_to_integer(value):
return int(value, 16)
Expand Down
6 changes: 3 additions & 3 deletions web3/_utils/normalizers.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
from eth_utils.address import (
is_binary_address,
)
from eth_utils.toolz import (
curry,
)
from hexbytes import (
HexBytes,
)
Expand All @@ -36,9 +39,6 @@
is_ens_name,
validate_name_has_address,
)
from web3._utils.toolz import (
curry,
)
from web3._utils.validation import (
validate_abi,
validate_address,
Expand Down
6 changes: 3 additions & 3 deletions web3/_utils/rpc_abi.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
from eth_utils import (
to_dict,
)
from eth_utils.toolz import (
curry,
)

from web3._utils.abi import (
map_abi_data,
)
from web3._utils.formatters import (
apply_formatter_at_index,
)
from web3._utils.toolz import (
curry,
)

TRANSACTION_PARAMS_ABIS = {
'data': 'bytes',
Expand Down
Loading

0 comments on commit 404bcd4

Please sign in to comment.