• Matt Glazar's avatar
    Fix flake8 with Python 2.7 · 2af6f0c7
    Matt Glazar authored
    Summary:
    flake8 (in Python 2.7 mode) complains that `typing` is mentioned in type annotations but is not defined:
    
    ```
    fbcode_builder/getdeps/buildopts.py:251:21: F821 undefined name 'typing'
        subst_mapping,  # type: typing.Mapping[str, str]
                        ^
    fbcode_builder/getdeps/buildopts.py:253:5: F821 undefined name 'typing'
        # type: (...) -> typing.Optional[str]
        ^
    2     F821 undefined name 'typing'
    2
    ```
    
    Import `typing` explicitly to silence this warning.
    
    Because `typing` may be unavailable, import it conditionally. (Because it's only referenced in comments, failing to import `typing` should have no effect at run time.)
    
    Reviewed By: snarkmaster
    
    Differential Revision: D16435696
    
    fbshipit-source-id: 78a4a7b07acc46aa998f02b54b1a6e52c1daafde
    2af6f0c7
buildopts.py 13.8 KB