Patchwork D7383: state: add a pytype annotation

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

Comments

phabricator - Nov. 19, 2019, 3:50 a.m.
Closed by commit rHG127d46468a45: state: add a pytype annotation (authored by durin42).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7383?vs=18070&id=18225

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

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

AFFECTED FILES
  mercurial/state.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/state.py b/mercurial/state.py
--- a/mercurial/state.py
+++ b/mercurial/state.py
@@ -27,6 +27,15 @@ 
 )
 from .utils import cborutil
 
+if not globals():
+    from typing import (
+        Any,
+        Dict,
+    )
+
+    for t in (Any, Dict):
+        assert t
+
 
 class cmdstate(object):
     """a wrapper class to store the state of commands like `rebase`, `graft`,
@@ -50,6 +59,7 @@ 
         self.fname = fname
 
     def read(self):
+        # type: () -> Dict[bytes, Any]
         """read the existing state file and return a dict of data stored"""
         return self._read()