gh-113317: Remove TextAccumulator type alias from clinic.py (#113413) · python/cpython@5242880 (original) (raw)

Original file line number Diff line number Diff line change
@@ -2342,9 +2342,6 @@ def write(self, text: str) -> None:
2342 2342 self.f.write(text)
2343 2343
2344 2344
2345 -TextAccumulator = list[str]
2346 -
2347 -
2348 2345 class BufferSeries:
2349 2346 """
2350 2347 Behaves like a "defaultlist".
@@ -2358,13 +2355,13 @@ class BufferSeries:
2358 2355
2359 2356 def __init__(self) -> None:
2360 2357 self._start = 0
2361 -self._array: list[TextAccumulator] = []
2358 +self._array: list[list[str]] = []
2362 2359
2363 -def __getitem__(self, i: int) -> TextAccumulator:
2360 +def __getitem__(self, i: int) -> list[str]:
2364 2361 i -= self._start
2365 2362 if i < 0:
2366 2363 self._start += i
2367 -prefix: list[TextAccumulator] = [[] for x in range(-i)]
2364 +prefix: list[list[str]] = [[] for x in range(-i)]
2368 2365 self._array = prefix + self._array
2369 2366 i = 0
2370 2367 while i >= len(self._array):
@@ -2563,7 +2560,7 @@ def __init__(
2563 2560 'impl_definition': d('block'),
2564 2561 }
2565 2562
2566 -DestBufferType = dict[str, TextAccumulator]
2563 +DestBufferType = dict[str, list[str]]
2567 2564 DestBufferList = list[DestBufferType]
2568 2565
2569 2566 self.destination_buffers_stack: DestBufferList = []
@@ -2635,7 +2632,7 @@ def get_destination_buffer(
2635 2632 self,
2636 2633 name: str,
2637 2634 item: int = 0
2638 - ) -> TextAccumulator:
2635 + ) -> list[str]:
2639 2636 d = self.get_destination(name)
2640 2637 return d.buffers[item]
2641 2638