Matt Harbison <matt_harbison@yahoo.com> [Fri, 16 Dec 2022 22:07:02 -0500] rev 49817
typing: add trivial type hints to rest of the windows platform module
Skipping the file wrappers for now because there's interplay with C code, and
making them subclass `typing.BinaryIO_Proxy` confuses PyCharm a bit.
Matt Harbison <matt_harbison@yahoo.com> [Fri, 16 Dec 2022 18:27:15 -0500] rev 49816
typing: add type hints to the rest of the posix module
These methods either don't have an analog in the windows module, or are aliased
in the windows module from something else (like os.path.xxx).
Matt Harbison <matt_harbison@yahoo.com> [Fri, 16 Dec 2022 18:14:54 -0500] rev 49815
typing: add type hints to the platform `cachestat` classes
Matt Harbison <matt_harbison@yahoo.com> [Fri, 16 Dec 2022 14:24:02 -0500] rev 49814
util: fix the signature of observedbufferedinputpipe._fillbuffer()
Flagged by PyCharm, since it didn't match the signature of the method being
overridden. The default value in the superclass is also `_chunksize`, and I
suspect that the amount read from `osread` should be limited to what is passed
in. Only one caller (`bufferedinputpipe.unbufferedread()`) passes this
argument, and it passes the max of `_chunksize` and whatever it was passed.
Matt Harbison <matt_harbison@yahoo.com> [Fri, 16 Dec 2022 14:15:09 -0500] rev 49813
tests: drop some obsolete py2 handling in util.py doctest
Flagged by PyCharm while inspecting imports from the platform modules.
Matt Harbison <matt_harbison@yahoo.com> [Fri, 16 Dec 2022 00:54:39 -0500] rev 49812
typing: add type hints to the common posix/windows platform functions
These are done in sync because some platforms have empty implementations, and it
isn't obvious what the types should be without examining the other. We want the
types aligned, so @overload definitions that differ aren't generated. The only
differences here are the few methods that unconditionally raise an error are
marked as `NoReturn`, which doesn't seem to bother pytype.
A couple of the posix module functions needed to be updated with a modern
ternary operator, because pytype seems to want to use the type of the second
object in the old `return x and y` style.
Matt Harbison <matt_harbison@yahoo.com> [Thu, 15 Dec 2022 21:13:11 -0500] rev 49811
typing: add type hints to the posix platform module matching win32.py
Matt Harbison <matt_harbison@yahoo.com> [Thu, 15 Dec 2022 18:02:55 -0500] rev 49810
typing: add type hints to mercurial/win32.py
These are the low level functions that are imported by the mercurial.windows
module, which is in turn imported by mercurial.utils as the platform module.
Pretty straightforward, but pytype inferred very little of it, likely because of
the heavy ctypes usage. It also seems to trigger a pytype bug in procutil, now
that it has an idea of the underlying function type, so disable that warning to
maintain a working test.