changeset 43700:a58d2361b231

cmdutil: add a pytype annotation to help out some callsites I think we could constrain the values here more than Any, but this lets us move forward with typechecking commands.py. Differential Revision: https://phab.mercurial-scm.org/D7381
author Augie Fackler <augie@google.com>
date Wed, 13 Nov 2019 22:21:38 -0500
parents 21e05aabef8c
children c9301ac73b95
files mercurial/cmdutil.py
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Tue Nov 12 17:47:42 2019 -0500
+++ b/mercurial/cmdutil.py	Wed Nov 13 22:21:38 2019 -0500
@@ -61,6 +61,15 @@
     stringutil,
 )
 
+if not globals():
+    from typing import (
+        Any,
+        Dict,
+    )
+
+    for t in (Any, Dict):
+        assert t
+
 stringio = util.stringio
 
 # templates of common command options
@@ -3959,6 +3968,7 @@
 
 
 def readgraftstate(repo, graftstate):
+    # type: (Any, statemod.cmdstate) -> Dict[bytes, Any]
     """read the graft state file and return a dict of the data stored in it"""
     try:
         return graftstate.read()