MCPcopy Index your code
hub / github.com/RustPython/RustPython / do_clear

Method do_clear

Lib/pdb.py:875–920  ·  view source on GitHub ↗

cl(ear) filename:lineno\ncl(ear) [bpnumber [bpnumber...]] With a space separated list of breakpoint numbers, clear those breakpoints. Without argument, clear all breaks (but first ask confirmation). With a filename:lineno argument, clear all breaks at that line in t

(self, arg)

Source from the content-addressed store, hash-verified

873 complete_ignore = _complete_bpnumber
874
875 def do_clear(self, arg):
876 """cl(ear) filename:lineno\ncl(ear) [bpnumber [bpnumber...]]
877 With a space separated list of breakpoint numbers, clear
878 those breakpoints. Without argument, clear all breaks (but
879 first ask confirmation). With a filename:lineno argument,
880 clear all breaks at that line in that file.
881 """
882 if not arg:
883 try:
884 reply = input('Clear all breaks? ')
885 except EOFError:
886 reply = 'no'
887 reply = reply.strip().lower()
888 if reply in ('y', 'yes'):
889 bplist = [bp for bp in bdb.Breakpoint.bpbynumber if bp]
890 self.clear_all_breaks()
891 for bp in bplist:
892 self.message('Deleted %s' % bp)
893 return
894 if ':' in arg:
895 # Make sure it works for "clear C:\foo\bar.py:12"
896 i = arg.rfind(':')
897 filename = arg[:i]
898 arg = arg[i+1:]
899 try:
900 lineno = int(arg)
901 except ValueError:
902 err = "Invalid line number (%s)" % arg
903 else:
904 bplist = self.get_breaks(filename, lineno)
905 err = self.clear_break(filename, lineno)
906 if err:
907 self.error(err)
908 else:
909 for bp in bplist:
910 self.message('Deleted %s' % bp)
911 return
912 numberlist = arg.split()
913 for i in numberlist:
914 try:
915 bp = self.get_bpbynumber(i)
916 except ValueError as err:
917 self.error(err)
918 else:
919 self.clear_bpbynumber(i)
920 self.message('Deleted %s' % bp)
921 do_cl = do_clear # 'c' is already an abbreviation for 'continue'
922
923 complete_clear = _complete_location

Callers

nothing calls this directly

Calls 12

messageMethod · 0.95
errorMethod · 0.95
clear_all_breaksMethod · 0.80
get_breaksMethod · 0.80
clear_breakMethod · 0.80
get_bpbynumberMethod · 0.80
clear_bpbynumberMethod · 0.80
inputFunction · 0.70
lowerMethod · 0.45
stripMethod · 0.45
rfindMethod · 0.45
splitMethod · 0.45

Tested by

no test coverage detected