comparison mercurial/encoding.py @ 43469:5f2a8dabb0d8

encoding: define local identify functions with explicit type comments This removes some obfuscation as far as pytype is concerned and corrects many bogus type errors. Differential Revision: https://phab.mercurial-scm.org/D7267
author Augie Fackler <augie@google.com>
date Wed, 06 Nov 2019 15:13:23 -0500
parents c59eb1560c44
children 2ade00f3b03b
comparison
equal deleted inserted replaced
43468:8b0fa4de0064 43469:5f2a8dabb0d8
239 if pycompat.ispy3: 239 if pycompat.ispy3:
240 strtolocal = unitolocal 240 strtolocal = unitolocal
241 strfromlocal = unifromlocal 241 strfromlocal = unifromlocal
242 strmethod = unimethod 242 strmethod = unimethod
243 else: 243 else:
244 strtolocal = pycompat.identity 244
245 strfromlocal = pycompat.identity 245 def strtolocal(s):
246 # type: (str) -> bytes
247 return s
248
249 def strfromlocal(s):
250 # type: (bytes) -> str
251 return s
252
246 strmethod = pycompat.identity 253 strmethod = pycompat.identity
247 254
248 if not _nativeenviron: 255 if not _nativeenviron:
249 # now encoding and helper functions are available, recreate the environ 256 # now encoding and helper functions are available, recreate the environ
250 # dict to be exported to other modules 257 # dict to be exported to other modules