diff mercurial/utils/stringutil.py @ 52691:279e217d6041

typing: lock in the new type annotations detected with the pyupgrade changes After the changes culminating in 70a75d379daf, pytype was able to detect these types better (typically changing from something like `Generator[Any, Any, None]` to `Generator[bytes, Any, None]`). Let's make these explicit so they don't disappear because of other changes.
author Matt Harbison <matt_harbison@yahoo.com>
date Mon, 06 Jan 2025 20:02:17 -0500
parents e627cc25b6f3
children
line wrap: on
line diff
--- a/mercurial/utils/stringutil.py	Wed Jan 15 06:56:44 2025 +0100
+++ b/mercurial/utils/stringutil.py	Mon Jan 06 20:02:17 2025 -0500
@@ -17,6 +17,7 @@
 import typing
 
 from typing import (
+    Iterator,
     Optional,
     overload,
 )
@@ -72,7 +73,9 @@
     return b''.join(pprintgen(o, bprefix=bprefix, indent=indent, level=level))
 
 
-def pprintgen(o, bprefix: bool = False, indent: int = 0, level: int = 0):
+def pprintgen(
+    o, bprefix: bool = False, indent: int = 0, level: int = 0
+) -> Iterator[bytes]:
     """Pretty print an object to a generator of atoms.
 
     ``bprefix`` is a flag influencing whether bytestrings are preferred with