Skip to content

Commit c0abe60

Browse files
committed
Fix black, flake8 lint warnings
This also makes the exports explicit and aligns line lengths. The "line too long" check in flake8 is ignored in favor of black.
1 parent aaea42a commit c0abe60

File tree

3 files changed

+27
-29
lines changed

3 files changed

+27
-29
lines changed

pyevmasm/__init__.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,18 @@
22
from .evmasm import block_to_fork, DEFAULT_FORK
33
from .evmasm import assemble, assemble_all, assemble_hex, assemble_one
44
from .evmasm import disassemble, disassemble_all, disassemble_hex, disassemble_one
5+
6+
__all__ = [
7+
"instruction_tables",
8+
"Instruction",
9+
"block_to_fork",
10+
"DEFAULT_FORK",
11+
"assemble",
12+
"assemble_all",
13+
"assemble_hex",
14+
"assemble_one",
15+
"disassemble",
16+
"disassemble_all",
17+
"disassemble_hex",
18+
"disassemble_one",
19+
]

pyevmasm/evmasm.py

Lines changed: 9 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -989,9 +989,7 @@ def __repr__(self):
989989
"Message-call into this account with an alternative account's code, but persisting into this account with an alternative account's code.",
990990
)
991991
}
992-
homestead_instruction_table = InstructionTable( # type: ignore
993-
homestead_instruction_table, previous_fork=frontier_instruction_table
994-
)
992+
homestead_instruction_table = InstructionTable(homestead_instruction_table, previous_fork=frontier_instruction_table) # type: ignore
995993

996994
tangerine_whistle_instruction_table = {
997995
0x3B: ("EXTCODESIZE", 0, 1, 1, 700, "Get size of an account's code."),
@@ -1025,14 +1023,10 @@ def __repr__(self):
10251023
"Halt execution and register account for later deletion.",
10261024
),
10271025
}
1028-
tangerine_whistle_instruction_table = InstructionTable( # type: ignore
1029-
tangerine_whistle_instruction_table, previous_fork=homestead_instruction_table
1030-
)
1026+
tangerine_whistle_instruction_table = InstructionTable(tangerine_whistle_instruction_table, previous_fork=homestead_instruction_table) # type: ignore
10311027

10321028
spurious_dragon_instruction_table = {} # type: ignore
1033-
spurious_dragon_instruction_table = InstructionTable( # type: ignore
1034-
spurious_dragon_instruction_table, previous_fork=tangerine_whistle_instruction_table
1035-
)
1029+
spurious_dragon_instruction_table = InstructionTable(spurious_dragon_instruction_table, previous_fork=tangerine_whistle_instruction_table) # type: ignore
10361030

10371031
byzantium_instruction_table = {
10381032
0x3D: (
@@ -1061,9 +1055,7 @@ def __repr__(self):
10611055
"Stop execution and revert state changes, without consuming all provided gas and providing a reason.",
10621056
),
10631057
}
1064-
byzantium_instruction_table = InstructionTable( # type: ignore
1065-
byzantium_instruction_table, previous_fork=spurious_dragon_instruction_table
1066-
)
1058+
byzantium_instruction_table = InstructionTable(byzantium_instruction_table, previous_fork=spurious_dragon_instruction_table) # type: ignore
10671059

10681060
constantinople_instruction_table = {
10691061
0x1B: ("SHL", 0, 2, 1, 3, "Shift left."),
@@ -1079,9 +1071,7 @@ def __repr__(self):
10791071
"Behaves identically to CREATE, except using keccak256( 0xff ++ address ++ salt ++ keccak256(init_code)))[12:] as the address where the contract is initialized at",
10801072
),
10811073
}
1082-
constantinople_instruction_table = InstructionTable( # type: ignore
1083-
constantinople_instruction_table, previous_fork=byzantium_instruction_table
1084-
)
1074+
constantinople_instruction_table = InstructionTable(constantinople_instruction_table, previous_fork=byzantium_instruction_table) # type: ignore
10851075

10861076
serenity_instruction_table = InstructionTable(
10871077
{}, previous_fork=constantinople_instruction_table
@@ -1094,23 +1084,17 @@ def __repr__(self):
10941084
0x47: ("SELFBALANCE", 0, 0, 1, 5, "Balance of the current address."),
10951085
0x54: ("SLOAD", 0, 1, 1, 800, "Load word from storage."),
10961086
}
1097-
istanbul_instruction_table = InstructionTable( # type: ignore
1098-
istanbul_instruction_table, previous_fork=serenity_instruction_table
1099-
)
1087+
istanbul_instruction_table = InstructionTable(istanbul_instruction_table, previous_fork=serenity_instruction_table) # type: ignore
11001088

11011089
london_instruction_table = {0x48: ("BASEFEE", 0, 0, 1, 2, "Base fee in wei")}
11021090

1103-
london_instruction_table = InstructionTable( # type: ignore
1104-
london_instruction_table, previous_fork=istanbul_instruction_table
1105-
)
1091+
london_instruction_table = InstructionTable(london_instruction_table, previous_fork=istanbul_instruction_table) # type: ignore
11061092

11071093
shanghai_instruction_table = {
11081094
0x5F: ("PUSH", 0, 0, 1, 2, "Place 0 constant byte item on stack.")
11091095
}
11101096

1111-
shanghai_instruction_table = InstructionTable( # type: ignore
1112-
shanghai_instruction_table, previous_fork=london_instruction_table
1113-
)
1097+
shanghai_instruction_table = InstructionTable(shanghai_instruction_table, previous_fork=london_instruction_table) # type: ignore
11141098

11151099
cancun_instruction_table = {
11161100
0x49: ("BLOBHASH", 0, 1, 1, 3, "Get versioned hashes"),
@@ -1127,9 +1111,7 @@ def __repr__(self):
11271111
0x5E: ("MCOPY", 0, 3, 0, 3, "Copy memory areas"),
11281112
}
11291113

1130-
cancun_instruction_table = InstructionTable( # type: ignore
1131-
cancun_instruction_table, previous_fork=shanghai_instruction_table
1132-
)
1114+
cancun_instruction_table = InstructionTable(cancun_instruction_table, previous_fork=shanghai_instruction_table) # type: ignore
11331115

11341116
accepted_forks = (
11351117
"frontier",

pyproject.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,12 @@ test = ["nose", "coverage"]
4444
packages = ["pyevmasm"]
4545

4646
[tool.black]
47-
line-length = 160
47+
line-length = 88
4848
target-version = ['py38']
4949

5050
[tool.flake8]
51-
max-line-length = 160
51+
max-line-length = 88
52+
extend-ignore = "E501"
5253
exclude = [".tox", ".*.egg", ".git", "docs/", "examples/", "scripts/", "tests/", ".venv/"]
5354

5455
[tool.coverage.run]

0 commit comments

Comments
 (0)