(text, start_pos=0)
| 1390 | continue |
| 1391 | |
| 1392 | def find_json_bounds(text, start_pos=0): |
| 1393 | start = text.find('{', start_pos) |
| 1394 | if start == -1: |
| 1395 | return None, None |
| 1396 | |
| 1397 | bracket_count = 0 |
| 1398 | in_string = False |
| 1399 | escape_next = False |
| 1400 | |
| 1401 | for i in range(start, len(text)): |
| 1402 | char = text[i] |
| 1403 | |
| 1404 | if escape_next: |
| 1405 | escape_next = False |
| 1406 | continue |
| 1407 | |
| 1408 | if char == '\\': |
| 1409 | escape_next = True |
| 1410 | continue |
| 1411 | |
| 1412 | if char == '"' and not escape_next: |
| 1413 | in_string = not in_string |
| 1414 | continue |
| 1415 | |
| 1416 | if not in_string: |
| 1417 | if char == '{': |
| 1418 | bracket_count += 1 |
| 1419 | elif char == '}': |
| 1420 | bracket_count -= 1 |
| 1421 | if bracket_count == 0: |
| 1422 | return start, i + 1 |
| 1423 | |
| 1424 | return None, None |
| 1425 | |
| 1426 | start, end = find_json_bounds(response_text) |
| 1427 | if start is not None and end is not None: |
no outgoing calls
no test coverage detected