Skip to content

Commit 0b5f3e0

Browse files
chore: linting
1 parent af40b55 commit 0b5f3e0

19 files changed

+11
-34
lines changed

brownie/convert/datatypes.py

-4
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131

3232

3333
class Wei(int):
34-
3534
"""Integer subclass that converts a value to wei and allows comparison against
3635
similarly formatted values.
3736
@@ -125,7 +124,6 @@ def _return_int(original: Any, value: Any) -> int:
125124

126125

127126
class Fixed(Decimal):
128-
129127
"""
130128
Decimal subclass that allows comparison against strings, integers and Wei.
131129
@@ -199,7 +197,6 @@ def _to_fixed(value: Any) -> Decimal:
199197

200198

201199
class EthAddress(str):
202-
203200
"""String subclass that raises TypeError when compared to a non-address."""
204201

205202
def __new__(cls, value: Union[bytes, str]) -> str:
@@ -231,7 +228,6 @@ def _address_compare(a: Any, b: Any) -> bool:
231228

232229

233230
class HexString(bytes):
234-
235231
"""Bytes subclass for hexstring comparisons. Raises TypeError if compared to
236232
a non-hexstring. Evaluates True for hexstrings with the same value but differing
237233
leading zeros or capitalization."""

brownie/exceptions.py

-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ class MainnetUndefined(Exception):
7777

7878

7979
class VirtualMachineError(Exception):
80-
8180
"""
8281
Raised when a call to a contract causes an EVM exception.
8382

brownie/network/account.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ def load(
233233
break
234234
except ValueError as e:
235235
if allow_retry:
236-
prompt = f"Incorrect password, try again: "
236+
prompt = "Incorrect password, try again: "
237237
password = None
238238
continue
239239
raise e
@@ -481,8 +481,8 @@ def _check_for_revert(self, tx: Dict) -> None:
481481
except ValueError as exc:
482482
exc = VirtualMachineError(exc)
483483
raise ValueError(
484-
f"Execution reverted during call: '{exc.revert_msg}'. This transaction will likely revert. "
485-
"If you wish to broadcast, include `allow_revert:True` as a transaction parameter.",
484+
f"Execution reverted during call: '{exc.revert_msg}'. This transaction will likely "
485+
"revert. If you wish to broadcast, include `allow_revert:True` as a parameter.",
486486
) from None
487487

488488
def deploy(

brownie/network/alert.py

-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212

1313
class Alert:
14-
1514
"""Setup notifications and callbacks based on state changes to the blockchain.
1615
The alert is immediatly active as soon as the class is insantiated."""
1716

@@ -25,7 +24,6 @@ def __init__(
2524
callback: Callable = None,
2625
repeat: bool = False,
2726
) -> None:
28-
2927
"""Creates a new Alert.
3028
3129
Args:

brownie/network/contract.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1624,7 +1624,7 @@ def call(
16241624
raise ValueError("No data was returned - the call likely reverted")
16251625
try:
16261626
return self.decode_output(data)
1627-
except:
1627+
except Exception:
16281628
raise ValueError(f"Call reverted: {decode_typed_error(data)}") from None
16291629

16301630
def transact(self, *args: Tuple, silent: bool = False) -> TransactionReceiptType:

brownie/network/middlewares/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99

1010
class BrownieMiddlewareABC(ABC):
11-
1211
"""
1312
Base ABC for all middlewares.
1413

brownie/network/middlewares/caching.py

-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ def _new_filter(w3: Web3) -> Any:
9494

9595

9696
class RequestCachingMiddleware(BrownieMiddlewareABC):
97-
9897
"""
9998
Web3 middleware for request caching.
10099
"""

brownie/network/middlewares/catch_tx_revert.py

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77

88
class TxRevertCatcherMiddleware(BrownieMiddlewareABC):
9-
109
"""
1110
Middleware to handle reverting transactions, bypasses web3 error formatting.
1211

brownie/network/state.py

-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131

3232

3333
class TxHistory(metaclass=_Singleton):
34-
3534
"""List-like singleton container that contains TransactionReceipt objects.
3635
Whenever a transaction is broadcast, the TransactionReceipt is automatically
3736
added to this container."""
@@ -187,7 +186,6 @@ def _gas(self, fn_name: str, gas_used: int, is_success: bool) -> None:
187186

188187

189188
class Chain(metaclass=_Singleton):
190-
191189
"""
192190
List-like singleton used to access block data, and perform actions such as
193191
snapshotting, mining, and chain rewinds.

brownie/project/build.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737

3838

3939
class Build:
40-
4140
"""Methods for accessing and manipulating a project's contract build data."""
4241

4342
def __init__(self, sources: Sources) -> None:
@@ -74,7 +73,7 @@ def _generate_revert_map(self, pcMap: Dict, source_map: Dict, language: str) ->
7473
for k, v in pcMap.items()
7574
if v["op"] in ("REVERT", "INVALID") or "jump_revert" in v
7675
):
77-
if "path" not in data or data["path"] == None:
76+
if "path" not in data or data["path"] is None:
7877
continue
7978
path_str = source_map[data["path"]]
8079

brownie/project/compiler/__init__.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@ def generate_input_json(
153153
optimizer: Optional[Dict] = None,
154154
viaIR: Optional[bool] = None,
155155
) -> Dict:
156-
157156
"""Formats contracts to the standard solc input json.
158157
159158
Args:
@@ -216,7 +215,7 @@ def _get_solc_remappings(remappings: Optional[list]) -> list:
216215
remapped_dict[key] = path.parent.joinpath(remap_dict.pop(key)).as_posix()
217216
else:
218217
remapped_dict[path.name] = path.as_posix()
219-
for (k, v) in remap_dict.items():
218+
for k, v in remap_dict.items():
220219
if packages.joinpath(v).exists():
221220
remapped_dict[k] = packages.joinpath(v).as_posix()
222221

@@ -238,7 +237,6 @@ def _get_allow_paths(allow_paths: Optional[str], remappings: list) -> str:
238237
def compile_from_input_json(
239238
input_json: Dict, silent: bool = True, allow_paths: Optional[str] = None
240239
) -> Dict:
241-
242240
"""
243241
Compiles contracts from a standard input json.
244242

brownie/project/main.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from pathlib import Path
1515
from types import ModuleType
1616
from typing import Any, Dict, Iterator, KeysView, List, Optional, Set, Tuple, Union
17-
from urllib.parse import quote, urlparse
17+
from urllib.parse import quote
1818

1919
import requests
2020
import yaml
@@ -42,7 +42,6 @@
4242
ProjectAlreadyLoaded,
4343
ProjectNotFound,
4444
)
45-
from brownie.network import web3
4645
from brownie.network.contract import (
4746
Contract,
4847
ContractContainer,

brownie/project/scripts.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def run(
4747
project._add_to_main_namespace()
4848

4949
# modify sys.path to ensure script can be imported
50-
if type(script) == WindowsPath:
50+
if isinstance(script, WindowsPath):
5151
# far from elegant but just works
5252
root_path = str(Path(".").resolve())
5353
script = script.relative_to(Path("..").resolve())

brownie/project/sources.py

-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515

1616
class Sources:
17-
1817
"""Methods for accessing and manipulating a project's contract source files."""
1918

2019
def __init__(self, contract_sources: Dict, interface_sources: Dict) -> None:
@@ -202,7 +201,6 @@ def get_contract_names(full_source: str) -> List:
202201

203202

204203
def get_pragma_spec(source: str, path: Optional[str] = None) -> NpmSpec:
205-
206204
"""
207205
Extracts pragma information from Solidity source code.
208206

brownie/test/managers/master.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def pytest_sessionfinish(self, session):
6464
raise pytest.UsageError(
6565
"xdist workers failed to collect tests. Ensure all test cases are "
6666
"isolated with the module_isolation or fn_isolation fixtures.\n\n"
67-
"https://eth-brownie.readthedocs.io/en/stable/tests-pytest-intro.html#pytest-fixtures-isolation"
67+
"https://eth-brownie.readthedocs.io/en/stable/tests-pytest-intro.html#pytest-fixtures-isolation" # noqa e501
6868
)
6969
build_path = self.project._build_path
7070

brownie/utils/docopt.py

-5
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,10 @@ def levenshtein(source: str, target: str) -> int:
102102

103103

104104
class DocoptLanguageError(Exception):
105-
106105
"""Error in construction of usage-message by developer."""
107106

108107

109108
class DocoptExit(SystemExit):
110-
111109
"""Exit in case user invoked program with incorrect arguments."""
112110

113111
usage = ""
@@ -168,7 +166,6 @@ def transform(pattern: "BranchPattern") -> "Either":
168166

169167

170168
class LeafPattern(Pattern):
171-
172169
"""Leaf/terminal node of a pattern tree."""
173170

174171
def __repr__(self) -> str:
@@ -212,7 +209,6 @@ def match(
212209

213210

214211
class BranchPattern(Pattern):
215-
216212
"""Branch/inner node of a pattern tree."""
217213

218214
def __init__(self, *children) -> None:
@@ -347,7 +343,6 @@ def match(self, left: List["Pattern"], collected: List["Pattern"] = None) -> Any
347343

348344

349345
class OptionsShortcut(NotRequired):
350-
351346
"""Marker/placeholder for [options] shortcut."""
352347

353348

tests/cli/test_console.py

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ def test_multiple_commands(testproject, accounts, history, console):
4141
assert len(history) == 2
4242
assert testproject.BrownieTester[0].owner() == accounts[0]
4343

44+
4445
def test_multiple_commands_with_nocompile(testproject_nocompile, accounts, history, console):
4546
shell = console(testproject_nocompile)
4647
_run_cmd(

tests/conftest.py

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import sys
88
from copy import deepcopy
99
from pathlib import Path
10-
from typing import Dict, List
1110

1211
import pytest
1312
import solcx

tests/project/test_brownie_config.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def test_validate_cmd_settings():
122122
"""
123123
cmd_settings_dict = yaml.safe_load(cmd_settings)
124124
valid_dict = _validate_cmd_settings(cmd_settings_dict)
125-
for (k, v) in cmd_settings_dict.items():
125+
for k, v in cmd_settings_dict.items():
126126
assert valid_dict[k] == v
127127

128128

0 commit comments

Comments
 (0)