(s)
| 503 | import re |
| 504 | |
| 505 | def is_good_string(s): |
| 506 | # Regex to match the dictionary-like part {'key1': 'value1', ...} |
| 507 | dict_pattern = r"\{('[^']+' *: *'[^']+' *(, *'[^']+' *: *'[^']+')*)?\}" |
| 508 | # Regex to match the item list part {item1, item2,...} with no single quotes in items |
| 509 | item_pattern = r"\{([a-zA-Z0-9_]+( *, *[a-zA-Z0-9_]+)*)?\}" |
| 510 | |
| 511 | # Find all parts of the string contained within braces |
| 512 | parts = re.findall(r'\{.*?\}', s) |
| 513 | |
| 514 | for part in parts: |
| 515 | # Check if the part matches either the dictionary pattern or item pattern |
| 516 | if not re.fullmatch(dict_pattern, part) and not re.fullmatch(item_pattern, part): |
| 517 | return False |
| 518 | return True |
| 519 | |
| 520 | def check_subtask_dict(subtask_dict): |
| 521 | num_subtask = len(list(subtask_dict.keys())) |
no outgoing calls
no test coverage detected