comparison mercurial/config.py @ 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 18c8c18993f0
children
comparison
equal deleted inserted replaced
51288:8b2ea2246a5f 51289:7bd7fcc711f2
6 # GNU General Public License version 2 or any later version. 6 # GNU General Public License version 2 or any later version.
7 7
8 8
9 import errno 9 import errno
10 import os 10 import os
11
12 from typing import (
13 List,
14 Tuple,
15 )
11 16
12 from .i18n import _ 17 from .i18n import _
13 from . import ( 18 from . import (
14 encoding, 19 encoding,
15 error, 20 error,
105 return result[2] 110 return result[2]
106 111
107 def sections(self): 112 def sections(self):
108 return sorted(self._data.keys()) 113 return sorted(self._data.keys())
109 114
110 def items(self, section): 115 def items(self, section: bytes) -> List[Tuple[bytes, bytes]]:
111 items = self._data.get(section, {}).items() 116 items = self._data.get(section, {}).items()
112 return [(k, v[0]) for (k, v) in items] 117 return [(k, v[0]) for (k, v) in items]
113 118
114 def set(self, section, item, value, source=b""): 119 def set(self, section, item, value, source=b""):
115 assert not isinstance( 120 assert not isinstance(