Skip to content

Commit 9d9cd99

Browse files
authored
Merge pull request #81 from Nurts/master
Fixing code styling according to Flake8
2 parents 3260849 + 027116d commit 9d9cd99

File tree

8 files changed

+16
-25
lines changed

8 files changed

+16
-25
lines changed

func_sig_registry/registry/models.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@
99
from django.core.exceptions import ValidationError
1010
from eth_utils import event_signature_to_log_topic
1111

12-
from func_sig_registry.utils.github import (
13-
get_repository_solidity_files,
14-
)
1512
from func_sig_registry.utils.solidity import (
1613
extract_function_signatures,
1714
normalize_function_signature,

func_sig_registry/registry/serializers.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
from func_sig_registry.utils.import_statistics import (
66
retrieve_stats_from_import_results,
7-
empty_import_stats,
87
)
98
from func_sig_registry.utils.abi import (
109
is_valid_contract_abi,

func_sig_registry/registry/tasks.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,10 @@ def perform_github_import(login_or_name, repository, branch):
2626
logger.info("Importing github repo %s/%s/%s", login_or_name,
2727
repository, branch)
2828
for file_path in get_repository_solidity_files(login_or_name, repository, branch):
29-
logger.info("importing solidity file: %s", file_path)
30-
with open(file_path) as solidity_file:
31-
try:
32-
Signature.import_from_solidity_file(solidity_file)
33-
EventSignature.import_from_solidity_file(solidity_file)
34-
except UnicodeDecodeError:
35-
logger.error('unicode error reading solidity file: %s',
36-
file_path)
29+
logger.info("importing solidity file: %s", file_path)
30+
with open(file_path) as solidity_file:
31+
try:
32+
Signature.import_from_solidity_file(solidity_file)
33+
EventSignature.import_from_solidity_file(solidity_file)
34+
except UnicodeDecodeError:
35+
logger.error('unicode error reading solidity file: %s', file_path)

func_sig_registry/registry/views.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
)
2929
from .forms import (
3030
AllSignatureCreateForm,
31-
SignatureForm,
3231
SolidityImportForm,
3332
SignatureSearchForm,
3433
EventSignatureSearchForm,
@@ -221,7 +220,8 @@ def post(self, *args, **kwargs):
221220
else:
222221
messages.success(
223222
self.request._request,
224-
"Found {0} function and event signatures. Imported {1}, Ignored {2}, Skipped {3} duplicates.".format(
223+
"Found {0} function and event signatures. Imported {1}, \
224+
Ignored {2}, Skipped {3} duplicates.".format(
225225
num_processed, num_imported, num_ignored, num_duplicates,
226226
),
227227
)
@@ -256,7 +256,8 @@ def post(self, *args, **kwargs):
256256

257257
messages.success(
258258
self.request._request,
259-
"Found {0} function and event signatures. Imported {1}, Ignored {2}, Skipped {3} duplicates.".format(
259+
"Found {0} function and event signatures. \
260+
Imported {1}, Ignored {2}, Skipped {3} duplicates.".format(
260261
num_processed, num_imported, num_ignored, num_duplicates
261262
),
262263
)

func_sig_registry/utils/abi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,4 +138,4 @@ def event_definition_to_text_signature(abi: Dict[str, Any]) -> str:
138138
[f"{collapse_if_tuple(abi_input)}{' indexed' if abi_input['indexed'] else ''}"
139139
for abi_input in abi.get('inputs', [])]
140140
),
141-
)
141+
)

func_sig_registry/utils/events_solidity.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
import itertools
22
import re
3-
from typing import (
4-
List,
5-
)
63

74
from eth_abi.exceptions import (
85
ParseError,
@@ -11,15 +8,11 @@
118
from eth_abi.grammar import (
129
parse as parse_type,
1310
normalize as normalize_type,
14-
ABIType,
15-
TupleType,
16-
BasicType,
1711
)
1812

1913
from func_sig_registry.utils.solidity import (
2014
get_arg_types,
2115
validate_standard_type,
22-
normalize_function_signature
2316
)
2417

2518
DYNAMIC_TYPES = ['bytes', 'string']

func_sig_registry/utils/import_statistics.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
ImportStats = namedtuple('ImportStats', ['num_processed', 'num_imported',
44
'num_duplicates', 'num_ignored'])
55

6+
67
def empty_import_stats():
78
return ImportStats(
89
num_processed=0,
@@ -11,6 +12,7 @@ def empty_import_stats():
1112
num_ignored=0,
1213
)
1314

15+
1416
def retrieve_stats_from_import_results(raw_import_results):
1517
num_processed = len(raw_import_results)
1618

@@ -34,4 +36,4 @@ def retrieve_stats_from_import_results(raw_import_results):
3436
num_imported=num_imported,
3537
num_duplicates=num_duplicates,
3638
num_ignored=num_ignored,
37-
)
39+
)

func_sig_registry/utils/solidity.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,4 +202,4 @@ def normalize_function_signature(raw_signature: str) -> str:
202202
except ABITypeError as e:
203203
raise ValueError('function args contain non-standard types') from e
204204
else:
205-
return f'{fn_name}{args_tuple_type.to_type_str()}'
205+
return f'{fn_name}{args_tuple_type.to_type_str()}'

0 commit comments

Comments
 (0)