-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Add ruff pre-commit hook and apply it
#3424
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
Conversation
ebd7c8b to
4506e0d
Compare
|
I added |
|
Lmk if / when we'd like to merge and I can resolve the merge conflicts. |
| past_key_value: Optional[Tuple[torch.Tensor]] = None, | ||
| output_attentions: bool = False, | ||
| use_cache: bool = False, | ||
| padding_mask: Optional[torch.LongTensor] = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fine by me. this is pythonic but
@danielhanchen to validate if ok for him in terms of alignment of key:value pairs vs original . I doubt this can be automated though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh the spacings? Was gonna ask it, but it's fine for now
|
LGTM @danielhanchen to confirm:
|
|
@djsaunde LGTM! :) I like the extra spacings as well! |
f5647d0 to
0d806da
Compare
|
@danielhanchen I fixed the merge conflicts, can you merge if this is all set? |
|
@djsaunde I'm rebasing this to nightly - can you fix merge conflicts thanks |
|
@danielhanchen all set. |
This PR adds the
ruff(checkandformat) pre-commit hook in order to get this codebase closer to PEP 8 compliance. It also adds a GitHub action that runs on PRs / pushes to main that runs the pre-commit hooks.This ensures any PRs that are incoming have code that is formatted properly, so we don't have to have code style discussion as part of PR review.
Note that the only "manual" changes are (1) adding the pre-commit hooks / configuration, and (2) adding the GitHub action to run the hooks; the rest of the changes come from applying the ruff pre-commit hook.
Some more complicated error codes are ignored and can be handled in future PRs.