Mercurial > public > mercurial-scm > hg
diff mercurial/cffi/mpatch.py @ 49599:94a797032fc4
typing: add type hints to mpatch implementations
Again, using `merge-pyi` to apply the stubs in cext and then manually type the
private methods. The generated stub without these hints inferred very little,
and the stuff it did was wrong.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Tue, 08 Nov 2022 14:17:56 -0500 |
parents | 6000f5b25c9b |
children | ecc3a893979d |
line wrap: on
line diff
--- a/mercurial/cffi/mpatch.py Tue Nov 08 13:59:16 2022 -0500 +++ b/mercurial/cffi/mpatch.py Tue Nov 08 14:17:56 2022 -0500 @@ -6,6 +6,8 @@ # GNU General Public License version 2 or any later version. +from typing import List + from ..pure.mpatch import * from ..pure.mpatch import mpatchError # silence pyflakes from . import _mpatch # pytype: disable=import-error @@ -26,7 +28,7 @@ return container[0] -def patches(text, bins): +def patches(text: bytes, bins: List[bytes]) -> bytes: lgt = len(bins) all = [] if not lgt: