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

Method checkline

Lib/pdb.py:755–774  ·  view source on GitHub ↗

Check whether specified line seems to be executable. Return `lineno` if it is, 0 if not (e.g. a docstring, comment, blank line or EOF). Warning: testing is not comprehensive.

(self, filename, lineno)

Source from the content-addressed store, hash-verified

753 return answer or failed
754
755 def checkline(self, filename, lineno):
756 """Check whether specified line seems to be executable.
757
758 Return `lineno` if it is, 0 if not (e.g. a docstring, comment, blank
759 line or EOF). Warning: testing is not comprehensive.
760 """
761 # this method should be callable before starting debugging, so default
762 # to "no globals" if there is no current frame
763 globs = self.curframe.f_globals if hasattr(self, 'curframe') else None
764 line = linecache.getline(filename, lineno, globs)
765 if not line:
766 self.message('End of file')
767 return 0
768 line = line.strip()
769 # Don't allow setting breakpoint at a blank line
770 if (not line or (line[0] == '#') or
771 (line[:3] == '"""') or line[:3] == "'''"):
772 self.error('Blank or comment')
773 return 0
774 return lineno
775
776 def do_enable(self, arg):
777 """enable bpnumber [bpnumber ...]

Callers 1

do_breakMethod · 0.95

Calls 5

messageMethod · 0.95
errorMethod · 0.95
hasattrFunction · 0.85
getlineMethod · 0.45
stripMethod · 0.45

Tested by

no test coverage detected