Turn on/off individual predicates as to whether a frame should be hidden/skip. The global option to skip (or not) hidden frames is set with skip_hidden To change the value of a predicate skip_predicates key [true|false] Call without arguments to see t
(self, args)
| 854 | pass |
| 855 | |
| 856 | def do_skip_predicates(self, args): |
| 857 | """ |
| 858 | Turn on/off individual predicates as to whether a frame should be hidden/skip. |
| 859 | |
| 860 | The global option to skip (or not) hidden frames is set with skip_hidden |
| 861 | |
| 862 | To change the value of a predicate |
| 863 | |
| 864 | skip_predicates key [true|false] |
| 865 | |
| 866 | Call without arguments to see the current values. |
| 867 | |
| 868 | To permanently change the value of an option add the corresponding |
| 869 | command to your ``~/.pdbrc`` file. If you are programmatically using the |
| 870 | Pdb instance you can also change the ``default_predicates`` class |
| 871 | attribute. |
| 872 | """ |
| 873 | if not args.strip(): |
| 874 | print("current predicates:") |
| 875 | for p, v in self._predicates.items(): |
| 876 | print(" ", p, ":", v) |
| 877 | return |
| 878 | type_value = args.strip().split(" ") |
| 879 | if len(type_value) != 2: |
| 880 | print( |
| 881 | f"Usage: skip_predicates <type> <value>, with <type> one of {set(self._predicates.keys())}" |
| 882 | ) |
| 883 | return |
| 884 | |
| 885 | type_, value = type_value |
| 886 | if type_ not in self._predicates: |
| 887 | print(f"{type_!r} not in {set(self._predicates.keys())}") |
| 888 | return |
| 889 | if value.lower() not in ("true", "yes", "1", "no", "false", "0"): |
| 890 | print( |
| 891 | f"{value!r} is invalid - use one of ('true', 'yes', '1', 'no', 'false', '0')" |
| 892 | ) |
| 893 | return |
| 894 | |
| 895 | self._predicates[type_] = value.lower() in ("true", "yes", "1") |
| 896 | if not any(self._predicates.values()): |
| 897 | print( |
| 898 | "Warning, all predicates set to False, skip_hidden may not have any effects." |
| 899 | ) |
| 900 | |
| 901 | def do_skip_hidden(self, arg): |
| 902 | """ |