mirror of
https://github.com/facebook/proxygen.git
synced 2025-08-08 18:02:05 +03:00
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
This commit is contained in:
committed by
Facebook Github Bot
parent
ee28489283
commit
d68c526f65
@@ -21,6 +21,12 @@ from .envfuncs import Env, add_path_entry, path_search
|
|||||||
from .platform import HostType, is_windows
|
from .platform import HostType, is_windows
|
||||||
|
|
||||||
|
|
||||||
|
try:
|
||||||
|
import typing # noqa: F401
|
||||||
|
except ImportError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
def containing_repo_type(path):
|
def containing_repo_type(path):
|
||||||
while True:
|
while True:
|
||||||
if os.path.exists(os.path.join(path, ".git")):
|
if os.path.exists(os.path.join(path, ".git")):
|
||||||
|
Reference in New Issue
Block a user