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

Separate grouped and ungrouped nodes more clearly in AST generator #15646

Merged
merged 1 commit into from
Jan 21, 2025

Conversation

dcreager
Copy link
Member

This is a minor cleanup to the AST generation script to make a clearer separation between nodes that do appear in a group enum, and those that don't. There are some types and methods that we create for every syntax node, and others that refer to the group that the syntax node belongs to, and which therefore don't make sense for ungrouped nodes. This new separation makes it clearer which category each definition is in, since you're either inside of a for group in ast.groups loop, or a for node in ast.all_nodes loop.

This is a minor cleanup to the AST generation script to make a clearer
separation between nodes that do appear in a group enum, and those that
don't.  There are some types and methods that we create for every
syntax node, and others that refer to the group that the syntax node
belongs to, and which therefore don't make sense for ungrouped nodes.
This new separation makes it clearer which category each definition is
in, since you're either inside of a `for group in ast.groups` loop, or a
`for node in ast.all_nodes` loop.
Copy link
Member Author

Choose a reason for hiding this comment

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

There are changes in this file because a few definitions moved around, but their content did not change

Copy link
Contributor

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

Formatter (stable)

✅ ecosystem check detected no format changes.

Formatter (preview)

✅ ecosystem check detected no format changes.

@MichaReiser MichaReiser added the internal An internal refactor or improvement label Jan 21, 2025
@dcreager dcreager merged commit fa546b2 into main Jan 21, 2025
21 checks passed
@dcreager dcreager deleted the dcreager/grouped-nodes branch January 21, 2025 18:37
dcreager added a commit that referenced this pull request Jan 21, 2025
* main:
  Separate grouped and ungrouped nodes more clearly in AST generator (#15646)
  [`flake8-simplify`] Mark fixes as unsafe (`SIM201`, `SIM202`) (#15626)
  [red-knot] mdtest runner: include stderr for crashing tests (#15644)
  Change `EnvironmentOptions::venv-path` to `Option<SystemPathBuf>` (#15631)
  [`flake8-type-checking`] Fix some safe fixes being labeled unsafe (#15638)
  feat: Update RUF055 to do var == value (#15605)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal An internal refactor or improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants