Skip to content

gh-113317: Remove TextAccumulator type alias from clinic.py #113413

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions Tools/clinic/clinic.py
Original file line number Diff line number Diff line change
Expand Up @@ -2342,9 +2342,6 @@ def write(self, text: str) -> None:
self.f.write(text)


TextAccumulator = list[str]


class BufferSeries:
"""
Behaves like a "defaultlist".
Expand All @@ -2358,13 +2355,13 @@ class BufferSeries:

def __init__(self) -> None:
self._start = 0
self._array: list[TextAccumulator] = []
self._array: list[list[str]] = []

def __getitem__(self, i: int) -> TextAccumulator:
def __getitem__(self, i: int) -> list[str]:
i -= self._start
if i < 0:
self._start += i
prefix: list[TextAccumulator] = [[] for x in range(-i)]
prefix: list[list[str]] = [[] for x in range(-i)]
self._array = prefix + self._array
i = 0
while i >= len(self._array):
Expand Down Expand Up @@ -2563,7 +2560,7 @@ def __init__(
'impl_definition': d('block'),
}

DestBufferType = dict[str, TextAccumulator]
DestBufferType = dict[str, list[str]]
DestBufferList = list[DestBufferType]

self.destination_buffers_stack: DestBufferList = []
Expand Down Expand Up @@ -2635,7 +2632,7 @@ def get_destination_buffer(
self,
name: str,
item: int = 0
) -> TextAccumulator:
) -> list[str]:
d = self.get_destination(name)
return d.buffers[item]

Expand Down