typing: add a few trivial type hints to `mercurial/templater.py`
Since hg
3dbc7b1ecaba, pytype started inferring that the second value in the
tuple is `BinaryIO`, but still hasn't been able to figure out the rest of
`open_template()`. We can be more precise.
typing: add a few type hints to `mercurial/revlog.py`
Somewhere between hg
3dbc7b1ecaba and hg
8e3f6b5bf720, pytype stopped being able
to infer the type for `_docket_file` and `compress()`. Lock those types in
before they get lost.
typing: add a trivial type hint to `mercurial/posix.py` to avoid an @overload
Since hg
3dbc7b1ecaba, pytype added an `@overload` for this function, without a
type on the parameter. That's wrong, and undermines the hints on the
non-trivial functions.
typing: add some trivial type hints to `mercurial/match.py`
These were new methods since hg
3dbc7b1ecaba, but surprisingly pytype couldn't
figure them out.
typing: add a type hint to `mercurial/hg.py`
Somewhere between hg
3dbc7b1ecaba and hg
8e3f6b5bf720, the first value of the
tuple changed from bytes to str. Let's lock this in, so that pytype flags it
if someone mistakenly adds a tuple with bytes somewhere.
typing: restore `encoding.encoding` and `encoding.encodingmode` to bytes
Somewhere between hg
3dbc7b1ecaba and hg
8e3f6b5bf720, pytype determined the
signature of these fields changed from `bytes` to `Any`. Not sure why- the type
of `environ` then and now is: `Union[WindowsEnviron, Dict[bytes, bytes], os._Environ[bytes]]`
That said, PyCharm wasn't able to figure out the type of `environ`, and the
`WindowsEnviron` class extends `MutableMapping` without specifying bytes for the
key and value types in py3.9. But that's not changed in my setup, so I can't
explain it.