Skip to content

Commit 2029495

Browse files
committed
style: sorted imports
1 parent c81e84c commit 2029495

File tree

7 files changed

+72
-46
lines changed

7 files changed

+72
-46
lines changed

uniswap/cli.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
import logging
22
import os
3+
from typing import Optional
34

45
import click
56
from dotenv import load_dotenv
67
from web3 import Web3
7-
from typing import Optional
88

9-
from .uniswap import Uniswap, AddressLike, _str_to_addr
9+
from .constants import ETH_ADDRESS
1010
from .token import BaseToken
1111
from .tokens import get_tokens
12-
from .constants import ETH_ADDRESS
13-
12+
from .uniswap import AddressLike, Uniswap, _str_to_addr
1413

1514
logger = logging.getLogger(__name__)
1615

uniswap/constants.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from typing import Set, cast
2-
from web3.types import ( # noqa: F401
3-
RPCEndpoint,
4-
)
2+
3+
from web3.types import RPCEndpoint # noqa: F401
54

65
# look at web3/middleware/cache.py for reference
76
# RPC methods that will be cached inside _get_eth_simple_cache_middleware

uniswap/decorators.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
11
import functools
2-
from typing import Callable, List, TYPE_CHECKING, TypeVar, Optional
3-
from typing_extensions import ParamSpec, Concatenate
2+
from typing import (
3+
TYPE_CHECKING,
4+
Callable,
5+
List,
6+
Optional,
7+
TypeVar,
8+
)
9+
10+
from typing_extensions import Concatenate, ParamSpec
411

5-
from .types import AddressLike
612
from .constants import ETH_ADDRESS
13+
from .types import AddressLike
714

815
if TYPE_CHECKING:
916
from .uniswap import Uniswap

uniswap/token.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from dataclasses import dataclass
2+
23
from .types import AddressLike
34

45

uniswap/tokens.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
from typing import Dict
22

3-
from web3 import Web3
43
from eth_typing.evm import ChecksumAddress
5-
4+
from web3 import Web3
65

76
tokens_mainnet: Dict[str, ChecksumAddress] = {
87
k: Web3.to_checksum_address(v)

uniswap/uniswap.py

Lines changed: 36 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,64 @@
1-
from collections import namedtuple
1+
import functools
2+
import logging
23
import os
34
import time
4-
import logging
5-
import functools
6-
from typing import List, Any, Optional, Sequence, Union, Tuple, Iterable, Dict
5+
from collections import namedtuple
6+
from typing import (
7+
Any,
8+
Dict,
9+
Iterable,
10+
List,
11+
Optional,
12+
Sequence,
13+
Tuple,
14+
Union,
15+
)
716

17+
from eth_typing.evm import Address, ChecksumAddress
18+
from hexbytes import HexBytes
819
from web3 import Web3
920
from web3._utils.abi import map_abi_data
1021
from web3._utils.normalizers import BASE_RETURN_NORMALIZERS
1122
from web3.contract import Contract
1223
from web3.contract.contract import ContractFunction
1324
from web3.exceptions import BadFunctionCallOutput, ContractLogicError
1425
from web3.types import (
26+
Nonce,
1527
TxParams,
1628
TxReceipt,
1729
Wei,
18-
Nonce,
1930
)
20-
from eth_typing.evm import Address, ChecksumAddress
21-
from hexbytes import HexBytes
22-
from .types import AddressLike
31+
32+
from .constants import (
33+
ETH_ADDRESS,
34+
MAX_TICK,
35+
MAX_UINT_128,
36+
MIN_TICK,
37+
WETH9_ADDRESS,
38+
_factory_contract_addresses_v1,
39+
_factory_contract_addresses_v2,
40+
_netid_to_name,
41+
_router_contract_addresses_v2,
42+
_tick_bitmap_range,
43+
_tick_spacing,
44+
)
45+
from .decorators import check_approval, supports
46+
from .exceptions import InsufficientBalance, InvalidToken
2347
from .token import ERC20Token
24-
from .exceptions import InvalidToken, InsufficientBalance
48+
from .types import AddressLike
2549
from .util import (
26-
_get_eth_simple_cache_middleware,
27-
_str_to_addr,
2850
_addr_to_str,
29-
_validate_address,
51+
_get_eth_simple_cache_middleware,
3052
_load_contract,
3153
_load_contract_erc20,
54+
_str_to_addr,
55+
_validate_address,
3256
chunks,
3357
encode_sqrt_ratioX96,
3458
is_same_address,
3559
nearest_tick,
3660
realised_fee_percentage,
3761
)
38-
from .decorators import supports, check_approval
39-
from .constants import (
40-
MAX_UINT_128,
41-
MAX_TICK,
42-
MIN_TICK,
43-
WETH9_ADDRESS,
44-
_netid_to_name,
45-
_factory_contract_addresses_v1,
46-
_factory_contract_addresses_v2,
47-
_router_contract_addresses_v2,
48-
_tick_spacing,
49-
_tick_bitmap_range,
50-
ETH_ADDRESS,
51-
)
5262

5363
logger = logging.getLogger(__name__)
5464

uniswap/util.py

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,30 @@
1-
import os
1+
import functools
22
import json
33
import math
4-
import functools
5-
import lru
6-
7-
from typing import Any, Generator, List, Sequence, Tuple, Union
4+
import os
5+
from typing import (
6+
Any,
7+
Generator,
8+
List,
9+
Sequence,
10+
Tuple,
11+
Union,
12+
)
813

14+
import lru
915
from web3 import Web3
10-
from web3.exceptions import NameNotFound
1116
from web3.contract import Contract
17+
from web3.exceptions import NameNotFound
1218
from web3.middleware.cache import construct_simple_cache_middleware
1319
from web3.types import Middleware
1420

15-
from .constants import MIN_TICK, MAX_TICK, _tick_spacing, SIMPLE_CACHE_RPC_WHITELIST
16-
from .types import AddressLike, Address
21+
from .constants import (
22+
MAX_TICK,
23+
MIN_TICK,
24+
SIMPLE_CACHE_RPC_WHITELIST,
25+
_tick_spacing,
26+
)
27+
from .types import Address, AddressLike
1728

1829

1930
def _get_eth_simple_cache_middleware() -> Middleware:

0 commit comments

Comments
 (0)