]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-104050: Argument Clinic: Annotate the BufferSeries class (#106935)
authorErlend E. Aasland <erlend@python.org>
Sat, 22 Jul 2023 10:46:42 +0000 (12:46 +0200)
committerGitHub <noreply@github.com>
Sat, 22 Jul 2023 10:46:42 +0000 (12:46 +0200)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Tools/clinic/clinic.py

index 8acf513a6c1fc69639d28aab54939664bb67e682..7a4c9c4cacf55b2faab039689ac9439fbd511c6d 100755 (executable)
@@ -1965,12 +1965,12 @@ class BufferSeries:
     e.g. o[-1] is an element immediately preceding o[0].
     """
 
-    def __init__(self):
+    def __init__(self) -> None:
         self._start = 0
-        self._array = []
+        self._array: list[_TextAccumulator] = []
         self._constructor = _text_accumulator
 
-    def __getitem__(self, i):
+    def __getitem__(self, i: int) -> _TextAccumulator:
         i -= self._start
         if i < 0:
             self._start += i
@@ -1981,11 +1981,11 @@ class BufferSeries:
             self._array.append(self._constructor())
         return self._array[i]
 
-    def clear(self):
+    def clear(self) -> None:
         for ta in self._array:
             ta.text.clear()
 
-    def dump(self):
+    def dump(self) -> str:
         texts = [ta.output() for ta in self._array]
         return "".join(texts)