(action, pattern, format_str, num_args)
| 460 | |
| 461 | |
| 462 | def action_conversion(action, pattern, format_str, num_args): |
| 463 | if num_args == 0: |
| 464 | if action.strip() == pattern.strip(): |
| 465 | return format_str |
| 466 | else: |
| 467 | return None |
| 468 | match = re.search(pattern, action) |
| 469 | if match: |
| 470 | if num_args == 1: |
| 471 | formatted_action = format_str.format(match.group(1)) |
| 472 | elif num_args == 2: |
| 473 | formatted_action = format_str.format(match.group(1), match.group(2)) |
| 474 | return formatted_action |
| 475 | return None |
| 476 | |
| 477 | def recover_action(formalized_action): |
| 478 | conversion_dict = [ |
no test coverage detected