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

Support PEP-604 style unions in decorator annotations #429

Merged
merged 1 commit into from
Dec 15, 2020

Conversation

benhgreen
Copy link
Contributor

@benhgreen benhgreen commented Dec 8, 2020

Summary

These unions were introduced in Python 3.10 and do not define __origin__,
so some extra checks are necessary to identify then. Since there is not
yet a 3.10 build, a somewhat hacky test was added to simulate one of
these new Unions.

Resolves #414.

Test Plan

Existing + new unittests. Also tested locally in an environment supporting new Unions.

@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 Dec 8, 2020
These unions were introduced in Python 3.10 and do not define __origin__,
so some extra checks are necessary to identify then. Since there is not
yet a 3.10 build, a somewhat hacky test was added to simulate one of
these new Unions.

Resolves Instagram#414.
@codecov-io
Copy link

codecov-io commented Dec 8, 2020

Codecov Report

Merging #429 (48d5872) into master (2f117f0) will increase coverage by 0.00%.
The diff coverage is 94.73%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #429   +/-   ##
=======================================
  Coverage   94.31%   94.31%           
=======================================
  Files         232      232           
  Lines       22606    22624   +18     
=======================================
+ Hits        21321    21338   +17     
- Misses       1285     1286    +1     
Impacted Files Coverage Δ
libcst/matchers/tests/test_decorators.py 99.78% <92.85%> (-0.22%) ⬇️
libcst/matchers/_visitors.py 97.03% <100.00%> (+0.05%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2f117f0...48d5872. Read the comment docs.

Copy link
Member

@zsol zsol left a comment

Choose a reason for hiding this comment

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

LGTM

@zsol zsol merged commit 88dd0c3 into Instagram:master Dec 15, 2020
@benhgreen benhgreen deleted the support-new-unions branch December 15, 2020 14:53
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.

make @m.leave() recognize function return using new Union syntax |
4 participants