changeset 51289:7bd7fcc711f2

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.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 20 Dec 2023 16:39:03 +0100
parents 8b2ea2246a5f
children f4a0806081f2
files mercurial/config.py mercurial/subrepoutil.py
diffstat 2 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/config.py	Wed Dec 20 11:23:09 2023 +0100
+++ b/mercurial/config.py	Wed Dec 20 16:39:03 2023 +0100
@@ -9,6 +9,11 @@
 import errno
 import os
 
+from typing import (
+    List,
+    Tuple,
+)
+
 from .i18n import _
 from . import (
     encoding,
@@ -107,7 +112,7 @@
     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]
 
--- a/mercurial/subrepoutil.py	Wed Dec 20 11:23:09 2023 +0100
+++ b/mercurial/subrepoutil.py	Wed Dec 20 16:39:03 2023 +0100
@@ -74,7 +74,7 @@
     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 @@
         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: