Fri, 19 Jul 2024 16:49:46 -0400 typing: explicitly type some `mercurial.util` eol code to avoid @overload
Matt Harbison <matt_harbison@yahoo.com> [Fri, 19 Jul 2024 16:49:46 -0400] rev 51721
typing: explicitly type some `mercurial.util` eol code to avoid @overload Unlike the previous commit, this makes a material difference in the generated stub file- the `pycompat.identity()` aliases generated an @overload like this: @overload def fromnativeeol(a: _T0) -> _T0: ... ... which might fail to detect a bad argument, like str. This drops the @overload for the 3 related methods, so there's a single definition for each. The `typelib.BinaryIO_Proxy` is used for subclassing (the same as was done in 8147abc05794), so that it is a `BinaryIO` type during type checking, but still inherits `object` at runtime. That way, we don't need to implement unused abstract methods.
Fri, 19 Jul 2024 16:38:53 -0400 typing: avoid some useless @overload definitions in `mercurial.util`
Matt Harbison <matt_harbison@yahoo.com> [Fri, 19 Jul 2024 16:38:53 -0400] rev 51720
typing: avoid some useless @overload definitions in `mercurial.util` Apparently pytype considered the name as well as the type of each argument, and generates @overload definitions if they don't match. At best this is clutter, and can easily be removed.
Thu, 18 Jul 2024 22:46:36 -0400 dirstate: stringify a few exception messages
Matt Harbison <matt_harbison@yahoo.com> [Thu, 18 Jul 2024 22:46:36 -0400] rev 51719
dirstate: stringify a few exception messages Built in exceptions want str, and ProgrammingError converts bytes to str internally (because it subclasses RuntimeError).
Thu, 18 Jul 2024 20:34:35 -0400 typing: add type hints to `mercurial.verify._normpath()`
Matt Harbison <matt_harbison@yahoo.com> [Thu, 18 Jul 2024 20:34:35 -0400] rev 51718
typing: add type hints to `mercurial.verify._normpath()` Since 10db46e128d4, pytype almost figured this out, going from `Any` -> `_T0`, but the intent is obvious.
Thu, 18 Jul 2024 20:16:31 -0400 typing: add type hints to `i18n._msgcache`
Matt Harbison <matt_harbison@yahoo.com> [Thu, 18 Jul 2024 20:16:31 -0400] rev 51717
typing: add type hints to `i18n._msgcache` Since 10db46e128d4, pytype stopped inferring that the key is bytes.
Thu, 18 Jul 2024 19:57:42 -0400 typing: add type hints to `mercurial.dirstatemap`
Matt Harbison <matt_harbison@yahoo.com> [Thu, 18 Jul 2024 19:57:42 -0400] rev 51716
typing: add type hints to `mercurial.dirstatemap` Somewhere since 10db46e128d4, pytype stopped being able to infer the type of the `identity` field. Fill in some obvious other hints along the way. These hints caused pytype to flag a missing attribute: File "/mnt/c/Users/Matt/hg/mercurial/dirstatemap.py", line 714, in _v1_map: No attribute 'stat' on mercurial.windows.cachestat [attribute-error] In Union[Any, mercurial.posix.cachestat, mercurial.windows.cachestat] File "/mnt/c/Users/Matt/hg/mercurial/dirstatemap.py", line 715, in _v1_map: No attribute 'stat' on mercurial.windows.cachestat [attribute-error] In Union[Any, mercurial.posix.cachestat, mercurial.windows.cachestat] In practice, the `identity` field is NOT replaced with None if it isn't cacheable, so it's probably safer to just add the field and set it to None, since that check is already in place on line 715.
Thu, 18 Jul 2024 19:55:51 -0400 typing: add type hints to `cmdutil.findrepo()`
Matt Harbison <matt_harbison@yahoo.com> [Thu, 18 Jul 2024 19:55:51 -0400] rev 51715
typing: add type hints to `cmdutil.findrepo()` Since 10db46e128d4, pytype almost figured this out, going from `Any` -> `_T0`, but the intent is obvious.
(0) -30000 -10000 -3000 -1000 -300 -100 -30 -10 -7 +7 +10 +30 +100 tip