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

[2/3] Linted file with isort in eth and tests directory #2099

Merged
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
2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# ignore SHA that added isort
2f421ce6049dc74a1520280adf8c350c1c567e9f
9 changes: 6 additions & 3 deletions eth/_utils/address.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
from eth_hash.auto import (
keccak,
)
from eth_typing import (
Address,
)
import rlp

from eth_hash.auto import keccak
from eth_typing import Address

from eth._utils.numeric import (
int_to_bytes32,
)
Expand Down
4 changes: 2 additions & 2 deletions eth/_utils/blake2/coders.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
from typing import (
cast,
Iterable,
Tuple,
cast,
)

from eth_utils import (
ValidationError,
to_int,
to_tuple,
ValidationError,
)

from .compression import (
Expand Down
15 changes: 8 additions & 7 deletions eth/_utils/bn128.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
from typing import (
Tuple,
)

from eth_utils import (
ValidationError,
)
from py_ecc import (
optimized_bn128 as bn128,
)
from py_ecc.optimized_bn128 import (
FQP,
FQ2,
FQP,
)

from eth_utils import (
ValidationError,
)

from typing import Tuple


def validate_point(x: int, y: int) -> Tuple[bn128.FQ, bn128.FQ, bn128.FQ]:
FQ = bn128.FQ
Expand Down
22 changes: 15 additions & 7 deletions eth/_utils/datatypes.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
from eth_utils.toolz import (
assoc,
groupby,
from typing import (
Any,
Dict,
Iterator,
List,
Tuple,
Type,
TypeVar,
)

from eth_utils import (
to_dict,
to_set,
)
from eth_utils.toolz import (
assoc,
groupby,
)


from typing import Any, Dict, Tuple, Type, TypeVar, Iterator, List

from eth.abc import ConfigurableAPI
from eth.abc import (
ConfigurableAPI,
)


def _is_local_prop(prop: str) -> bool:
Expand Down
2 changes: 0 additions & 2 deletions eth/_utils/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"""

import os

from typing import (
Any,
Callable,
Expand All @@ -16,7 +15,6 @@
Union,
)


# No set literals because we support Python 2.6.
TRUE_VALUES = {
True,
Expand Down
1 change: 0 additions & 1 deletion eth/_utils/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
TypeVar,
)


TItem = TypeVar('TItem')


Expand Down
12 changes: 7 additions & 5 deletions eth/_utils/headers.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,19 @@
Address,
)

from eth.abc import BlockHeaderAPI
from eth.abc import (
BlockHeaderAPI,
)
from eth.constants import (
BLANK_ROOT_HASH,
GENESIS_BLOCK_NUMBER,
GENESIS_PARENT_HASH,
GAS_LIMIT_EMA_DENOMINATOR,
GAS_LIMIT_ADJUSTMENT_FACTOR,
GAS_LIMIT_EMA_DENOMINATOR,
GAS_LIMIT_MAXIMUM,
GAS_LIMIT_MINIMUM,
GAS_LIMIT_USAGE_ADJUSTMENT_NUMERATOR,
GAS_LIMIT_USAGE_ADJUSTMENT_DENOMINATOR,
GAS_LIMIT_USAGE_ADJUSTMENT_NUMERATOR,
GENESIS_BLOCK_NUMBER,
GENESIS_PARENT_HASH,
ZERO_ADDRESS,
)
from eth.typing import (
Expand Down
5 changes: 3 additions & 2 deletions eth/_utils/module_loading.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from importlib import (
import_module,
)
import operator
from importlib import import_module

from types import (
ModuleType,
)
Expand Down
8 changes: 4 additions & 4 deletions eth/_utils/numeric.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@
Union,
)

from eth_utils.toolz import (
curry,
)
from eth_typing import (
Hash32,
)
from eth_utils.toolz import (
curry,
)

from eth.constants import (
UINT_255_MAX,
UINT_256_MAX,
UINT_256_CEILING,
UINT_256_MAX,
)


Expand Down
1 change: 0 additions & 1 deletion eth/_utils/padding.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
curry,
)


ZERO_BYTE = b'\x00'


Expand Down
11 changes: 5 additions & 6 deletions eth/_utils/rlp.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
import rlp
from typing import (
Iterable,
Optional,
Tuple,
)

from eth_utils.toolz import (
curry,
)

from eth_utils import (
to_tuple,
ValidationError,
to_tuple,
)
from eth_utils.toolz import (
curry,
)
import rlp

from eth.rlp.blocks import (
BaseBlock,
Expand Down
11 changes: 5 additions & 6 deletions eth/_utils/spoof.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,15 @@
merge,
)

from eth.constants import (
DEFAULT_SPOOF_Y_PARITY,
DEFAULT_SPOOF_R,
DEFAULT_SPOOF_S,
)

from eth.abc import (
SignedTransactionAPI,
UnsignedTransactionAPI,
)
from eth.constants import (
DEFAULT_SPOOF_R,
DEFAULT_SPOOF_S,
DEFAULT_SPOOF_Y_PARITY,
)

SPOOF_ATTRIBUTES_DEFAULTS = {
'y_parity': DEFAULT_SPOOF_Y_PARITY,
Expand Down
4 changes: 3 additions & 1 deletion eth/_utils/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
AccountDiff,
AccountState,
)
from eth.vm.state import BaseState
from eth.vm.state import (
BaseState,
)


@to_tuple
Expand Down
30 changes: 16 additions & 14 deletions eth/_utils/transactions.py
Original file line number Diff line number Diff line change
@@ -1,35 +1,37 @@
from typing import NamedTuple

import rlp
from typing import (
NamedTuple,
)

from eth_keys import keys
from eth_keys import datatypes
from eth_keys import (
datatypes,
keys,
)
from eth_keys.exceptions import (
BadSignature,
)

from eth_utils import (
int_to_big_endian,
ValidationError,
int_to_big_endian,
)
import rlp

from eth._utils.numeric import (
is_even,
)
from eth.abc import (
SignedTransactionAPI,
UnsignedTransactionAPI,
)
from eth.constants import (
CREATE_CONTRACT_ADDRESS,
)
from eth.rlp.transactions import (
BaseTransaction,
)
from eth.typing import (
Address,
VRS,
Address,
)
from eth._utils.numeric import (
is_even,
)

from eth.rlp.transactions import BaseTransaction


EIP155_CHAIN_ID_OFFSET = 35
# Add this offset to y_parity to get "v" for legacy transactions, from Frontier
Expand Down
4 changes: 3 additions & 1 deletion eth/_utils/version.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import sys

from eth import __version__
from eth import (
__version__,
)


def construct_evm_runtime_identifier() -> str:
Expand Down
8 changes: 6 additions & 2 deletions eth/_warnings.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
from contextlib import contextmanager
from typing import Iterator
from contextlib import (
contextmanager,
)
from typing import (
Iterator,
)
import warnings


Expand Down
29 changes: 16 additions & 13 deletions eth/abc.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from abc import (
ABC,
abstractmethod
abstractmethod,
)
from typing import (
Any,
Expand All @@ -9,6 +9,7 @@
ContextManager,
Dict,
FrozenSet,
Hashable,
Iterable,
Iterator,
List,
Expand All @@ -20,36 +21,38 @@
Type,
TypeVar,
Union,
Hashable,
)

from eth_bloom import BloomFilter

from eth_bloom import (
BloomFilter,
)
from eth_keys.datatypes import (
PrivateKey,
)
from eth_typing import (
Address,
BlockNumber,
Hash32,
)

from eth_utils import ExtendedDebugLogger

from eth_keys.datatypes import PrivateKey
from eth_utils import (
ExtendedDebugLogger,
)

from eth.constants import (
BLANK_ROOT_HASH,
)

from eth.exceptions import VMError
from eth.exceptions import (
VMError,
)
from eth.typing import (
AccountState,
BytesOrView,
ChainGaps,
JournalDBCheckpoint,
AccountState,
HeaderParams,
JournalDBCheckpoint,
VMConfiguration,
)


T = TypeVar('T')

# A decoded RLP object of unknown interpretation, with a maximum "depth" of 1.
Expand Down
Loading