diff mercurial/pycompat.py @ 43773:7b14d649af1b

typing: consolidate "if not globals():" trick Removes redundant inline comments. I think pycompat is good place to host this kind of constants.
author Yuya Nishihara <yuya@tcha.org>
date Tue, 19 Nov 2019 23:49:05 +0900
parents fe73ec69350e
children 765a9c299c44
line wrap: on
line diff
--- a/mercurial/pycompat.py	Tue Nov 19 23:19:57 2019 +0900
+++ b/mercurial/pycompat.py	Tue Nov 19 23:49:05 2019 +0900
@@ -20,6 +20,12 @@
 
 ispy3 = sys.version_info[0] >= 3
 ispypy = '__pypy__' in sys.builtin_module_names
+TYPE_CHECKING = False
+
+if not globals():  # hide this from non-pytype users
+    import typing
+
+    TYPE_CHECKING = typing.TYPE_CHECKING
 
 if not ispy3:
     import cookielib