> strtolocal = pycompat.identity # type: (str) -> bytes > strfromlocal = pycompat.identity # type: (bytes) -> str `# type: Callable[[str], bytes]` might work. pytype complained `# type: ... -> ...` is an invalid type comment.