# HG changeset patch # User Pierre-Yves David # Date 2023-12-20 15:39:03 # Node ID 7bd7fcc711f299bf3d69bb2fee3fcc03b14707be # Parent 8b2ea2246a5f790da4ccbdfb56f3e3b5bde53625 pytype: drop the last inline type comment We can't assign type to the "for" variant on the fly, so we type the variable and method used instead. diff --git a/mercurial/config.py b/mercurial/config.py --- a/mercurial/config.py +++ b/mercurial/config.py @@ -9,6 +9,11 @@ import errno import os +from typing import ( + List, + Tuple, +) + from .i18n import _ from . import ( encoding, @@ -107,7 +112,7 @@ class config: def sections(self): return sorted(self._data.keys()) - def items(self, section): + def items(self, section: bytes) -> List[Tuple[bytes, bytes]]: items = self._data.get(section, {}).items() return [(k, v[0]) for (k, v) in items] diff --git a/mercurial/subrepoutil.py b/mercurial/subrepoutil.py --- a/mercurial/subrepoutil.py +++ b/mercurial/subrepoutil.py @@ -74,7 +74,7 @@ def state(ctx: "context.changectx", ui: to tuple: (source from .hgsub, revision from .hgsubstate, kind (key in types dict)) """ - p = config.config() + p: config.config = config.config() repo = ctx.repo() def read(f, sections=None, remap=None): @@ -143,7 +143,7 @@ def state(ctx: "context.changectx", ui: return src state = {} - for path, src in p.items(b''): # type: bytes + for path, src in p.items(b''): kind = b'hg' if src.startswith(b'['): if b']' not in src: