Skip to content

Commit 3d14361

Browse files
authored
Merge pull request #1033 from dylanjw/_utils
Move web3.utils to web3._utils
2 parents a8a5032 + 7b13fd5 commit 3d14361

File tree

129 files changed

+374
-330
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

129 files changed

+374
-330
lines changed

conftest.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@
22
import time
33
import warnings
44

5+
from web3._utils.threads import (
6+
Timeout,
7+
)
8+
from web3.main import (
9+
Web3,
10+
)
511
from web3.providers.eth_tester import (
612
EthereumTesterProvider,
713
)
8-
from web3.utils.threads import (
9-
Timeout,
10-
)
11-
from web3.main import Web3
1214

1315

1416
class PollDelayCounter:

tests/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
to_bytes,
55
)
66

7-
from web3.utils.toolz import (
7+
from web3._utils.toolz import (
88
identity,
99
)
1010

tests/core/caching-utils/test_generate_cache_key.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
strategies as st,
99
)
1010

11-
from web3.utils.caching import (
11+
from web3._utils.caching import (
1212
generate_cache_key,
1313
)
1414

tests/core/contracts/test_args_and_kwargs_merger.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import pytest
22

3-
from web3.utils.abi import (
3+
from web3._utils.abi import (
44
merge_args_and_kwargs,
55
)
66

tests/core/contracts/test_contract_ambiguous_functions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
HexBytes,
55
)
66

7-
from web3.utils.toolz import (
7+
from web3._utils.toolz import (
88
compose,
99
curry,
1010
)

tests/core/contracts/test_contract_buildTransaction.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import pytest
44

5-
from web3.utils.toolz import (
5+
from web3._utils.toolz import (
66
dissoc,
77
)
88

tests/core/contracts/test_contract_call_interface.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@
1313
HexBytes,
1414
)
1515

16+
from web3._utils.ens import (
17+
contract_ens_addresses,
18+
)
19+
from web3._utils.toolz import (
20+
identity,
21+
)
1622
from web3.exceptions import (
1723
BadFunctionCallOutput,
1824
BlockNumberOutofRange,
@@ -21,12 +27,6 @@
2127
NoABIFunctionsFound,
2228
ValidationError,
2329
)
24-
from web3.utils.ens import (
25-
contract_ens_addresses,
26-
)
27-
from web3.utils.toolz import (
28-
identity,
29-
)
3030

3131
# Ignore warning in pyethereum 1.6 - will go away with the upgrade
3232
pytestmark = pytest.mark.filterwarnings("ignore:implicit cast from 'char *'")

tests/core/contracts/test_contract_init.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import pytest
22

3+
from web3._utils.ens import (
4+
contract_ens_addresses,
5+
ens_addresses,
6+
)
37
from web3.exceptions import (
48
BadFunctionCallOutput,
59
NameNotFound,
610
)
7-
from web3.utils.ens import (
8-
contract_ens_addresses,
9-
ens_addresses,
10-
)
1111

1212

1313
@pytest.fixture()

tests/core/contracts/test_contract_method_to_argument_matching.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import json
22
import pytest
33

4-
from web3.exceptions import (
5-
ValidationError,
6-
)
7-
from web3.utils.abi import (
4+
from web3._utils.abi import (
85
get_abi_input_types,
96
)
10-
from web3.utils.function_identifiers import (
7+
from web3._utils.function_identifiers import (
118
FallbackFn,
129
)
10+
from web3.exceptions import (
11+
ValidationError,
12+
)
1313

1414
SINGLE_FN_NO_ARGS = json.loads('[{"constant":false,"inputs":[],"name":"a","outputs":[],"type":"function"}]') # noqa: E501
1515
SINGLE_FN_ONE_ARG = json.loads('[{"constant":false,"inputs":[{"name":"","type":"uint256"}],"name":"a","outputs":[],"type":"function"}]') # noqa: E501

tests/core/contracts/test_contract_transact_interface.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
to_bytes,
77
)
88

9-
from web3.utils.empty import (
9+
from web3._utils.empty import (
1010
empty,
1111
)
1212

tests/core/contracts/test_extracting_event_data.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
is_same_address,
55
)
66

7-
from web3.utils.events import (
7+
from web3._utils.events import (
88
get_event_data,
99
)
1010

tests/core/contracts/test_extracting_event_data_old.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
is_same_address,
55
)
66

7-
from web3.utils.events import (
7+
from web3._utils.events import (
88
get_event_data,
99
)
1010

tests/core/core/block-utils/test_select_method_for_block_identifier.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import pytest
22

3-
from web3.utils.blocks import (
3+
from web3._utils.blocks import (
44
select_method_for_block_identifier,
55
)
6-
from web3.utils.toolz import (
6+
from web3._utils.toolz import (
77
partial,
88
)
99

tests/core/empty-object/test_empty_object_is_falsy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from web3.utils.empty import (
1+
from web3._utils.empty import (
22
empty,
33
)
44

tests/core/eth-module/test_accounts.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@
1616
Account,
1717
Web3,
1818
)
19-
from web3.providers.eth_tester import (
20-
EthereumTesterProvider,
21-
)
22-
from web3.utils.encoding import (
19+
from web3._utils.encoding import (
2320
to_bytes,
2421
to_hex,
2522
)
26-
from web3.utils.toolz import (
23+
from web3._utils.toolz import (
2724
dissoc,
2825
)
26+
from web3.providers.eth_tester import (
27+
EthereumTesterProvider,
28+
)
2929

3030
# from https://github.com/ethereum/tests/blob/3930ca3a9a377107d5792b3e7202f79c688f1a67/BasicTests/txtest.json # noqa: 501
3131
ETH_TEST_TRANSACTIONS = [

tests/core/filtering/test_existing_filter_instance.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import pytest
22

3+
from web3._utils.threads import (
4+
Timeout,
5+
)
36
from web3.providers.eth_tester import (
47
EthereumTesterProvider,
58
)
6-
from web3.utils.threads import (
7-
Timeout,
8-
)
99

1010

1111
@pytest.fixture()

tests/core/filtering/test_filter_against_latest_blocks.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1+
from web3._utils.threads import (
2+
Timeout,
3+
)
14
from web3.providers.eth_tester import (
25
EthereumTesterProvider,
36
)
4-
from web3.utils.threads import (
5-
Timeout,
6-
)
77

88

99
def test_sync_filter_against_latest_blocks(web3, sleep_interval, wait_for_block):

tests/core/filtering/test_filter_against_pending_transactions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
flaky,
66
)
77

8-
from web3.utils.threads import (
8+
from web3._utils.threads import (
99
Timeout,
1010
)
1111

tests/core/filtering/test_filter_against_transaction_logs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
flaky,
66
)
77

8-
from web3.utils.threads import (
8+
from web3._utils.threads import (
99
Timeout,
1010
)
1111

tests/core/middleware/test_latest_block_based_cache_middleware.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
)
1111

1212
from web3 import Web3
13+
from web3._utils.caching import (
14+
generate_cache_key,
15+
)
1316
from web3.middleware import ( # noqa: F401
1417
construct_error_generator_middleware,
1518
construct_latest_block_based_cache_middleware,
@@ -18,9 +21,6 @@
1821
from web3.providers.base import (
1922
BaseProvider,
2023
)
21-
from web3.utils.caching import (
22-
generate_cache_key,
23-
)
2424

2525

2626
@pytest.fixture

tests/core/middleware/test_simple_cache_middleware.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
import uuid
44

55
from web3 import Web3
6+
from web3._utils.caching import (
7+
generate_cache_key,
8+
)
69
from web3.middleware import (
710
construct_error_generator_middleware,
811
construct_result_generator_middleware,
@@ -11,9 +14,6 @@
1114
from web3.providers.base import (
1215
BaseProvider,
1316
)
14-
from web3.utils.caching import (
15-
generate_cache_key,
16-
)
1717

1818

1919
@pytest.fixture

tests/core/middleware/test_time_based_cache_middleware.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
import uuid
55

66
from web3 import Web3
7+
from web3._utils.caching import (
8+
generate_cache_key,
9+
)
710
from web3.middleware import ( # noqa: F401
811
construct_error_generator_middleware,
912
construct_result_generator_middleware,
@@ -12,9 +15,6 @@
1215
from web3.providers.base import (
1316
BaseProvider,
1417
)
15-
from web3.utils.caching import (
16-
generate_cache_key,
17-
)
1818

1919

2020
@pytest.fixture

tests/core/middleware/test_transaction_signing.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@
1111
)
1212

1313
from web3 import Web3
14+
from web3._utils.toolz import (
15+
identity,
16+
merge,
17+
valfilter,
18+
)
1419
from web3.exceptions import (
1520
InvalidAddress,
1621
)
@@ -27,11 +32,6 @@
2732
from web3.providers.eth_tester import (
2833
EthereumTesterProvider,
2934
)
30-
from web3.utils.toolz import (
31-
identity,
32-
merge,
33-
valfilter,
34-
)
3535

3636
PRIVATE_KEY_1 = to_bytes(
3737
hexstr='0x6a8b4de52b288e111c14e1c4b868bc125d325d40331d86d875a3467dd44bf829')

tests/core/mining-module/test_miner_setExtra.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
flaky,
88
)
99

10-
from web3.utils.threads import (
10+
from web3._utils.threads import (
1111
Timeout,
1212
)
1313

tests/core/mining-module/test_miner_setGasPrice.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
flaky,
55
)
66

7-
from web3.utils.threads import (
7+
from web3._utils.threads import (
88
Timeout,
99
)
1010

tests/core/mining-module/test_miner_start.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
flaky,
55
)
66

7-
from web3.utils.threads import (
7+
from web3._utils.threads import (
88
Timeout,
99
)
1010

tests/core/mining-module/test_miner_stop.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
flaky,
55
)
66

7-
from web3.utils.threads import (
7+
from web3._utils.threads import (
88
Timeout,
99
)
1010

tests/core/txpool-module/test_txpool_content.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import random
22

3-
from web3.utils.threads import (
3+
from web3._utils.threads import (
44
Timeout,
55
)
66

tests/core/txpool-module/test_txpool_inspect.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import random
22

3-
from web3.utils.threads import (
3+
from web3._utils.threads import (
44
Timeout,
55
)
66

tests/core/utilities/test_abi.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11

22
import pytest
33

4-
from web3.utils.abi import (
4+
from web3._utils.abi import (
55
abi_data_tree,
66
map_abi_data,
77
)
8-
from web3.utils.normalizers import (
8+
from web3._utils.normalizers import (
99
BASE_RETURN_NORMALIZERS,
1010
)
1111

tests/core/utilities/test_abi_filter_by_abi_name.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import pytest
22

3-
from web3.utils.abi import (
3+
from web3._utils.abi import (
44
filter_by_name,
55
)
66

0 commit comments

Comments
 (0)