(text: str)
| 170 | |
| 171 | |
| 172 | def parentheses_placeholder(text: str): |
| 173 | length = len(text) |
| 174 | key = 0 |
| 175 | placeholder = 0 |
| 176 | depth = 0 |
| 177 | output = parentheses_placeholder_data() |
| 178 | output.list.append("") |
| 179 | while length > key: |
| 180 | char = text[key] |
| 181 | key += 1 |
| 182 | if char == "(": |
| 183 | depth += 1 |
| 184 | if depth == 1: |
| 185 | output.text += f"{{{placeholder}}}" |
| 186 | output.list.append("") |
| 187 | placeholder += 1 |
| 188 | elif char == ")": |
| 189 | depth -= 1 |
| 190 | elif depth == 0: |
| 191 | output.text += char |
| 192 | else: |
| 193 | output.list[-1] += char |
| 194 | return output |
| 195 | |
| 196 | |
| 197 | class parentheses_placeholder_data: |
no test coverage detected