-
Notifications
You must be signed in to change notification settings - Fork 914
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add pre-commit configuration file, run
ruff-isort
(#634)
Continuing from #633, this PR adds support for the `pre-commit` via its configuration file, which works with https://pre-commit.ci. - I have suppressed all failing rules to get `pre-commit` passing in 68e3dda, so that we can fix them all later. - At most, the style changes in this PR are the imports that have been tidied up and sorted using the `ruff check . --select I --fix && ruff format .` command. - The pre-commit config configuration file was added Additionally, to automatically enable `pre-commit` as a Git hook locally, type: ```bash pip install pre-commit pre-commit install ``` and subsequently, it would not allow creating commits that fail the style rules we have set in `pyproject.toml` or those in `.pre-commit-config.yaml`.
- Loading branch information
1 parent
95ae714
commit f35fcca
Showing
97 changed files
with
332 additions
and
277 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
ci: | ||
autoupdate_commit_msg: "chore: update pre-commit hooks" | ||
autofix_commit_msg: "style: pre-commit fixes" | ||
|
||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.6.0 | ||
hooks: | ||
- id: check-added-large-files | ||
- id: check-case-conflict | ||
- id: check-merge-conflict | ||
- id: check-yaml | ||
exclude: conda_recipe/conda.yaml | ||
- id: debug-statements | ||
- id: end-of-file-fixer | ||
- id: mixed-line-ending | ||
- id: trailing-whitespace | ||
|
||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
rev: "v0.6.2" | ||
hooks: | ||
- id: ruff | ||
args: ["--fix", "--show-fixes"] | ||
- id: ruff-format | ||
|
||
- repo: https://github.com/pre-commit/pygrep-hooks | ||
rev: v1.10.0 | ||
hooks: | ||
- id: python-check-blanket-type-ignore | ||
exclude: ^src/vector/backends/_numba_object.py$ | ||
- id: rst-backticks | ||
- id: rst-directive-colons | ||
- id: rst-inline-touching-normal |
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,23 +1,24 @@ | ||
from autograd.core import primitive_with_deprecation_warnings as primitive | ||
|
||
from .builtins import dict, isinstance, list, tuple, type | ||
from .differential_operators import ( | ||
make_vjp, | ||
grad, | ||
multigrad_dict, | ||
checkpoint, | ||
deriv, | ||
elementwise_grad, | ||
value_and_grad, | ||
grad, | ||
grad_and_aux, | ||
grad_named, | ||
hessian, | ||
hessian_tensor_product, | ||
hessian_vector_product, | ||
hessian, | ||
holomorphic_grad, | ||
jacobian, | ||
tensor_jacobian_product, | ||
vector_jacobian_product, | ||
grad_named, | ||
checkpoint, | ||
make_ggnvp, | ||
make_hvp, | ||
make_jvp, | ||
make_ggnvp, | ||
deriv, | ||
holomorphic_grad, | ||
make_vjp, | ||
multigrad_dict, | ||
tensor_jacobian_product, | ||
value_and_grad, | ||
vector_jacobian_product, | ||
) | ||
from .builtins import isinstance, type, tuple, list, dict | ||
from autograd.core import primitive_with_deprecation_warnings as primitive |
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 |
---|---|---|
@@ -1,16 +1,16 @@ | ||
# Exposes API for extending autograd | ||
from .tracer import Box, primitive, register_notrace, notrace_primitive | ||
from .core import ( | ||
JVPNode, | ||
SparseObject, | ||
VSpace, | ||
vspace, | ||
VJPNode, | ||
JVPNode, | ||
defvjp_argnums, | ||
defvjp_argnum, | ||
defvjp, | ||
defjvp_argnums, | ||
defjvp_argnum, | ||
defjvp, | ||
VSpace, | ||
def_linear, | ||
defjvp, | ||
defjvp_argnum, | ||
defjvp_argnums, | ||
defvjp, | ||
defvjp_argnum, | ||
defvjp_argnums, | ||
vspace, | ||
) | ||
from .tracer import Box, notrace_primitive, primitive, register_notrace |
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,2 +1,2 @@ | ||
from .tracers import const_graph | ||
from .flatten import flatten | ||
from .tracers import const_graph |
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 |
---|---|---|
@@ -1,8 +1,2 @@ | ||
from . import fft, linalg, numpy_boxes, numpy_jvps, numpy_vjps, numpy_vspaces, random | ||
from .numpy_wrapper import * | ||
from . import numpy_boxes | ||
from . import numpy_vspaces | ||
from . import numpy_vjps | ||
from . import numpy_jvps | ||
from . import linalg | ||
from . import fft | ||
from . import random |
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
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import numpy.random as npr | ||
|
||
from .numpy_wrapper import wrap_namespace | ||
|
||
wrap_namespace(npr.__dict__, globals()) |
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import scipy.misc as osp_misc | ||
|
||
from ..scipy import special | ||
|
||
if hasattr(osp_misc, "logsumexp"): | ||
|
Oops, something went wrong.