Commit 2af6f0c7 authored by Matt Glazar's avatar Matt Glazar Committed by Facebook Github Bot

Fix flake8 with Python 2.7

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
parent 136979f1
......@@ -21,6 +21,12 @@ from .envfuncs import Env, add_path_entry, path_search
from .platform import HostType, is_windows
try:
import typing # noqa: F401
except ImportError:
pass
def containing_repo_type(path):
while True:
if os.path.exists(os.path.join(path, ".git")):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment