Patchwork D7381: cmdutil: add a pytype annotation to help out some callsites

login
register
mail settings
Submitter phabricator
Date Nov. 19, 2019, 3:51 a.m.
Message ID <980a5e57d0e2cc84fe59eb9fa6800502@localhost.localdomain>
Download mbox | patch
Permalink /patch/43346/
State Not Applicable
Headers show

Comments

phabricator - Nov. 19, 2019, 3:51 a.m.
Closed by commit rHGa58d2361b231: cmdutil: add a pytype annotation to help out some callsites (authored by durin42).
durin42 marked an inline comment as done.
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7381?vs=18097&id=18223

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7381/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7381

AFFECTED FILES
  mercurial/cmdutil.py

CHANGE DETAILS




To: durin42, #hg-reviewers, dlax, indygreg
Cc: dlax, mercurial-devel

Patch

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -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()