Skip to content
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

Move web3.utils to web3._utils #1033

Merged
merged 5 commits into from
Sep 19, 2018
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
10 changes: 6 additions & 4 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@
import time
import warnings

from web3._utils.threads import (
Timeout,
)
from web3.main import (
Web3,
)
from web3.providers.eth_tester import (
EthereumTesterProvider,
)
from web3.utils.threads import (
Timeout,
)
from web3.main import Web3


class PollDelayCounter:
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
to_bytes,
)

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

Expand Down
2 changes: 1 addition & 1 deletion tests/core/caching-utils/test_generate_cache_key.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
strategies as st,
)

from web3.utils.caching import (
from web3._utils.caching import (
generate_cache_key,
)

Expand Down
2 changes: 1 addition & 1 deletion tests/core/contracts/test_args_and_kwargs_merger.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pytest

from web3.utils.abi import (
from web3._utils.abi import (
merge_args_and_kwargs,
)

Expand Down
2 changes: 1 addition & 1 deletion tests/core/contracts/test_contract_ambiguous_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
HexBytes,
)

from web3.utils.toolz import (
from web3._utils.toolz import (
compose,
curry,
)
Expand Down
2 changes: 1 addition & 1 deletion tests/core/contracts/test_contract_buildTransaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import pytest

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

Expand Down
12 changes: 6 additions & 6 deletions tests/core/contracts/test_contract_call_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
HexBytes,
)

from web3._utils.ens import (
contract_ens_addresses,
)
from web3._utils.toolz import (
identity,
)
from web3.exceptions import (
BadFunctionCallOutput,
BlockNumberOutofRange,
Expand All @@ -21,12 +27,6 @@
NoABIFunctionsFound,
ValidationError,
)
from web3.utils.ens import (
contract_ens_addresses,
)
from web3.utils.toolz import (
identity,
)

# Ignore warning in pyethereum 1.6 - will go away with the upgrade
pytestmark = pytest.mark.filterwarnings("ignore:implicit cast from 'char *'")
Expand Down
8 changes: 4 additions & 4 deletions tests/core/contracts/test_contract_init.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import pytest

from web3._utils.ens import (
contract_ens_addresses,
ens_addresses,
)
from web3.exceptions import (
BadFunctionCallOutput,
NameNotFound,
)
from web3.utils.ens import (
contract_ens_addresses,
ens_addresses,
)


@pytest.fixture()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import json
import pytest

from web3.exceptions import (
ValidationError,
)
from web3.utils.abi import (
from web3._utils.abi import (
get_abi_input_types,
)
from web3.utils.function_identifiers import (
from web3._utils.function_identifiers import (
FallbackFn,
)
from web3.exceptions import (
ValidationError,
)

SINGLE_FN_NO_ARGS = json.loads('[{"constant":false,"inputs":[],"name":"a","outputs":[],"type":"function"}]') # noqa: E501
SINGLE_FN_ONE_ARG = json.loads('[{"constant":false,"inputs":[{"name":"","type":"uint256"}],"name":"a","outputs":[],"type":"function"}]') # noqa: E501
Expand Down
2 changes: 1 addition & 1 deletion tests/core/contracts/test_contract_transact_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
to_bytes,
)

from web3.utils.empty import (
from web3._utils.empty import (
empty,
)

Expand Down
2 changes: 1 addition & 1 deletion tests/core/contracts/test_extracting_event_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
is_same_address,
)

from web3.utils.events import (
from web3._utils.events import (
get_event_data,
)

Expand Down
2 changes: 1 addition & 1 deletion tests/core/contracts/test_extracting_event_data_old.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
is_same_address,
)

from web3.utils.events import (
from web3._utils.events import (
get_event_data,
)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import pytest

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

Expand Down
2 changes: 1 addition & 1 deletion tests/core/empty-object/test_empty_object_is_falsy.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from web3.utils.empty import (
from web3._utils.empty import (
empty,
)

Expand Down
10 changes: 5 additions & 5 deletions tests/core/eth-module/test_accounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@
Account,
Web3,
)
from web3.providers.eth_tester import (
EthereumTesterProvider,
)
from web3.utils.encoding import (
from web3._utils.encoding import (
to_bytes,
to_hex,
)
from web3.utils.toolz import (
from web3._utils.toolz import (
dissoc,
)
from web3.providers.eth_tester import (
EthereumTesterProvider,
)

# from https://github.com/ethereum/tests/blob/3930ca3a9a377107d5792b3e7202f79c688f1a67/BasicTests/txtest.json # noqa: 501
ETH_TEST_TRANSACTIONS = [
Expand Down
6 changes: 3 additions & 3 deletions tests/core/filtering/test_existing_filter_instance.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import pytest

from web3._utils.threads import (
Timeout,
)
from web3.providers.eth_tester import (
EthereumTesterProvider,
)
from web3.utils.threads import (
Timeout,
)


@pytest.fixture()
Expand Down
6 changes: 3 additions & 3 deletions tests/core/filtering/test_filter_against_latest_blocks.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from web3._utils.threads import (
Timeout,
)
from web3.providers.eth_tester import (
EthereumTesterProvider,
)
from web3.utils.threads import (
Timeout,
)


def test_sync_filter_against_latest_blocks(web3, sleep_interval, wait_for_block):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
flaky,
)

from web3.utils.threads import (
from web3._utils.threads import (
Timeout,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
flaky,
)

from web3.utils.threads import (
from web3._utils.threads import (
Timeout,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
)

from web3 import Web3
from web3._utils.caching import (
generate_cache_key,
)
from web3.middleware import ( # noqa: F401
construct_error_generator_middleware,
construct_latest_block_based_cache_middleware,
Expand All @@ -18,9 +21,6 @@
from web3.providers.base import (
BaseProvider,
)
from web3.utils.caching import (
generate_cache_key,
)


@pytest.fixture
Expand Down
6 changes: 3 additions & 3 deletions tests/core/middleware/test_simple_cache_middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
import uuid

from web3 import Web3
from web3._utils.caching import (
generate_cache_key,
)
from web3.middleware import (
construct_error_generator_middleware,
construct_result_generator_middleware,
Expand All @@ -11,9 +14,6 @@
from web3.providers.base import (
BaseProvider,
)
from web3.utils.caching import (
generate_cache_key,
)


@pytest.fixture
Expand Down
6 changes: 3 additions & 3 deletions tests/core/middleware/test_time_based_cache_middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
import uuid

from web3 import Web3
from web3._utils.caching import (
generate_cache_key,
)
from web3.middleware import ( # noqa: F401
construct_error_generator_middleware,
construct_result_generator_middleware,
Expand All @@ -12,9 +15,6 @@
from web3.providers.base import (
BaseProvider,
)
from web3.utils.caching import (
generate_cache_key,
)


@pytest.fixture
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 @@ -11,6 +11,11 @@
)

from web3 import Web3
from web3._utils.toolz import (
identity,
merge,
valfilter,
)
from web3.exceptions import (
InvalidAddress,
)
Expand All @@ -27,11 +32,6 @@
from web3.providers.eth_tester import (
EthereumTesterProvider,
)
from web3.utils.toolz import (
identity,
merge,
valfilter,
)

PRIVATE_KEY_1 = to_bytes(
hexstr='0x6a8b4de52b288e111c14e1c4b868bc125d325d40331d86d875a3467dd44bf829')
Expand Down
2 changes: 1 addition & 1 deletion tests/core/mining-module/test_miner_setExtra.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
flaky,
)

from web3.utils.threads import (
from web3._utils.threads import (
Timeout,
)

Expand Down
2 changes: 1 addition & 1 deletion tests/core/mining-module/test_miner_setGasPrice.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
flaky,
)

from web3.utils.threads import (
from web3._utils.threads import (
Timeout,
)

Expand Down
2 changes: 1 addition & 1 deletion tests/core/mining-module/test_miner_start.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
flaky,
)

from web3.utils.threads import (
from web3._utils.threads import (
Timeout,
)

Expand Down
2 changes: 1 addition & 1 deletion tests/core/mining-module/test_miner_stop.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
flaky,
)

from web3.utils.threads import (
from web3._utils.threads import (
Timeout,
)

Expand Down
2 changes: 1 addition & 1 deletion tests/core/txpool-module/test_txpool_content.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import random

from web3.utils.threads import (
from web3._utils.threads import (
Timeout,
)

Expand Down
2 changes: 1 addition & 1 deletion tests/core/txpool-module/test_txpool_inspect.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import random

from web3.utils.threads import (
from web3._utils.threads import (
Timeout,
)

Expand Down
4 changes: 2 additions & 2 deletions tests/core/utilities/test_abi.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@

import pytest

from web3.utils.abi import (
from web3._utils.abi import (
abi_data_tree,
map_abi_data,
)
from web3.utils.normalizers import (
from web3._utils.normalizers import (
BASE_RETURN_NORMALIZERS,
)

Expand Down
2 changes: 1 addition & 1 deletion tests/core/utilities/test_abi_filter_by_abi_name.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pytest

from web3.utils.abi import (
from web3._utils.abi import (
filter_by_name,
)

Expand Down
Loading