-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
change linting to use pre-commit (#3297)
* change linting to use pre-commit, change releases.rst to release_notes.rst to match template * run check-yaml, check-toml, end-of-file-fixer, and trailing-whitespace * run pyupgrade * run black * run flake8 and autoflake and fix errors * run isort * run pydocstyle and fix errors * run mdformat * run mypy and fix unused-ignore errors * Ignore mypy disallow_subclassing_any and warn_return_any errors, clear remaining * run blocklint and clear errors * clear unused casts, clear B008 ignore where possible * re-run lint after rebasing to main * add pydantic types to mypy checking, turn on no-subclassing-any mypy rule, ignore the few places we do * clear B008 errors in HTTPProvider and AsyncHTTPProvider
- Loading branch information
Showing
122 changed files
with
704 additions
and
677 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
exclude: '.project-template|docs/conf.py|.bumpversion.cfg' | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.5.0 | ||
hooks: | ||
- id: check-yaml | ||
- id: check-toml | ||
- id: end-of-file-fixer | ||
- id: trailing-whitespace | ||
- repo: https://github.com/asottile/pyupgrade | ||
rev: v3.15.0 | ||
hooks: | ||
- id: pyupgrade | ||
args: [--py38-plus] | ||
- repo: https://github.com/psf/black | ||
rev: 23.9.1 | ||
hooks: | ||
- id: black | ||
- repo: https://github.com/PyCQA/flake8 | ||
rev: 6.1.0 | ||
hooks: | ||
- id: flake8 | ||
additional_dependencies: | ||
- flake8-bugbear==23.9.16 | ||
exclude: setup.py | ||
- repo: https://github.com/PyCQA/autoflake | ||
rev: v2.2.1 | ||
hooks: | ||
- id: autoflake | ||
- repo: https://github.com/pycqa/isort | ||
rev: 5.12.0 | ||
hooks: | ||
- id: isort | ||
- repo: https://github.com/pycqa/pydocstyle | ||
rev: 6.3.0 | ||
hooks: | ||
- id: pydocstyle | ||
additional_dependencies: | ||
- tomli # required until >= python311 | ||
- repo: https://github.com/executablebooks/mdformat | ||
rev: 0.7.17 | ||
hooks: | ||
- id: mdformat | ||
additional_dependencies: | ||
- mdformat-gfm | ||
- repo: https://github.com/pre-commit/mirrors-mypy | ||
rev: v1.5.1 | ||
hooks: | ||
- id: mypy | ||
exclude: 'tests/|conftest.py' | ||
additional_dependencies: | ||
- pydantic | ||
- types-setuptools | ||
- types-requests | ||
- repo: https://github.com/PrincetonUniversity/blocklint | ||
rev: v0.2.4 | ||
hooks: | ||
- id: blocklint | ||
exclude: 'normalization_tests.json|docs/(Makefile|release_notes.rst|web3.eth.rst|ens_overview.rst|abi_types.rst|transactions.rst)' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Use ``pre-commit`` for linting, run updated lint tools and fix errors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,60 @@ | ||
methods/* | ||
These files define all methods callable under | ||
web3.db.* | ||
web3.eth.* | ||
web3.net.* | ||
web3.personal.* | ||
|
||
Methods and properties are first defined as a dictionary | ||
and then are converted to real functions and attached to the | ||
respective objects. This will make it easier to mirror the | ||
next migrations of the web3.js library. Both types are defined | ||
in method.py and property.py respectively. | ||
methods/\* | ||
These files define all methods callable under | ||
web3.db.\* | ||
web3.eth.\* | ||
web3.net.\* | ||
web3.personal.\* | ||
|
||
``` | ||
Methods and properties are first defined as a dictionary | ||
and then are converted to real functions and attached to the | ||
respective objects. This will make it easier to mirror the | ||
next migrations of the web3.js library. Both types are defined | ||
in method.py and property.py respectively. | ||
``` | ||
|
||
RequestManager | ||
Is supplied with one Provider at initialisation which | ||
can be replaced by calling setProvider(). It uses Jsonrpc | ||
to convert the methods into raw payloads and to validate | ||
responses attained with receive(). | ||
|
||
Has three other methods: | ||
|
||
- send(data, timeout=None) | ||
If timeout is None, send blocks until the result is | ||
available, which it then returns. | ||
|
||
If the timeout is 0, send returns immediately, only | ||
returning the id of the request, which can be used | ||
to poll with receive() later. | ||
|
||
If the timeout is greater than 0, it blocks until | ||
either the result is available or the timeout is | ||
reached, at which point a ValueError is thrown. | ||
send() makes use of the other two functions: | ||
|
||
- forward(data) | ||
Forwards the data to the provider and returns the | ||
request id. | ||
|
||
- receive(requestid, timeout=0) | ||
Implements the timeout functionality described in send. | ||
If timeout is 0, it returns None if the response was | ||
not available. | ||
Is supplied with one Provider at initialisation which | ||
can be replaced by calling setProvider(). It uses Jsonrpc | ||
to convert the methods into raw payloads and to validate | ||
responses attained with receive(). | ||
|
||
``` | ||
Has three other methods: | ||
- send(data, timeout=None) | ||
If timeout is None, send blocks until the result is | ||
available, which it then returns. | ||
If the timeout is 0, send returns immediately, only | ||
returning the id of the request, which can be used | ||
to poll with receive() later. | ||
If the timeout is greater than 0, it blocks until | ||
either the result is available or the timeout is | ||
reached, at which point a ValueError is thrown. | ||
send() makes use of the other two functions: | ||
- forward(data) | ||
Forwards the data to the provider and returns the | ||
request id. | ||
- receive(requestid, timeout=0) | ||
Implements the timeout functionality described in send. | ||
If timeout is 0, it returns None if the response was | ||
not available. | ||
``` | ||
|
||
Provider | ||
On initialisation, is started in a separate thread. | ||
Continuously fetches incoming requests from a queue | ||
and appends the responses to another queue. Providers | ||
only receives and returns "raw" requests, JSON validation | ||
and decoding happens in the Request Manager. | ||
|
||
As of now there are two implementations: | ||
- RPCProvider | ||
- IPCProvider | ||
On initialisation, is started in a separate thread. | ||
Continuously fetches incoming requests from a queue | ||
and appends the responses to another queue. Providers | ||
only receives and returns "raw" requests, JSON validation | ||
and decoding happens in the Request Manager. | ||
|
||
``` | ||
As of now there are two implementations: | ||
- RPCProvider | ||
- IPCProvider | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
# Contributing | ||
|
||
Thanks for the interest! See the [contributor documentation][contribute] | ||
to get started, and reach out on [Discord][discord] if you get stuck. | ||
to get started, and reach out on [Discord] if you get stuck. | ||
|
||
[contribute]: https://web3py.readthedocs.io/en/latest/contributing.html | ||
[discord]: https://discord.gg/GHryRvPB84 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,4 @@ | |
|
||
1. Install all of the package dependencies (TODO) | ||
|
||
2. Install `leveldb` (TODO) | ||
1. Install `leveldb` (TODO) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,6 @@ | |
width: auto; | ||
height: auto; | ||
padding: 0; | ||
border-radius: 0; | ||
border-radius: 0; | ||
margin: 12px 0 0 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -619,4 +619,4 @@ code.docutils.literal.notranslate { | |
} | ||
|
||
|
||
/* Literal.Number.Integer.Long */ | ||
/* Literal.Number.Integer.Long */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,4 +35,4 @@ document.addEventListener('DOMContentLoaded', function() { | |
toggleCssMode(this.checked); | ||
}) | ||
|
||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,4 +33,4 @@ | |
</dd> | ||
</dl> | ||
</div> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.