# HG changeset patch # User Matt Harbison # Date 2021-07-21 19:34:35 # Node ID 76dccbbe73fd3800372bfa7fa1fe8cf1abca5e50 # Parent f48a688a7044a10c8eb1eabe8e8987b4698eadec typing: convert an annotation to an assertion in commands.py Pytype was happy with the annotation at one point, but 2021.04.15 now complains. Differential Revision: https://phab.mercurial-scm.org/D11206 diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -75,12 +75,6 @@ from .utils import ( urlutil, ) -if pycompat.TYPE_CHECKING: - from typing import ( - List, - ) - - table = {} table.update(debugcommandsmod.command._table) @@ -3341,7 +3335,8 @@ def _dograft(ui, repo, *revs, **opts): ) # checking that newnodes exist because old state files won't have it elif statedata.get(b'newnodes') is not None: - nn = statedata[b'newnodes'] # type: List[bytes] + nn = statedata[b'newnodes'] + assert isinstance(nn, list) # list of bytes nn.append(node) # remove state when we complete successfully