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

Handle type validation for string type hints #333

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Commits on Aug 16, 2022

  1. Handle type validation for string type hints (facebook#333)

    Summary:
    With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.
    
    The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime
    
    - [x] Added tests, if you've added code that should be tested
    - [x] Ensured the test suite passes
    - [x] Made sure your code lints
    - [x] Completed the Contributor License Agreement ("CLA")
    
    Pull Request resolved: facebook#333
    
    Test Plan:
    Imported from GitHub, without a `Test Plan:` line.
    
    New unit tests were added to check that function parameters and return types were being interpreted correctly when annotated as a string (which is the case with from __future__ import annotations)
    
    Reviewed By: deathowl
    
    Differential Revision: D35778959
    
    Pulled By: williamlw999-fb
    
    fbshipit-source-id: 20ad9fbbb22c8189a9ba650729b99f5c59a24a16
    williamlw999-fb authored and facebook-github-bot committed Aug 16, 2022
    Configuration menu
    Copy the full SHA
    f9cadc0 View commit details
    Browse the repository at this point in the history

Commits on Apr 6, 2023

  1. Configuration menu
    Copy the full SHA
    d9d4d52 View commit details
    Browse the repository at this point in the history