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

Parse Quoted annotations as if parenthesized #15387

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Glyphack
Copy link
Contributor

@Glyphack Glyphack commented Jan 9, 2025

Summary

Resolves #9467

Parse quoted annotations as if the string content is inside parenthesis.
With this logic x and y in this example are equal:

y: """
   int |
   str
"""

z: """(
    int |
    str
)
"""

This PR is based on the comments on the issue.

I did one extra change, since we don't want any indentation tokens I am setting the State::Other as the initial state of the Lexer.

Test Plan

Added a test which previously failed because quoted annotation contained indentation.

TODO: Add more tests

@Glyphack Glyphack force-pushed the stringized-annotations branch from b33cf05 to efbd25e Compare January 9, 2025 23:43
Copy link
Contributor

github-actions bot commented Jan 9, 2025

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

Formatter (stable)

ℹ️ ecosystem check encountered format errors. (no format changes; 1 project error)

openai/openai-cookbook (error)

warning: Detected debug build without --no-cache.
error: Failed to read examples/Assistants_API_overview_python.ipynb: Expected a Jupyter Notebook, which must be internally stored as JSON, but this file isn't valid JSON: expected `,` or `]` at line 197 column 8

Formatter (preview)

ℹ️ ecosystem check encountered format errors. (no format changes; 1 project error)

openai/openai-cookbook (error)

ruff format --preview

warning: Detected debug build without --no-cache.
error: Failed to read examples/Assistants_API_overview_python.ipynb: Expected a Jupyter Notebook, which must be internally stored as JSON, but this file isn't valid JSON: expected `,` or `]` at line 197 column 8

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.

Quoted annotations should be parsed as if parenthesized
1 participant