Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/encoding.py @ 43723:7f51bc36194d
typing: suppress error of py2 encoding.strtolocal() and .strfromlocal()
I don't know how to conditionally get rid of these py2/py3 overloads from
.pyi file. Instead, this patch makes pytype ignore the false-positives:
line 271, in strtolocal: bad option in return type [bad-return-type]
Expected: bytes
Actually returned: str
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 16 Nov 2019 16:09:39 +0900 |
parents | 83a349aaeba3 |
children | 009c115eba95 |
comparison
equal
deleted
inserted
replaced
43722:83a349aaeba3 | 43723:7f51bc36194d |
---|---|
266 strmethod = unimethod | 266 strmethod = unimethod |
267 else: | 267 else: |
268 | 268 |
269 def strtolocal(s): | 269 def strtolocal(s): |
270 # type: (str) -> bytes | 270 # type: (str) -> bytes |
271 return s | 271 return s # pytype: disable=bad-return-type |
272 | 272 |
273 def strfromlocal(s): | 273 def strfromlocal(s): |
274 # type: (bytes) -> str | 274 # type: (bytes) -> str |
275 return s | 275 return s # pytype: disable=bad-return-type |
276 | 276 |
277 strmethod = pycompat.identity | 277 strmethod = pycompat.identity |
278 | 278 |
279 if not _nativeenviron: | 279 if not _nativeenviron: |
280 # now encoding and helper functions are available, recreate the environ | 280 # now encoding and helper functions are available, recreate the environ |