[Python-checkins] gh-104050: Argument Clinic: Annotate the BufferSeries class (#106935)

erlend-aasland webhook-mailer at python.org
Sat Jul 22 06:46:46 EDT 2023


https://github.com/python/cpython/commit/c5adf26b1867767781af30ada6f05a29449fc650
commit: c5adf26b1867767781af30ada6f05a29449fc650
branch: main
author: Erlend E. Aasland <erlend at python.org>
committer: erlend-aasland <erlend.aasland at protonmail.com>
date: 2023-07-22T12:46:42+02:00
summary:

gh-104050: Argument Clinic: Annotate the BufferSeries class (#106935)

Co-authored-by: Alex Waygood <Alex.Waygood at Gmail.com>

files:
M Tools/clinic/clinic.py

diff --git a/Tools/clinic/clinic.py b/Tools/clinic/clinic.py
index 8acf513a6c1fc..7a4c9c4cacf55 100755
--- a/Tools/clinic/clinic.py
+++ b/Tools/clinic/clinic.py
@@ -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 @@ def __getitem__(self, i):
             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)
 



More information about the Python-checkins mailing list