Skip to content
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

Automated code fixes with type annotations check. #646

Merged
merged 1 commit into from
Oct 16, 2023
Merged

Automated code fixes with type annotations check. #646

merged 1 commit into from
Oct 16, 2023

Conversation

Andrei-Aksionov
Copy link
Collaborator

Hi there 👋

This PR was done with a slightly different ruff and black CLI command that includes type hints check and targets minimal supported version of Python - 3.8.

ruff check * --select E,W,F,S --extend-select C4,SIM,RET,PT,I001,ANN001,ANN201,ANN205,ANN206 --ignore E501,E731,S108,S101,S113,S603,PT007,S310,E402,PT004,C408 --per-file-ignores "*/**/__init__.py":I001,"tests/*":ANN --line-length 120 --target-version py38 --fix; black -l120 -C --preview --target-version py38 finetune scripts tests pretrain quantize lit_gpt notebooks chat generate eval

For ruff these rules are added:

  • ANN001: Missing type annotation for function argument.
  • ANN201: Missing return type annotation for public function.
  • ANN205: Missing return type annotation for staticmethod.
  • ANN206: Missing return type annotation for classmethod.

And these rules are skipped for the tests folder.

pandas # prepare_csv.py
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No new line at the end of the file.

@@ -25,7 +25,6 @@
XLAPrecisionPlugin,
)
from lightning.pytorch.utilities.rank_zero import rank_zero_only as trainer_rank_zero_only
from pytorch_lightning.plugins import PrecisionPlugin
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Imported but not used.

Copy link
Contributor

@carmocca carmocca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ty!

@carmocca carmocca merged commit 39adff8 into Lightning-AI:main Oct 16, 2023
5 checks passed
@Andrei-Aksionov Andrei-Aksionov deleted the automated_code_fixes branch October 16, 2023 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants