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

Refactor: misc best practices #70

Merged
merged 9 commits into from
Sep 10, 2024
Merged

Conversation

sbrugman
Copy link
Collaborator

@sbrugman sbrugman commented Sep 2, 2024

Split each refactor per commit for easier review:

  • Removed unused parentheses
  • Added missing super().init() calls
  • Export visitors for more concise imports
  • Removed dead code (unused assignments)
  • Instead of suppressing type checking, provided type hints to mypy via assert where possible
  • Used unpacking instead of concatenation for tuples
  • Simplified the control flow where possible (reducing nested blocks etc.)
  • args.path is already a required argument and validated by argparse, removed not args.path which is never reached

I'll rebase/group the commits and fix test when the other PRs are merged. I've got more functional changes lined up, but will hold off until you've had time to review/merge the outstanding PRs to avoid conflicts.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Sep 2, 2024
@kit1980
Copy link
Contributor

kit1980 commented Sep 2, 2024

Let's not reformat test fixtures. They are not always even correct Python.

@sbrugman
Copy link
Collaborator Author

sbrugman commented Sep 3, 2024

@kit1980 I'll remove the formatting of test cases from: #69 and update this PR accordingly. Indeed the test fixtures are valid Python syntax, but not always functioning (e.g. missing required arguments)

@sbrugman sbrugman force-pushed the refactor branch 3 times, most recently from b369365 to 9a084f1 Compare September 3, 2024 07:49
@sbrugman sbrugman marked this pull request as ready for review September 3, 2024 07:57
@sbrugman
Copy link
Collaborator Author

sbrugman commented Sep 3, 2024

None of the proposed changes in this PR touch the test suite. I've separated them from the other PRs, so can be reviewed independently. All fairly minor if you see the changes in isolation (per commit).

@kit1980
Copy link
Contributor

kit1980 commented Sep 10, 2024

Thanks!

@sbrugman
Copy link
Collaborator Author

sbrugman commented Sep 10, 2024

@kit1980 could we please enable "Rebase and merge" in the settings? Squash is a good default, but in this case the commits are atomic, and it is helpful to keep them in case one type of changes need to be reverted/blamed (e.g. mypy). Both keep linear history.

@kit1980
Copy link
Contributor

kit1980 commented Sep 10, 2024

could we please enable "Rebase and merge" in the settings

done

@sbrugman
Copy link
Collaborator Author

Thanks!

@sbrugman sbrugman merged commit 7855ac1 into pytorch-labs:main Sep 10, 2024
2 checks passed
@sbrugman sbrugman deleted the refactor branch September 10, 2024 22:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants