-
Notifications
You must be signed in to change notification settings - Fork 1.8k
change linting to use pre-commit #3297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
bee27ca
change linting to use pre-commit, change releases.rst to release_note…
pacrob 5ab0faf
run check-yaml, check-toml, end-of-file-fixer, and trailing-whitespace
pacrob 7679cf1
run pyupgrade
pacrob e0ea959
run black
pacrob 2612850
run flake8 and autoflake and fix errors
pacrob 5643f39
run isort
pacrob 1502415
run pydocstyle and fix errors
pacrob 8bf7bdd
run mdformat
pacrob 4e773af
run mypy and fix unused-ignore errors
pacrob ac9cd58
Ignore mypy disallow_subclassing_any and warn_return_any errors, clea…
pacrob 99d4c8b
run blocklint and clear errors
pacrob c00196a
clear unused casts, clear B008 ignore where possible
pacrob 341d9c2
re-run lint after rebasing to main
pacrob b4c0268
add pydantic types to mypy checking, turn on no-subclassing-any mypy …
pacrob 2bd2755
clear B008 errors in HTTPProvider and AsyncHTTPProvider
pacrob File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.