Skip to content

Commit

Permalink
chore: pr feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
NotPeopling2day committed Nov 7, 2023
1 parent 3c4249c commit a9b3a99
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 76 deletions.
1 change: 0 additions & 1 deletion .mdformat.toml

This file was deleted.

4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ repos:
- id: isort

- repo: https://github.com/psf/black
rev: 23.10.0
rev: 23.10.1
hooks:
- id: black
name: black
Expand All @@ -24,7 +24,7 @@ repos:
rev: v1.6.1
hooks:
- id: mypy
additional_dependencies: [types-setuptools, types-requests,]
additional_dependencies: [types-setuptools, types-requests, pydantic]

- repo: https://github.com/executablebooks/mdformat
rev: 0.7.17
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,5 @@ export POLYGON_BLOCKSCOUT_API_KEY=SAMPLE_KEY

## Development

This project is in development and should be considered a beta.
Things might not be in their final state and breaking changes may occur.
Please see the [contributing guide](CONTRIBUTING.md) to learn more how to contribute to this project.
Comments, questions, criticisms and pull requests are welcomed.
2 changes: 1 addition & 1 deletion ape_blockscout/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ def verify_source_code(
"action": "verifysourcecode",
"codeformat": code_format,
"compilerversion": compiler_version,
"constructorArguements": constructor_arguments,
"constructorArguments": constructor_arguments,
"contractaddress": self._address,
"contractname": contract_name,
"evmversion": evm_version,
Expand Down
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ requires = ["setuptools>=51.1.1", "wheel", "setuptools_scm[toml]>=5.0"]

[tool.mypy]
exclude = "build/"
plugins = []
plugins = ["pydantic.mypy"]

[tool.setuptools_scm]
write_to = "ape_blockscout/version.py"
Expand Down Expand Up @@ -37,3 +37,6 @@ force_grid_wrap = 0
include_trailing_comma = true
multi_line_output = 3
use_parentheses = true

[tool.mdformat]
number = true
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"mdformat>=0.7.17", # Auto-formatter for markdown
"mdformat-gfm>=0.3.5", # Needed for formatting GitHub-flavored markdown
"mdformat-frontmatter>=0.4.1", # Needed for frontmatters-style headers in issue templates
"pydantic<2", # Needed for successful type check
],
"release": [ # `release` GitHub Action job uses this
"setuptools", # Installation tool
Expand Down
4 changes: 2 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ def verification_params(address_to_verify, standard_input_json):
return {
"action": "verifysourcecode",
"codeformat": "solidity-standard-json-input",
"constructorArguements": ctor_args,
"constructorArguments": ctor_args,
"contractaddress": address_to_verify,
"contractname": "foo.sol:foo",
"evmversion": None,
Expand All @@ -455,7 +455,7 @@ def verification_params_with_ctor_args(
return {
"action": "verifysourcecode",
"codeformat": "solidity-standard-json-input",
"constructorArguements": ctor_args,
"constructorArguments": ctor_args,
"contractaddress": address_to_verify_with_ctor_args,
"contractname": "foo.sol:fooWithConstructor",
"evmversion": None,
Expand Down
67 changes: 0 additions & 67 deletions tests/test_blockscout.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from typing import Callable

import pytest

from ape_blockscout import NETWORKS
Expand Down Expand Up @@ -54,71 +52,6 @@
)


@pytest.fixture
def verification_tester_cls():
class VerificationTester:
counter = 0

def __init__(self, action_when_found: Callable, threshold: int = 2):
self.action_when_found = action_when_found
self.threshold = threshold

def sim(self):
# Simulate the contract type waiting in the queue until successful verification
if self.counter == self.threshold:
return self.action_when_found()

self.counter += 1
return "Pending in the queue"

return VerificationTester


@pytest.fixture
def setup_verification_test(
mock_backend, verification_params, verification_tester_cls, address_to_verify
):
def setup(found_handler: Callable, threshold: int = 2):
mock_backend.setup_mock_account_transactions_response(address=address_to_verify)
mock_backend.add_handler("POST", "contract", verification_params, return_value=PUBLISH_GUID)
verification_tester = verification_tester_cls(found_handler, threshold=threshold)
mock_backend.add_handler(
"GET",
"contract",
{"guid": PUBLISH_GUID},
side_effect=verification_tester.sim,
)
return verification_tester

return setup


@pytest.fixture
def setup_verification_test_with_ctor_args(
mock_backend,
verification_params_with_ctor_args,
verification_tester_cls,
address_to_verify_with_ctor_args,
):
def setup(found_handler: Callable, threshold: int = 2):
mock_backend.setup_mock_account_transactions_with_ctor_args_response(
address=address_to_verify_with_ctor_args
)
mock_backend.add_handler(
"POST", "contract", verification_params_with_ctor_args, return_value=PUBLISH_GUID
)
verification_tester = verification_tester_cls(found_handler, threshold=threshold)
mock_backend.add_handler(
"GET",
"contract",
{"guid": PUBLISH_GUID},
side_effect=verification_tester.sim,
)
return verification_tester

return setup


@base_url_test
def test_get_address_url(ecosystem, network, url, address, get_explorer):
expected = f"https://{url}/address/{address}"
Expand Down

0 comments on commit a9b3a99

Please sign in to comment.