comparison mercurial/manifest.py @ 51760:2f88df88f5b9

manifest: type and fix unhexlify Some part of that function seems to date back from Python 2. It raise question about whether this function is useful or not, but let us just fix it for now. This was caught by pytype.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sun, 04 Aug 2024 10:47:29 +0200
parents 421c9b3f2f4e
children 50b3ff0ec297
comparison
equal deleted inserted replaced
51759:81be242a1b5c 51760:2f88df88f5b9
141 return (data[pos:zeropos], hashval, flags) 141 return (data[pos:zeropos], hashval, flags)
142 142
143 __next__ = next 143 __next__ = next
144 144
145 145
146 def unhexlify(data, extra, pos, length): 146 def unhexlify(data: bytes, extra: int, pos, length: int):
147 s = bin(data[pos : pos + length]) 147 s = bin(data[pos : pos + length])
148 if extra: 148 if extra:
149 s += chr(extra & 0xFF) 149 s += bytes([extra & 0xFF])
150 return s 150 return s
151 151
152 152
153 def _cmp(a, b): 153 def _cmp(a, b):
154 return (a > b) - (a < b) 154 return (a > b) - (a < b)