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 string annotations for type aliases #401

Merged
merged 1 commit into from
Oct 12, 2020

Conversation

Kronuz
Copy link
Contributor

@Kronuz Kronuz commented Oct 9, 2020

Summary

Add support for string annotations in type aliases.

Test Plan

Run tests.

This will support things like:

from typing import Dict, Union
from video import VideoType
VideoDict = Dict[str, Union[str, int, "VideoType"]]

And get a properly referenced VideoType.

@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 Oct 9, 2020
Copy link
Contributor

@jimmylai jimmylai left a comment

Choose a reason for hiding this comment

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

Other than the formatting error. LGTM.
The error can be fixed by running tox -e autofix.

@Kronuz Kronuz force-pushed the Kronuz-annotation-aliases branch 2 times, most recently from 256d054 to 1083e5d Compare October 12, 2020 16:56
@codecov-io
Copy link

Codecov Report

Merging #401 into master will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #401   +/-   ##
=======================================
  Coverage   94.11%   94.11%           
=======================================
  Files         231      231           
  Lines       22410    22427   +17     
=======================================
+ Hits        21091    21108   +17     
  Misses       1319     1319           
Impacted Files Coverage Δ
libcst/_parser/types/tests/test_config.py 100.00% <ø> (ø)
libcst/tests/test_type_enforce.py 96.66% <ø> (ø)
libcst/metadata/scope_provider.py 97.03% <100.00%> (+0.04%) ⬆️
libcst/metadata/tests/test_scope_provider.py 100.00% <100.00%> (ø)

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 6731aa5...b6e6a1b. Read the comment docs.

@Kronuz Kronuz merged commit 21d37b9 into master Oct 12, 2020
@Kronuz Kronuz mentioned this pull request Oct 12, 2020
@lpetre lpetre deleted the Kronuz-annotation-aliases branch November 19, 2021 12:21
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.

4 participants