Skip to content

Commit

Permalink
chore: linting
Browse files Browse the repository at this point in the history
  • Loading branch information
iamdefinitelyahuman committed Feb 2, 2024
1 parent 5331b71 commit 1f28415
Show file tree
Hide file tree
Showing 19 changed files with 11 additions and 34 deletions.
4 changes: 0 additions & 4 deletions brownie/convert/datatypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@


class Wei(int):

"""Integer subclass that converts a value to wei and allows comparison against
similarly formatted values.
Expand Down Expand Up @@ -125,7 +124,6 @@ def _return_int(original: Any, value: Any) -> int:


class Fixed(Decimal):

"""
Decimal subclass that allows comparison against strings, integers and Wei.
Expand Down Expand Up @@ -199,7 +197,6 @@ def _to_fixed(value: Any) -> Decimal:


class EthAddress(str):

"""String subclass that raises TypeError when compared to a non-address."""

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


class HexString(bytes):

"""Bytes subclass for hexstring comparisons. Raises TypeError if compared to
a non-hexstring. Evaluates True for hexstrings with the same value but differing
leading zeros or capitalization."""
Expand Down
1 change: 0 additions & 1 deletion brownie/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ class MainnetUndefined(Exception):


class VirtualMachineError(Exception):

"""
Raised when a call to a contract causes an EVM exception.
Expand Down
6 changes: 3 additions & 3 deletions brownie/network/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ def load(
break
except ValueError as e:
if allow_retry:
prompt = f"Incorrect password, try again: "
prompt = "Incorrect password, try again: "
password = None
continue
raise e
Expand Down Expand Up @@ -481,8 +481,8 @@ def _check_for_revert(self, tx: Dict) -> None:
except ValueError as exc:
exc = VirtualMachineError(exc)
raise ValueError(
f"Execution reverted during call: '{exc.revert_msg}'. This transaction will likely revert. "
"If you wish to broadcast, include `allow_revert:True` as a transaction parameter.",
f"Execution reverted during call: '{exc.revert_msg}'. This transaction will likely "
"revert. If you wish to broadcast, include `allow_revert:True` as a parameter.",
) from None

def deploy(
Expand Down
2 changes: 0 additions & 2 deletions brownie/network/alert.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@


class Alert:

"""Setup notifications and callbacks based on state changes to the blockchain.
The alert is immediatly active as soon as the class is insantiated."""

Expand All @@ -25,7 +24,6 @@ def __init__(
callback: Callable = None,
repeat: bool = False,
) -> None:

"""Creates a new Alert.
Args:
Expand Down
2 changes: 1 addition & 1 deletion brownie/network/contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -1624,7 +1624,7 @@ def call(
raise ValueError("No data was returned - the call likely reverted")
try:
return self.decode_output(data)
except:
except Exception:
raise ValueError(f"Call reverted: {decode_typed_error(data)}") from None

def transact(self, *args: Tuple, silent: bool = False) -> TransactionReceiptType:
Expand Down
1 change: 0 additions & 1 deletion brownie/network/middlewares/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@


class BrownieMiddlewareABC(ABC):

"""
Base ABC for all middlewares.
Expand Down
1 change: 0 additions & 1 deletion brownie/network/middlewares/caching.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ def _new_filter(w3: Web3) -> Any:


class RequestCachingMiddleware(BrownieMiddlewareABC):

"""
Web3 middleware for request caching.
"""
Expand Down
1 change: 0 additions & 1 deletion brownie/network/middlewares/catch_tx_revert.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


class TxRevertCatcherMiddleware(BrownieMiddlewareABC):

"""
Middleware to handle reverting transactions, bypasses web3 error formatting.
Expand Down
2 changes: 0 additions & 2 deletions brownie/network/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@


class TxHistory(metaclass=_Singleton):

"""List-like singleton container that contains TransactionReceipt objects.
Whenever a transaction is broadcast, the TransactionReceipt is automatically
added to this container."""
Expand Down Expand Up @@ -187,7 +186,6 @@ def _gas(self, fn_name: str, gas_used: int, is_success: bool) -> None:


class Chain(metaclass=_Singleton):

"""
List-like singleton used to access block data, and perform actions such as
snapshotting, mining, and chain rewinds.
Expand Down
3 changes: 1 addition & 2 deletions brownie/project/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@


class Build:

"""Methods for accessing and manipulating a project's contract build data."""

def __init__(self, sources: Sources) -> None:
Expand Down Expand Up @@ -74,7 +73,7 @@ def _generate_revert_map(self, pcMap: Dict, source_map: Dict, language: str) ->
for k, v in pcMap.items()
if v["op"] in ("REVERT", "INVALID") or "jump_revert" in v
):
if "path" not in data or data["path"] == None:
if "path" not in data or data["path"] is None:
continue
path_str = source_map[data["path"]]

Expand Down
4 changes: 1 addition & 3 deletions brownie/project/compiler/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ def generate_input_json(
optimizer: Optional[Dict] = None,
viaIR: Optional[bool] = None,
) -> Dict:

"""Formats contracts to the standard solc input json.
Args:
Expand Down Expand Up @@ -216,7 +215,7 @@ def _get_solc_remappings(remappings: Optional[list]) -> list:
remapped_dict[key] = path.parent.joinpath(remap_dict.pop(key)).as_posix()
else:
remapped_dict[path.name] = path.as_posix()
for (k, v) in remap_dict.items():
for k, v in remap_dict.items():
if packages.joinpath(v).exists():
remapped_dict[k] = packages.joinpath(v).as_posix()

Expand All @@ -238,7 +237,6 @@ def _get_allow_paths(allow_paths: Optional[str], remappings: list) -> str:
def compile_from_input_json(
input_json: Dict, silent: bool = True, allow_paths: Optional[str] = None
) -> Dict:

"""
Compiles contracts from a standard input json.
Expand Down
3 changes: 1 addition & 2 deletions brownie/project/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from pathlib import Path
from types import ModuleType
from typing import Any, Dict, Iterator, KeysView, List, Optional, Set, Tuple, Union
from urllib.parse import quote, urlparse
from urllib.parse import quote

import requests
import yaml
Expand Down Expand Up @@ -42,7 +42,6 @@
ProjectAlreadyLoaded,
ProjectNotFound,
)
from brownie.network import web3
from brownie.network.contract import (
Contract,
ContractContainer,
Expand Down
2 changes: 1 addition & 1 deletion brownie/project/scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def run(
project._add_to_main_namespace()

# modify sys.path to ensure script can be imported
if type(script) == WindowsPath:
if isinstance(script, WindowsPath):
# far from elegant but just works
root_path = str(Path(".").resolve())
script = script.relative_to(Path("..").resolve())
Expand Down
2 changes: 0 additions & 2 deletions brownie/project/sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@


class Sources:

"""Methods for accessing and manipulating a project's contract source files."""

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


def get_pragma_spec(source: str, path: Optional[str] = None) -> NpmSpec:

"""
Extracts pragma information from Solidity source code.
Expand Down
2 changes: 1 addition & 1 deletion brownie/test/managers/master.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def pytest_sessionfinish(self, session):
raise pytest.UsageError(
"xdist workers failed to collect tests. Ensure all test cases are "
"isolated with the module_isolation or fn_isolation fixtures.\n\n"
"https://eth-brownie.readthedocs.io/en/stable/tests-pytest-intro.html#pytest-fixtures-isolation"
"https://eth-brownie.readthedocs.io/en/stable/tests-pytest-intro.html#pytest-fixtures-isolation" # noqa e501
)
build_path = self.project._build_path

Expand Down
5 changes: 0 additions & 5 deletions brownie/utils/docopt.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,10 @@ def levenshtein(source: str, target: str) -> int:


class DocoptLanguageError(Exception):

"""Error in construction of usage-message by developer."""


class DocoptExit(SystemExit):

"""Exit in case user invoked program with incorrect arguments."""

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


class LeafPattern(Pattern):

"""Leaf/terminal node of a pattern tree."""

def __repr__(self) -> str:
Expand Down Expand Up @@ -212,7 +209,6 @@ def match(


class BranchPattern(Pattern):

"""Branch/inner node of a pattern tree."""

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


class OptionsShortcut(NotRequired):

"""Marker/placeholder for [options] shortcut."""


Expand Down
1 change: 1 addition & 0 deletions tests/cli/test_console.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def test_multiple_commands(testproject, accounts, history, console):
assert len(history) == 2
assert testproject.BrownieTester[0].owner() == accounts[0]


def test_multiple_commands_with_nocompile(testproject_nocompile, accounts, history, console):
shell = console(testproject_nocompile)
_run_cmd(
Expand Down
1 change: 0 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import sys
from copy import deepcopy
from pathlib import Path
from typing import Dict, List

import pytest
import solcx
Expand Down
2 changes: 1 addition & 1 deletion tests/project/test_brownie_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def test_validate_cmd_settings():
"""
cmd_settings_dict = yaml.safe_load(cmd_settings)
valid_dict = _validate_cmd_settings(cmd_settings_dict)
for (k, v) in cmd_settings_dict.items():
for k, v in cmd_settings_dict.items():
assert valid_dict[k] == v


Expand Down

0 comments on commit 1f28415

Please sign in to comment.