(action, objects_string)
| 342 | |
| 343 | |
| 344 | def find_object(action, objects_string): |
| 345 | # Find the index of the target object in the words list |
| 346 | target_object = ' '.join(action.split()[2:]) |
| 347 | if target_object not in objects_string: |
| 348 | return action |
| 349 | target_object_index = objects_string.index(target_object) |
| 350 | |
| 351 | # Check if the target object is inside a container |
| 352 | if objects_string[target_object_index - 8:target_object_index - 1] == "called ": |
| 353 | container_start_index = objects_string.rfind("(", 0, target_object_index) - 1 |
| 354 | container_end_index = objects_string.rfind(")", 0, target_object_index) + 1 |
| 355 | container = objects_string[container_start_index:container_end_index] |
| 356 | action = action.replace(target_object, f"{container}") |
| 357 | |
| 358 | return action |
| 359 | |
| 360 | |
| 361 | def clean_obj_name(action): |
no test coverage detected