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

Flatten syntactically nested Union or Literal instances #40

Merged
merged 8 commits into from
May 12, 2022

Conversation

Cheukting
Copy link
Contributor

See #22 for the details. Added 2 codemods function and tests to tackle cases like:

Union[int, Optional[str], bool] # Union[int, str, bool, None] and
Literal[1, 2] | None # Literal[1, 2, None]

Copy link
Owner

@Zac-HD Zac-HD left a comment

Choose a reason for hiding this comment

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

🚀

src/shed/_codemods.py Outdated Show resolved Hide resolved
src/shed/_codemods.py Outdated Show resolved Hide resolved
src/shed/_codemods.py Outdated Show resolved Hide resolved
src/shed/_codemods.py Outdated Show resolved Hide resolved
tests/recorded/flatten_union.txt Show resolved Hide resolved
tests/recorded/flatten_literal.txt Show resolved Hide resolved
@Cheukting
Copy link
Contributor Author

Thanks for the review @Zac-HD I have refactor as suggested and added the tests

Copy link
Owner

@Zac-HD Zac-HD left a comment

Choose a reason for hiding this comment

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

Super close!

src/shed/_codemods.py Outdated Show resolved Hide resolved
src/shed/_codemods.py Outdated Show resolved Hide resolved
Copy link
Owner

@Zac-HD Zac-HD left a comment

Choose a reason for hiding this comment

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

🎉

Thanks again Cheuk!

@Zac-HD Zac-HD merged commit 0999644 into Zac-HD:master May 12, 2022
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