Removes all the breakpoints from a given file or from all files if received_filename == '*'. :param str received_filename: Note: must be sent as it was received in the protocol. It may be translated in this function.
(self, py_db, received_filename)
| 645 | self.add_breakpoint(py_db, *api_add_breakpoint_params) |
| 646 | |
| 647 | def remove_all_breakpoints(self, py_db, received_filename): |
| 648 | """ |
| 649 | Removes all the breakpoints from a given file or from all files if received_filename == '*'. |
| 650 | |
| 651 | :param str received_filename: |
| 652 | Note: must be sent as it was received in the protocol. It may be translated in this |
| 653 | function. |
| 654 | """ |
| 655 | assert received_filename.__class__ == str # i.e.: bytes on py2 and str on py3 |
| 656 | changed = False |
| 657 | lst = [py_db.file_to_id_to_line_breakpoint, py_db.file_to_id_to_plugin_breakpoint, py_db.breakpoints] |
| 658 | if hasattr(py_db, "django_breakpoints"): |
| 659 | lst.append(py_db.django_breakpoints) |
| 660 | |
| 661 | if hasattr(py_db, "jinja2_breakpoints"): |
| 662 | lst.append(py_db.jinja2_breakpoints) |
| 663 | |
| 664 | if received_filename == "*": |
| 665 | py_db.api_received_breakpoints.clear() |
| 666 | |
| 667 | for file_to_id_to_breakpoint in lst: |
| 668 | if file_to_id_to_breakpoint: |
| 669 | file_to_id_to_breakpoint.clear() |
| 670 | changed = True |
| 671 | |
| 672 | else: |
| 673 | received_filename_normalized = pydevd_file_utils.normcase_from_client(received_filename) |
| 674 | items = list(py_db.api_received_breakpoints.items()) # Create a copy to remove items. |
| 675 | translated_filenames = [] |
| 676 | for key, val in items: |
| 677 | original_filename_normalized, _breakpoint_id = key |
| 678 | if original_filename_normalized == received_filename_normalized: |
| 679 | canonical_normalized_filename, _api_add_breakpoint_params = val |
| 680 | # Note: there can be actually 1:N mappings due to source mapping (i.e.: ipython). |
| 681 | translated_filenames.append(canonical_normalized_filename) |
| 682 | del py_db.api_received_breakpoints[key] |
| 683 | |
| 684 | for canonical_normalized_filename in translated_filenames: |
| 685 | for file_to_id_to_breakpoint in lst: |
| 686 | if canonical_normalized_filename in file_to_id_to_breakpoint: |
| 687 | file_to_id_to_breakpoint.pop(canonical_normalized_filename, None) |
| 688 | changed = True |
| 689 | |
| 690 | if changed: |
| 691 | py_db.on_breakpoints_changed(removed=True) |
| 692 | |
| 693 | def remove_breakpoint(self, py_db, received_filename, breakpoint_type, breakpoint_id): |
| 694 | """ |