partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
test | is_class_def | Return True if we are looking at a class definition statement | trepan/lib/bytecode.py | def is_class_def(line, frame):
"""Return True if we are looking at a class definition statement"""
return (line and _re_class.match(line)
and stmt_contains_opcode(frame.f_code, frame.f_lineno,
'BUILD_CLASS')) | def is_class_def(line, frame):
"""Return True if we are looking at a class definition statement"""
return (line and _re_class.match(line)
and stmt_contains_opcode(frame.f_code, frame.f_lineno,
'BUILD_CLASS')) | [
"Return",
"True",
"if",
"we",
"are",
"looking",
"at",
"a",
"class",
"definition",
"statement"
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/lib/bytecode.py#L100-L104 | [
"def",
"is_class_def",
"(",
"line",
",",
"frame",
")",
":",
"return",
"(",
"line",
"and",
"_re_class",
".",
"match",
"(",
"line",
")",
"and",
"stmt_contains_opcode",
"(",
"frame",
".",
"f_code",
",",
"frame",
".",
"f_lineno",
",",
"'BUILD_CLASS'",
")",
"... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | QuitCommand.nothread_quit | quit command when there's just one thread. | trepan/processor/command/quit.py | def nothread_quit(self, arg):
""" quit command when there's just one thread. """
self.debugger.core.stop()
self.debugger.core.execution_status = 'Quit command'
raise Mexcept.DebuggerQuit | def nothread_quit(self, arg):
""" quit command when there's just one thread. """
self.debugger.core.stop()
self.debugger.core.execution_status = 'Quit command'
raise Mexcept.DebuggerQuit | [
"quit",
"command",
"when",
"there",
"s",
"just",
"one",
"thread",
"."
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/command/quit.py#L82-L87 | [
"def",
"nothread_quit",
"(",
"self",
",",
"arg",
")",
":",
"self",
".",
"debugger",
".",
"core",
".",
"stop",
"(",
")",
"self",
".",
"debugger",
".",
"core",
".",
"execution_status",
"=",
"'Quit command'",
"raise",
"Mexcept",
".",
"DebuggerQuit"
] | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | QuitCommand.threaded_quit | quit command when several threads are involved. | trepan/processor/command/quit.py | def threaded_quit(self, arg):
""" quit command when several threads are involved. """
threading_list = threading.enumerate()
mythread = threading.currentThread()
for t in threading_list:
if t != mythread:
ctype_async_raise(t, Mexcept.DebuggerQuit)
... | def threaded_quit(self, arg):
""" quit command when several threads are involved. """
threading_list = threading.enumerate()
mythread = threading.currentThread()
for t in threading_list:
if t != mythread:
ctype_async_raise(t, Mexcept.DebuggerQuit)
... | [
"quit",
"command",
"when",
"several",
"threads",
"are",
"involved",
"."
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/command/quit.py#L89-L98 | [
"def",
"threaded_quit",
"(",
"self",
",",
"arg",
")",
":",
"threading_list",
"=",
"threading",
".",
"enumerate",
"(",
")",
"mythread",
"=",
"threading",
".",
"currentThread",
"(",
")",
"for",
"t",
"in",
"threading_list",
":",
"if",
"t",
"!=",
"mythread",
... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | set_default_bg | Get bacground from
default values based on the TERM environment variable | trepan/lib/term_background.py | def set_default_bg():
"""Get bacground from
default values based on the TERM environment variable
"""
term = environ.get('TERM', None)
if term:
if (term.startswith('xterm',) or term.startswith('eterm')
or term == 'dtterm'):
return False
return True | def set_default_bg():
"""Get bacground from
default values based on the TERM environment variable
"""
term = environ.get('TERM', None)
if term:
if (term.startswith('xterm',) or term.startswith('eterm')
or term == 'dtterm'):
return False
return True | [
"Get",
"bacground",
"from",
"default",
"values",
"based",
"on",
"the",
"TERM",
"environment",
"variable"
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/lib/term_background.py#L28-L37 | [
"def",
"set_default_bg",
"(",
")",
":",
"term",
"=",
"environ",
".",
"get",
"(",
"'TERM'",
",",
"None",
")",
"if",
"term",
":",
"if",
"(",
"term",
".",
"startswith",
"(",
"'xterm'",
",",
")",
"or",
"term",
".",
"startswith",
"(",
"'eterm'",
")",
"o... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | is_dark_rgb | Pass as parameters R G B values in hex
On return, variable is_dark_bg is set | trepan/lib/term_background.py | def is_dark_rgb(r, g, b):
"""Pass as parameters R G B values in hex
On return, variable is_dark_bg is set
"""
try:
midpoint = int(environ.get('TERMINAL_COLOR_MIDPOINT', None))
except:
pass
if not midpoint:
term = environ.get('TERM', None)
# 117963 = (* .6 (+ 6553... | def is_dark_rgb(r, g, b):
"""Pass as parameters R G B values in hex
On return, variable is_dark_bg is set
"""
try:
midpoint = int(environ.get('TERMINAL_COLOR_MIDPOINT', None))
except:
pass
if not midpoint:
term = environ.get('TERM', None)
# 117963 = (* .6 (+ 6553... | [
"Pass",
"as",
"parameters",
"R",
"G",
"B",
"values",
"in",
"hex",
"On",
"return",
"variable",
"is_dark_bg",
"is",
"set"
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/lib/term_background.py#L40-L59 | [
"def",
"is_dark_rgb",
"(",
"r",
",",
"g",
",",
"b",
")",
":",
"try",
":",
"midpoint",
"=",
"int",
"(",
"environ",
".",
"get",
"(",
"'TERMINAL_COLOR_MIDPOINT'",
",",
"None",
")",
")",
"except",
":",
"pass",
"if",
"not",
"midpoint",
":",
"term",
"=",
... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | is_dark_color_fg_bg | Consult (environment) variables DARK_BG and COLORFGB
On return, variable is_dark_bg is set | trepan/lib/term_background.py | def is_dark_color_fg_bg():
"""Consult (environment) variables DARK_BG and COLORFGB
On return, variable is_dark_bg is set"""
dark_bg = environ.get('DARK_BG', None)
if dark_bg is not None:
return dark_bg != '0'
color_fg_bg = environ.get('COLORFGBG', None)
if color_fg_bg:
if color_f... | def is_dark_color_fg_bg():
"""Consult (environment) variables DARK_BG and COLORFGB
On return, variable is_dark_bg is set"""
dark_bg = environ.get('DARK_BG', None)
if dark_bg is not None:
return dark_bg != '0'
color_fg_bg = environ.get('COLORFGBG', None)
if color_fg_bg:
if color_f... | [
"Consult",
"(",
"environment",
")",
"variables",
"DARK_BG",
"and",
"COLORFGB",
"On",
"return",
"variable",
"is_dark_bg",
"is",
"set"
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/lib/term_background.py#L62-L76 | [
"def",
"is_dark_color_fg_bg",
"(",
")",
":",
"dark_bg",
"=",
"environ",
".",
"get",
"(",
"'DARK_BG'",
",",
"None",
")",
"if",
"dark_bg",
"is",
"not",
"None",
":",
"return",
"dark_bg",
"!=",
"'0'",
"color_fg_bg",
"=",
"environ",
".",
"get",
"(",
"'COLORFG... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | process_options | Handle debugger options. Set `option_list' if you are writing
another main program and want to extend the existing set of debugger
options.
The options dicionary from opt_parser is return. sys_argv is
also updated. | trepan/bwcli.py | def process_options(debugger_name, pkg_version, sys_argv, option_list=None):
"""Handle debugger options. Set `option_list' if you are writing
another main program and want to extend the existing set of debugger
options.
The options dicionary from opt_parser is return. sys_argv is
also updated."""
... | def process_options(debugger_name, pkg_version, sys_argv, option_list=None):
"""Handle debugger options. Set `option_list' if you are writing
another main program and want to extend the existing set of debugger
options.
The options dicionary from opt_parser is return. sys_argv is
also updated."""
... | [
"Handle",
"debugger",
"options",
".",
"Set",
"option_list",
"if",
"you",
"are",
"writing",
"another",
"main",
"program",
"and",
"want",
"to",
"extend",
"the",
"existing",
"set",
"of",
"debugger",
"options",
"."
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/bwcli.py#L36-L70 | [
"def",
"process_options",
"(",
"debugger_name",
",",
"pkg_version",
",",
"sys_argv",
",",
"option_list",
"=",
"None",
")",
":",
"usage_str",
"=",
"\"\"\"%prog [debugger-options] [python-script [script-options...]]\n\n Runs the extended python debugger\"\"\"",
"# serverChoices... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | _postprocess_options | Handle options (`opts') that feed into the debugger (`dbg') | trepan/bwcli.py | def _postprocess_options(dbg, opts):
''' Handle options (`opts') that feed into the debugger (`dbg')'''
# Set dbg.settings['printset']
print_events = []
if opts.fntrace: print_events = ['c_call', 'c_return', 'call', 'return']
# if opts.linetrace: print_events += ['line']
if len(print_events):
... | def _postprocess_options(dbg, opts):
''' Handle options (`opts') that feed into the debugger (`dbg')'''
# Set dbg.settings['printset']
print_events = []
if opts.fntrace: print_events = ['c_call', 'c_return', 'call', 'return']
# if opts.linetrace: print_events += ['line']
if len(print_events):
... | [
"Handle",
"options",
"(",
"opts",
")",
"that",
"feed",
"into",
"the",
"debugger",
"(",
"dbg",
")"
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/bwcli.py#L73-L90 | [
"def",
"_postprocess_options",
"(",
"dbg",
",",
"opts",
")",
":",
"# Set dbg.settings['printset']",
"print_events",
"=",
"[",
"]",
"if",
"opts",
".",
"fntrace",
":",
"print_events",
"=",
"[",
"'c_call'",
",",
"'c_return'",
",",
"'call'",
",",
"'return'",
"]",
... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | main | Routine which gets run if we were invoked directly | trepan/bwcli.py | def main(dbg=None, sys_argv=list(sys.argv)):
"""Routine which gets run if we were invoked directly"""
global __title__
# Save the original just for use in the restart that works via exec.
orig_sys_argv = list(sys_argv)
opts, dbg_opts, sys_argv = process_options(__title__, __version__,
... | def main(dbg=None, sys_argv=list(sys.argv)):
"""Routine which gets run if we were invoked directly"""
global __title__
# Save the original just for use in the restart that works via exec.
orig_sys_argv = list(sys_argv)
opts, dbg_opts, sys_argv = process_options(__title__, __version__,
... | [
"Routine",
"which",
"gets",
"run",
"if",
"we",
"were",
"invoked",
"directly"
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/bwcli.py#L93-L194 | [
"def",
"main",
"(",
"dbg",
"=",
"None",
",",
"sys_argv",
"=",
"list",
"(",
"sys",
".",
"argv",
")",
")",
":",
"global",
"__title__",
"# Save the original just for use in the restart that works via exec.",
"orig_sys_argv",
"=",
"list",
"(",
"sys_argv",
")",
"opts",... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | get_name | Get the name caller's caller.
NB: f_code.co_filenames and thus this code kind of broken for
zip'ed eggs circa Jan 2009 | trepan/processor/command/show_subcmd/__demo_helper__.py | def get_name():
"""Get the name caller's caller.
NB: f_code.co_filenames and thus this code kind of broken for
zip'ed eggs circa Jan 2009
"""
caller = sys._getframe(2)
filename = caller.f_code.co_filename
filename = os.path.normcase(os.path.basename(filename))
return os.path.splitext(fil... | def get_name():
"""Get the name caller's caller.
NB: f_code.co_filenames and thus this code kind of broken for
zip'ed eggs circa Jan 2009
"""
caller = sys._getframe(2)
filename = caller.f_code.co_filename
filename = os.path.normcase(os.path.basename(filename))
return os.path.splitext(fil... | [
"Get",
"the",
"name",
"caller",
"s",
"caller",
".",
"NB",
":",
"f_code",
".",
"co_filenames",
"and",
"thus",
"this",
"code",
"kind",
"of",
"broken",
"for",
"zip",
"ed",
"eggs",
"circa",
"Jan",
"2009"
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/command/show_subcmd/__demo_helper__.py#L5-L13 | [
"def",
"get_name",
"(",
")",
":",
"caller",
"=",
"sys",
".",
"_getframe",
"(",
"2",
")",
"filename",
"=",
"caller",
".",
"f_code",
".",
"co_filename",
"filename",
"=",
"os",
".",
"path",
".",
"normcase",
"(",
"os",
".",
"path",
".",
"basename",
"(",
... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | signature | return suitable frame signature to key display expressions off of. | trepan/lib/display.py | def signature(frame):
'''return suitable frame signature to key display expressions off of.'''
if not frame: return None
code = frame.f_code
return (code.co_name, code.co_filename, code.co_firstlineno) | def signature(frame):
'''return suitable frame signature to key display expressions off of.'''
if not frame: return None
code = frame.f_code
return (code.co_name, code.co_filename, code.co_firstlineno) | [
"return",
"suitable",
"frame",
"signature",
"to",
"key",
"display",
"expressions",
"off",
"of",
"."
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/lib/display.py#L25-L29 | [
"def",
"signature",
"(",
"frame",
")",
":",
"if",
"not",
"frame",
":",
"return",
"None",
"code",
"=",
"frame",
".",
"f_code",
"return",
"(",
"code",
".",
"co_name",
",",
"code",
".",
"co_filename",
",",
"code",
".",
"co_firstlineno",
")"
] | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | DisplayMgr.all | List all display items; return 0 if none | trepan/lib/display.py | def all(self):
"""List all display items; return 0 if none"""
found = False
s = []
for display in self.list:
if not found:
s.append("""Auto-display expressions now in effect:
Num Enb Expression""")
found = True
pass
... | def all(self):
"""List all display items; return 0 if none"""
found = False
s = []
for display in self.list:
if not found:
s.append("""Auto-display expressions now in effect:
Num Enb Expression""")
found = True
pass
... | [
"List",
"all",
"display",
"items",
";",
"return",
"0",
"if",
"none"
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/lib/display.py#L51-L62 | [
"def",
"all",
"(",
"self",
")",
":",
"found",
"=",
"False",
"s",
"=",
"[",
"]",
"for",
"display",
"in",
"self",
".",
"list",
":",
"if",
"not",
"found",
":",
"s",
".",
"append",
"(",
"\"\"\"Auto-display expressions now in effect:\nNum Enb Expression\"\"\"",
"... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | DisplayMgr.delete_index | Delete display expression *display_number* | trepan/lib/display.py | def delete_index(self, display_number):
"""Delete display expression *display_number*"""
old_size = len(self.list)
self.list = [disp for disp in self.list
if display_number != disp.number]
return old_size != len(self.list) | def delete_index(self, display_number):
"""Delete display expression *display_number*"""
old_size = len(self.list)
self.list = [disp for disp in self.list
if display_number != disp.number]
return old_size != len(self.list) | [
"Delete",
"display",
"expression",
"*",
"display_number",
"*"
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/lib/display.py#L69-L74 | [
"def",
"delete_index",
"(",
"self",
",",
"display_number",
")",
":",
"old_size",
"=",
"len",
"(",
"self",
".",
"list",
")",
"self",
".",
"list",
"=",
"[",
"disp",
"for",
"disp",
"in",
"self",
".",
"list",
"if",
"display_number",
"!=",
"disp",
".",
"n... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | DisplayMgr.display | display any items that are active | trepan/lib/display.py | def display(self, frame):
'''display any items that are active'''
if not frame: return
s = []
sig = signature(frame)
for display in self.list:
if display.signature == sig and display.enabled:
s.append(display.to_s(frame))
pass
... | def display(self, frame):
'''display any items that are active'''
if not frame: return
s = []
sig = signature(frame)
for display in self.list:
if display.signature == sig and display.enabled:
s.append(display.to_s(frame))
pass
... | [
"display",
"any",
"items",
"that",
"are",
"active"
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/lib/display.py#L76-L86 | [
"def",
"display",
"(",
"self",
",",
"frame",
")",
":",
"if",
"not",
"frame",
":",
"return",
"s",
"=",
"[",
"]",
"sig",
"=",
"signature",
"(",
"frame",
")",
"for",
"display",
"in",
"self",
".",
"list",
":",
"if",
"display",
".",
"signature",
"==",
... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | Display.format | format display item | trepan/lib/display.py | def format(self, show_enabled=True):
'''format display item'''
what = ''
if show_enabled:
if self.enabled:
what += ' y '
else:
what += ' n '
pass
pass
if self.fmt:
what += self.fmt + ' '
... | def format(self, show_enabled=True):
'''format display item'''
what = ''
if show_enabled:
if self.enabled:
what += ' y '
else:
what += ' n '
pass
pass
if self.fmt:
what += self.fmt + ' '
... | [
"format",
"display",
"item"
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/lib/display.py#L120-L134 | [
"def",
"format",
"(",
"self",
",",
"show_enabled",
"=",
"True",
")",
":",
"what",
"=",
"''",
"if",
"show_enabled",
":",
"if",
"self",
".",
"enabled",
":",
"what",
"+=",
"' y '",
"else",
":",
"what",
"+=",
"' n '",
"pass",
"pass",
"if",
"self",
".",
... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | TCPClient.read_msg | Read one message unit. It's possible however that
more than one message will be set in a receive, so we will
have to buffer that for the next read.
EOFError will be raised on EOF. | trepan/inout/tcpclient.py | def read_msg(self):
"""Read one message unit. It's possible however that
more than one message will be set in a receive, so we will
have to buffer that for the next read.
EOFError will be raised on EOF.
"""
if self.state == 'connected':
if 0 == len(self.buf):
... | def read_msg(self):
"""Read one message unit. It's possible however that
more than one message will be set in a receive, so we will
have to buffer that for the next read.
EOFError will be raised on EOF.
"""
if self.state == 'connected':
if 0 == len(self.buf):
... | [
"Read",
"one",
"message",
"unit",
".",
"It",
"s",
"possible",
"however",
"that",
"more",
"than",
"one",
"message",
"will",
"be",
"set",
"in",
"a",
"receive",
"so",
"we",
"will",
"have",
"to",
"buffer",
"that",
"for",
"the",
"next",
"read",
".",
"EOFErr... | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/inout/tcpclient.py#L84-L100 | [
"def",
"read_msg",
"(",
"self",
")",
":",
"if",
"self",
".",
"state",
"==",
"'connected'",
":",
"if",
"0",
"==",
"len",
"(",
"self",
".",
"buf",
")",
":",
"self",
".",
"buf",
"=",
"self",
".",
"inout",
".",
"recv",
"(",
"Mtcpfns",
".",
"TCP_MAX_P... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | debugger | Return the current debugger instance (if any),
or creates a new one. | celery/ctrepan.py | def debugger():
"""Return the current debugger instance (if any),
or creates a new one."""
dbg = _current[0]
if dbg is None or not dbg.active:
dbg = _current[0] = RemoteCeleryTrepan()
return dbg | def debugger():
"""Return the current debugger instance (if any),
or creates a new one."""
dbg = _current[0]
if dbg is None or not dbg.active:
dbg = _current[0] = RemoteCeleryTrepan()
return dbg | [
"Return",
"the",
"current",
"debugger",
"instance",
"(",
"if",
"any",
")",
"or",
"creates",
"a",
"new",
"one",
"."
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/celery/ctrepan.py#L104-L110 | [
"def",
"debugger",
"(",
")",
":",
"dbg",
"=",
"_current",
"[",
"0",
"]",
"if",
"dbg",
"is",
"None",
"or",
"not",
"dbg",
".",
"active",
":",
"dbg",
"=",
"_current",
"[",
"0",
"]",
"=",
"RemoteCeleryTrepan",
"(",
")",
"return",
"dbg"
] | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | debug | Set breakpoint at current location, or a specified frame | celery/ctrepan.py | def debug(frame=None):
"""Set breakpoint at current location, or a specified frame"""
# ???
if frame is None:
frame = _frame().f_back
dbg = RemoteCeleryTrepan()
dbg.say(BANNER.format(self=dbg))
# dbg.say(SESSION_STARTED.format(self=dbg))
trepan.api.debug(dbg_opts=dbg.dbg_opts) | def debug(frame=None):
"""Set breakpoint at current location, or a specified frame"""
# ???
if frame is None:
frame = _frame().f_back
dbg = RemoteCeleryTrepan()
dbg.say(BANNER.format(self=dbg))
# dbg.say(SESSION_STARTED.format(self=dbg))
trepan.api.debug(dbg_opts=dbg.dbg_opts) | [
"Set",
"breakpoint",
"at",
"current",
"location",
"or",
"a",
"specified",
"frame"
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/celery/ctrepan.py#L113-L122 | [
"def",
"debug",
"(",
"frame",
"=",
"None",
")",
":",
"# ???",
"if",
"frame",
"is",
"None",
":",
"frame",
"=",
"_frame",
"(",
")",
".",
"f_back",
"dbg",
"=",
"RemoteCeleryTrepan",
"(",
")",
"dbg",
".",
"say",
"(",
"BANNER",
".",
"format",
"(",
"self... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | cache_from_source | Given the path to a .py file, return the path to its .pyc/.pyo file.
The .py file does not need to exist; this simply returns the path to the
.pyc/.pyo file calculated as if the .py file were imported. The extension
will be .pyc unless sys.flags.optimize is non-zero, then it will be .pyo.
If debug_ov... | trepan/processor/command/disassemble.py | def cache_from_source(path, debug_override=None):
"""Given the path to a .py file, return the path to its .pyc/.pyo file.
The .py file does not need to exist; this simply returns the path to the
.pyc/.pyo file calculated as if the .py file were imported. The extension
will be .pyc unless sys.flags.opt... | def cache_from_source(path, debug_override=None):
"""Given the path to a .py file, return the path to its .pyc/.pyo file.
The .py file does not need to exist; this simply returns the path to the
.pyc/.pyo file calculated as if the .py file were imported. The extension
will be .pyc unless sys.flags.opt... | [
"Given",
"the",
"path",
"to",
"a",
".",
"py",
"file",
"return",
"the",
"path",
"to",
"its",
".",
"pyc",
"/",
".",
"pyo",
"file",
"."
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/command/disassemble.py#L29-L57 | [
"def",
"cache_from_source",
"(",
"path",
",",
"debug_override",
"=",
"None",
")",
":",
"debug",
"=",
"not",
"sys",
".",
"flags",
".",
"optimize",
"if",
"debug_override",
"is",
"None",
"else",
"debug_override",
"if",
"debug",
":",
"suffixes",
"=",
"DEBUG_BYTE... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | SubcommandMgr._load_debugger_subcommands | Create an instance of each of the debugger
subcommands. Commands are found by importing files in the
directory 'name' + 'sub'. Some files are excluded via an array set
in __init__. For each of the remaining files, we import them
and scan for class names inside those files and for each c... | trepan/processor/command/base_submgr.py | def _load_debugger_subcommands(self, name):
""" Create an instance of each of the debugger
subcommands. Commands are found by importing files in the
directory 'name' + 'sub'. Some files are excluded via an array set
in __init__. For each of the remaining files, we import them
an... | def _load_debugger_subcommands(self, name):
""" Create an instance of each of the debugger
subcommands. Commands are found by importing files in the
directory 'name' + 'sub'. Some files are excluded via an array set
in __init__. For each of the remaining files, we import them
an... | [
"Create",
"an",
"instance",
"of",
"each",
"of",
"the",
"debugger",
"subcommands",
".",
"Commands",
"are",
"found",
"by",
"importing",
"files",
"in",
"the",
"directory",
"name",
"+",
"sub",
".",
"Some",
"files",
"are",
"excluded",
"via",
"an",
"array",
"set... | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/command/base_submgr.py#L59-L105 | [
"def",
"_load_debugger_subcommands",
"(",
"self",
",",
"name",
")",
":",
"# Initialization",
"cmd_instances",
"=",
"[",
"]",
"class_prefix",
"=",
"capitalize",
"(",
"name",
")",
"# e.g. Info, Set, or Show",
"module_dir",
"=",
"'trepan.processor.command.%s_subcmd'",
"%",... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | SubcommandMgr.help | Give help for a command which has subcommands. This can be
called in several ways:
help cmd
help cmd subcmd
help cmd commands
Our shtick is to give help for the overall command only if
subcommand or 'commands' is not given. If a subcommand is given and
... | trepan/processor/command/base_submgr.py | def help(self, args):
"""Give help for a command which has subcommands. This can be
called in several ways:
help cmd
help cmd subcmd
help cmd commands
Our shtick is to give help for the overall command only if
subcommand or 'commands' is not given. If... | def help(self, args):
"""Give help for a command which has subcommands. This can be
called in several ways:
help cmd
help cmd subcmd
help cmd commands
Our shtick is to give help for the overall command only if
subcommand or 'commands' is not given. If... | [
"Give",
"help",
"for",
"a",
"command",
"which",
"has",
"subcommands",
".",
"This",
"can",
"be",
"called",
"in",
"several",
"ways",
":",
"help",
"cmd",
"help",
"cmd",
"subcmd",
"help",
"cmd",
"commands"
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/command/base_submgr.py#L107-L162 | [
"def",
"help",
"(",
"self",
",",
"args",
")",
":",
"if",
"len",
"(",
"args",
")",
"<=",
"2",
":",
"# \"help cmd\". Give the general help for the command part.",
"doc",
"=",
"self",
".",
"__doc__",
"or",
"self",
".",
"run",
".",
"__doc__",
"if",
"doc",
":",... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | SubcommandMgr.run | Ooops -- the debugger author didn't redefine this run docstring. | trepan/processor/command/base_submgr.py | def run(self, args):
"""Ooops -- the debugger author didn't redefine this run docstring."""
if len(args) < 2:
# We were given cmd without a subcommand; cmd is something
# like "show", "info" or "set". Generally this means list
# all of the subcommands.
sel... | def run(self, args):
"""Ooops -- the debugger author didn't redefine this run docstring."""
if len(args) < 2:
# We were given cmd without a subcommand; cmd is something
# like "show", "info" or "set". Generally this means list
# all of the subcommands.
sel... | [
"Ooops",
"--",
"the",
"debugger",
"author",
"didn",
"t",
"redefine",
"this",
"run",
"docstring",
"."
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/command/base_submgr.py#L175-L210 | [
"def",
"run",
"(",
"self",
",",
"args",
")",
":",
"if",
"len",
"(",
"args",
")",
"<",
"2",
":",
"# We were given cmd without a subcommand; cmd is something",
"# like \"show\", \"info\" or \"set\". Generally this means list",
"# all of the subcommands.",
"self",
".",
"sectio... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | SubcommandMgr.undefined_subcmd | Error message when subcommand asked for but doesn't exist | trepan/processor/command/base_submgr.py | def undefined_subcmd(self, cmd, subcmd):
"""Error message when subcommand asked for but doesn't exist"""
self.proc.intf[-1].errmsg(('Undefined "%s" subcommand: "%s". ' +
'Try "help %s *".') % (cmd, subcmd, cmd))
return | def undefined_subcmd(self, cmd, subcmd):
"""Error message when subcommand asked for but doesn't exist"""
self.proc.intf[-1].errmsg(('Undefined "%s" subcommand: "%s". ' +
'Try "help %s *".') % (cmd, subcmd, cmd))
return | [
"Error",
"message",
"when",
"subcommand",
"asked",
"for",
"but",
"doesn",
"t",
"exist"
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/command/base_submgr.py#L219-L223 | [
"def",
"undefined_subcmd",
"(",
"self",
",",
"cmd",
",",
"subcmd",
")",
":",
"self",
".",
"proc",
".",
"intf",
"[",
"-",
"1",
"]",
".",
"errmsg",
"(",
"(",
"'Undefined \"%s\" subcommand: \"%s\". '",
"+",
"'Try \"help %s *\".'",
")",
"%",
"(",
"cmd",
",",
... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | runcode | Execute a code object.
When an exception occurs, self.showtraceback() is called to
display a traceback. All exceptions are caught except
SystemExit, which is reraised.
A note about KeyboardInterrupt: this exception may occur
elsewhere in this code, and may not always be caught. The
caller sh... | trepan/processor/command/python.py | def runcode(obj, code_obj):
"""Execute a code object.
When an exception occurs, self.showtraceback() is called to
display a traceback. All exceptions are caught except
SystemExit, which is reraised.
A note about KeyboardInterrupt: this exception may occur
elsewhere in this code, and may not a... | def runcode(obj, code_obj):
"""Execute a code object.
When an exception occurs, self.showtraceback() is called to
display a traceback. All exceptions are caught except
SystemExit, which is reraised.
A note about KeyboardInterrupt: this exception may occur
elsewhere in this code, and may not a... | [
"Execute",
"a",
"code",
"object",
"."
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/command/python.py#L170-L191 | [
"def",
"runcode",
"(",
"obj",
",",
"code_obj",
")",
":",
"try",
":",
"exec",
"(",
"code_obj",
",",
"obj",
".",
"locals",
",",
"obj",
".",
"globals",
")",
"except",
"SystemExit",
":",
"raise",
"except",
":",
"info",
"=",
"sys",
".",
"exc_info",
"(",
... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | DownCommand.run | **down** [*count*]
Move the current frame down in the stack trace (to a newer frame). 0
is the most recent frame. If no count is given, move down 1.
See also:
---------
`up` and `frame`. | trepan/processor/command/down.py | def run(self, args):
"""**down** [*count*]
Move the current frame down in the stack trace (to a newer frame). 0
is the most recent frame. If no count is given, move down 1.
See also:
---------
`up` and `frame`."""
Mframe.adjust_relative(self.proc, self.name, args, self.signum)
return False | def run(self, args):
"""**down** [*count*]
Move the current frame down in the stack trace (to a newer frame). 0
is the most recent frame. If no count is given, move down 1.
See also:
---------
`up` and `frame`."""
Mframe.adjust_relative(self.proc, self.name, args, self.signum)
return False | [
"**",
"down",
"**",
"[",
"*",
"count",
"*",
"]"
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/command/down.py#L28-L40 | [
"def",
"run",
"(",
"self",
",",
"args",
")",
":",
"Mframe",
".",
"adjust_relative",
"(",
"self",
".",
"proc",
",",
"self",
".",
"name",
",",
"args",
",",
"self",
".",
"signum",
")",
"return",
"False"
] | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | resolve_location | Expand fields in Location namedtuple. If:
'.': get fields from stack
function/module: get fields from evaluation/introspection
location file and line number: use that | trepan/processor/location.py | def resolve_location(proc, location):
"""Expand fields in Location namedtuple. If:
'.': get fields from stack
function/module: get fields from evaluation/introspection
location file and line number: use that
"""
curframe = proc.curframe
if location == '.':
if not curframe:
... | def resolve_location(proc, location):
"""Expand fields in Location namedtuple. If:
'.': get fields from stack
function/module: get fields from evaluation/introspection
location file and line number: use that
"""
curframe = proc.curframe
if location == '.':
if not curframe:
... | [
"Expand",
"fields",
"in",
"Location",
"namedtuple",
".",
"If",
":",
".",
":",
"get",
"fields",
"from",
"stack",
"function",
"/",
"module",
":",
"get",
"fields",
"from",
"evaluation",
"/",
"introspection",
"location",
"file",
"and",
"line",
"number",
":",
"... | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/location.py#L23-L113 | [
"def",
"resolve_location",
"(",
"proc",
",",
"location",
")",
":",
"curframe",
"=",
"proc",
".",
"curframe",
"if",
"location",
"==",
"'.'",
":",
"if",
"not",
"curframe",
":",
"proc",
".",
"errmsg",
"(",
"\"Don't have a stack to get location from\"",
")",
"retu... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | resolve_address_location | Expand fields in Location namedtuple. If:
'.': get fields from stack
function/module: get fields from evaluation/introspection
location file and line number: use that | trepan/processor/location.py | def resolve_address_location(proc, location):
"""Expand fields in Location namedtuple. If:
'.': get fields from stack
function/module: get fields from evaluation/introspection
location file and line number: use that
"""
curframe = proc.curframe
if location == '.':
filename ... | def resolve_address_location(proc, location):
"""Expand fields in Location namedtuple. If:
'.': get fields from stack
function/module: get fields from evaluation/introspection
location file and line number: use that
"""
curframe = proc.curframe
if location == '.':
filename ... | [
"Expand",
"fields",
"in",
"Location",
"namedtuple",
".",
"If",
":",
".",
":",
"get",
"fields",
"from",
"stack",
"function",
"/",
"module",
":",
"get",
"fields",
"from",
"evaluation",
"/",
"introspection",
"location",
"file",
"and",
"line",
"number",
":",
"... | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/location.py#L115-L204 | [
"def",
"resolve_address_location",
"(",
"proc",
",",
"location",
")",
":",
"curframe",
"=",
"proc",
".",
"curframe",
"if",
"location",
"==",
"'.'",
":",
"filename",
"=",
"Mstack",
".",
"frame2file",
"(",
"proc",
".",
"core",
",",
"curframe",
",",
"canonic"... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | FrameCommand.find_and_set_debugged_frame | The dance we have to do to set debugger frame state to
*frame*, which is in the thread with id *thread_id*. We may
need to the hide initial debugger frames. | trepan/processor/command/frame.py | def find_and_set_debugged_frame(self, frame, thread_id):
'''The dance we have to do to set debugger frame state to
*frame*, which is in the thread with id *thread_id*. We may
need to the hide initial debugger frames.
'''
thread = threading._active[thread_id]
thread_name =... | def find_and_set_debugged_frame(self, frame, thread_id):
'''The dance we have to do to set debugger frame state to
*frame*, which is in the thread with id *thread_id*. We may
need to the hide initial debugger frames.
'''
thread = threading._active[thread_id]
thread_name =... | [
"The",
"dance",
"we",
"have",
"to",
"do",
"to",
"set",
"debugger",
"frame",
"state",
"to",
"*",
"frame",
"*",
"which",
"is",
"in",
"the",
"thread",
"with",
"id",
"*",
"thread_id",
"*",
".",
"We",
"may",
"need",
"to",
"the",
"hide",
"initial",
"debugg... | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/command/frame.py#L76-L102 | [
"def",
"find_and_set_debugged_frame",
"(",
"self",
",",
"frame",
",",
"thread_id",
")",
":",
"thread",
"=",
"threading",
".",
"_active",
"[",
"thread_id",
"]",
"thread_name",
"=",
"thread",
".",
"getName",
"(",
")",
"if",
"(",
"not",
"self",
".",
"settings... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | FrameCommand.one_arg_run | The simple case: thread frame switching has been done or is
not needed and we have an explicit position number as a string | trepan/processor/command/frame.py | def one_arg_run(self, position_str):
'''The simple case: thread frame switching has been done or is
not needed and we have an explicit position number as a string'''
frame_num = self.proc.get_an_int(position_str,
("The 'frame' command requires a" +
... | def one_arg_run(self, position_str):
'''The simple case: thread frame switching has been done or is
not needed and we have an explicit position number as a string'''
frame_num = self.proc.get_an_int(position_str,
("The 'frame' command requires a" +
... | [
"The",
"simple",
"case",
":",
"thread",
"frame",
"switching",
"has",
"been",
"done",
"or",
"is",
"not",
"needed",
"and",
"we",
"have",
"an",
"explicit",
"position",
"number",
"as",
"a",
"string"
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/command/frame.py#L104-L127 | [
"def",
"one_arg_run",
"(",
"self",
",",
"position_str",
")",
":",
"frame_num",
"=",
"self",
".",
"proc",
".",
"get_an_int",
"(",
"position_str",
",",
"(",
"\"The 'frame' command requires a\"",
"+",
"\" frame number. Got: %s\"",
")",
"%",
"position_str",
")",
"if",... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | FrameCommand.get_from_thread_name_or_id | See if *name_or_id* is either a thread name or a thread id.
The frame of that id/name is returned, or None if name_or_id is
invalid. | trepan/processor/command/frame.py | def get_from_thread_name_or_id(self, name_or_id, report_error=True):
'''See if *name_or_id* is either a thread name or a thread id.
The frame of that id/name is returned, or None if name_or_id is
invalid.'''
thread_id = self.proc.get_int_noerr(name_or_id)
if thread_id is None:
... | def get_from_thread_name_or_id(self, name_or_id, report_error=True):
'''See if *name_or_id* is either a thread name or a thread id.
The frame of that id/name is returned, or None if name_or_id is
invalid.'''
thread_id = self.proc.get_int_noerr(name_or_id)
if thread_id is None:
... | [
"See",
"if",
"*",
"name_or_id",
"*",
"is",
"either",
"a",
"thread",
"name",
"or",
"a",
"thread",
"id",
".",
"The",
"frame",
"of",
"that",
"id",
"/",
"name",
"is",
"returned",
"or",
"None",
"if",
"name_or_id",
"is",
"invalid",
"."
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/command/frame.py#L129-L156 | [
"def",
"get_from_thread_name_or_id",
"(",
"self",
",",
"name_or_id",
",",
"report_error",
"=",
"True",
")",
":",
"thread_id",
"=",
"self",
".",
"proc",
".",
"get_int_noerr",
"(",
"name_or_id",
")",
"if",
"thread_id",
"is",
"None",
":",
"# Must be a \"frame\" com... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | FrameCommand.run | Run a frame command. This routine is a little complex
because we allow a number parameter variations. | trepan/processor/command/frame.py | def run(self, args):
'''Run a frame command. This routine is a little complex
because we allow a number parameter variations.'''
if len(args) == 1:
# Form is: "frame" which means "frame 0"
position_str = '0'
elif len(args) == 2:
# Form is: "frame {pos... | def run(self, args):
'''Run a frame command. This routine is a little complex
because we allow a number parameter variations.'''
if len(args) == 1:
# Form is: "frame" which means "frame 0"
position_str = '0'
elif len(args) == 2:
# Form is: "frame {pos... | [
"Run",
"a",
"frame",
"command",
".",
"This",
"routine",
"is",
"a",
"little",
"complex",
"because",
"we",
"allow",
"a",
"number",
"parameter",
"variations",
"."
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/command/frame.py#L158-L190 | [
"def",
"run",
"(",
"self",
",",
"args",
")",
":",
"if",
"len",
"(",
"args",
")",
"==",
"1",
":",
"# Form is: \"frame\" which means \"frame 0\"",
"position_str",
"=",
"'0'",
"elif",
"len",
"(",
"args",
")",
"==",
"2",
":",
"# Form is: \"frame {position | thread... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | pprint_simple_array | Try to pretty print a simple case where a list is not nested.
Return True if we can do it and False if not. | trepan/lib/pp.py | def pprint_simple_array(val, displaywidth, msg_nocr, msg, lineprefix=''):
'''Try to pretty print a simple case where a list is not nested.
Return True if we can do it and False if not. '''
if type(val) != list:
return False
numeric = True
for i in range(len(val)):
if not (type(val[... | def pprint_simple_array(val, displaywidth, msg_nocr, msg, lineprefix=''):
'''Try to pretty print a simple case where a list is not nested.
Return True if we can do it and False if not. '''
if type(val) != list:
return False
numeric = True
for i in range(len(val)):
if not (type(val[... | [
"Try",
"to",
"pretty",
"print",
"a",
"simple",
"case",
"where",
"a",
"list",
"is",
"not",
"nested",
".",
"Return",
"True",
"if",
"we",
"can",
"do",
"it",
"and",
"False",
"if",
"not",
"."
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/lib/pp.py#L40-L61 | [
"def",
"pprint_simple_array",
"(",
"val",
",",
"displaywidth",
",",
"msg_nocr",
",",
"msg",
",",
"lineprefix",
"=",
"''",
")",
":",
"if",
"type",
"(",
"val",
")",
"!=",
"list",
":",
"return",
"False",
"numeric",
"=",
"True",
"for",
"i",
"in",
"range",
... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | main | Routine which gets run if we were invoked directly | trepan/cli.py | def main(dbg=None, sys_argv=list(sys.argv)):
"""Routine which gets run if we were invoked directly"""
global __title__
# Save the original just for use in the restart that works via exec.
orig_sys_argv = list(sys_argv)
opts, dbg_opts, sys_argv = Moptions.process_options(__title__,
... | def main(dbg=None, sys_argv=list(sys.argv)):
"""Routine which gets run if we were invoked directly"""
global __title__
# Save the original just for use in the restart that works via exec.
orig_sys_argv = list(sys_argv)
opts, dbg_opts, sys_argv = Moptions.process_options(__title__,
... | [
"Routine",
"which",
"gets",
"run",
"if",
"we",
"were",
"invoked",
"directly"
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/cli.py#L41-L242 | [
"def",
"main",
"(",
"dbg",
"=",
"None",
",",
"sys_argv",
"=",
"list",
"(",
"sys",
".",
"argv",
")",
")",
":",
"global",
"__title__",
"# Save the original just for use in the restart that works via exec.",
"orig_sys_argv",
"=",
"list",
"(",
"sys_argv",
")",
"opts",... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | DebuggerUserOutput.open | Use this to set where to write to. output can be a
file object or a string. This code raises IOError on error. | trepan/inout/output.py | def open(self, output, opts=None):
"""Use this to set where to write to. output can be a
file object or a string. This code raises IOError on error."""
if isinstance(output, io.TextIOWrapper) or \
isinstance(output, io.StringIO) or \
output == sys.stdout:
pass
... | def open(self, output, opts=None):
"""Use this to set where to write to. output can be a
file object or a string. This code raises IOError on error."""
if isinstance(output, io.TextIOWrapper) or \
isinstance(output, io.StringIO) or \
output == sys.stdout:
pass
... | [
"Use",
"this",
"to",
"set",
"where",
"to",
"write",
"to",
".",
"output",
"can",
"be",
"a",
"file",
"object",
"or",
"a",
"string",
".",
"This",
"code",
"raises",
"IOError",
"on",
"error",
"."
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/inout/output.py#L37-L52 | [
"def",
"open",
"(",
"self",
",",
"output",
",",
"opts",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"output",
",",
"io",
".",
"TextIOWrapper",
")",
"or",
"isinstance",
"(",
"output",
",",
"io",
".",
"StringIO",
")",
"or",
"output",
"==",
"sys",
... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | DebuggerUserOutput.write | This method the debugger uses to write. In contrast to
writeline, no newline is added to the end to `str'. | trepan/inout/output.py | def write(self, msg):
""" This method the debugger uses to write. In contrast to
writeline, no newline is added to the end to `str'.
"""
if self.output.closed:
raise IOError("writing %s on a closed file" % msg)
self.output.write(msg)
if self.flush_after_write:... | def write(self, msg):
""" This method the debugger uses to write. In contrast to
writeline, no newline is added to the end to `str'.
"""
if self.output.closed:
raise IOError("writing %s on a closed file" % msg)
self.output.write(msg)
if self.flush_after_write:... | [
"This",
"method",
"the",
"debugger",
"uses",
"to",
"write",
".",
"In",
"contrast",
"to",
"writeline",
"no",
"newline",
"is",
"added",
"to",
"the",
"end",
"to",
"str",
"."
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/inout/output.py#L54-L62 | [
"def",
"write",
"(",
"self",
",",
"msg",
")",
":",
"if",
"self",
".",
"output",
".",
"closed",
":",
"raise",
"IOError",
"(",
"\"writing %s on a closed file\"",
"%",
"msg",
")",
"self",
".",
"output",
".",
"write",
"(",
"msg",
")",
"if",
"self",
".",
... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | lookup_signame | Find the corresponding signal name for 'num'. Return None
if 'num' is invalid. | trepan/lib/sighandler.py | def lookup_signame(num):
"""Find the corresponding signal name for 'num'. Return None
if 'num' is invalid."""
signames = signal.__dict__
num = abs(num)
for signame in list(signames.keys()):
if signame.startswith('SIG') and signames[signame] == num:
return signame
pass
... | def lookup_signame(num):
"""Find the corresponding signal name for 'num'. Return None
if 'num' is invalid."""
signames = signal.__dict__
num = abs(num)
for signame in list(signames.keys()):
if signame.startswith('SIG') and signames[signame] == num:
return signame
pass
... | [
"Find",
"the",
"corresponding",
"signal",
"name",
"for",
"num",
".",
"Return",
"None",
"if",
"num",
"is",
"invalid",
"."
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/lib/sighandler.py#L36-L46 | [
"def",
"lookup_signame",
"(",
"num",
")",
":",
"signames",
"=",
"signal",
".",
"__dict__",
"num",
"=",
"abs",
"(",
"num",
")",
"for",
"signame",
"in",
"list",
"(",
"signames",
".",
"keys",
"(",
")",
")",
":",
"if",
"signame",
".",
"startswith",
"(",
... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | lookup_signum | Find the corresponding signal number for 'name'. Return None
if 'name' is invalid. | trepan/lib/sighandler.py | def lookup_signum(name):
"""Find the corresponding signal number for 'name'. Return None
if 'name' is invalid."""
uname = name.upper()
if (uname.startswith('SIG') and hasattr(signal, uname)):
return getattr(signal, uname)
else:
uname = "SIG"+uname
if hasattr(signal, uname):
... | def lookup_signum(name):
"""Find the corresponding signal number for 'name'. Return None
if 'name' is invalid."""
uname = name.upper()
if (uname.startswith('SIG') and hasattr(signal, uname)):
return getattr(signal, uname)
else:
uname = "SIG"+uname
if hasattr(signal, uname):
... | [
"Find",
"the",
"corresponding",
"signal",
"number",
"for",
"name",
".",
"Return",
"None",
"if",
"name",
"is",
"invalid",
"."
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/lib/sighandler.py#L49-L60 | [
"def",
"lookup_signum",
"(",
"name",
")",
":",
"uname",
"=",
"name",
".",
"upper",
"(",
")",
"if",
"(",
"uname",
".",
"startswith",
"(",
"'SIG'",
")",
"and",
"hasattr",
"(",
"signal",
",",
"uname",
")",
")",
":",
"return",
"getattr",
"(",
"signal",
... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | canonic_signame | Return a signal name for a signal name or signal
number. Return None is name_num is an int but not a valid signal
number and False if name_num is a not number. If name_num is a
signal name or signal number, the canonic if name is returned. | trepan/lib/sighandler.py | def canonic_signame(name_num):
"""Return a signal name for a signal name or signal
number. Return None is name_num is an int but not a valid signal
number and False if name_num is a not number. If name_num is a
signal name or signal number, the canonic if name is returned."""
signum = lookup_signum... | def canonic_signame(name_num):
"""Return a signal name for a signal name or signal
number. Return None is name_num is an int but not a valid signal
number and False if name_num is a not number. If name_num is a
signal name or signal number, the canonic if name is returned."""
signum = lookup_signum... | [
"Return",
"a",
"signal",
"name",
"for",
"a",
"signal",
"name",
"or",
"signal",
"number",
".",
"Return",
"None",
"is",
"name_num",
"is",
"an",
"int",
"but",
"not",
"a",
"valid",
"signal",
"number",
"and",
"False",
"if",
"name_num",
"is",
"a",
"not",
"nu... | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/lib/sighandler.py#L63-L82 | [
"def",
"canonic_signame",
"(",
"name_num",
")",
":",
"signum",
"=",
"lookup_signum",
"(",
"name_num",
")",
"if",
"signum",
"is",
"None",
":",
"# Maybe signame is a number?",
"try",
":",
"num",
"=",
"int",
"(",
"name_num",
")",
"signame",
"=",
"lookup_signame",... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | SignalManager.set_signal_replacement | A replacement for signal.signal which chains the signal behind
the debugger's handler | trepan/lib/sighandler.py | def set_signal_replacement(self, signum, handle):
"""A replacement for signal.signal which chains the signal behind
the debugger's handler"""
signame = lookup_signame(signum)
if signame is None:
self.dbgr.intf[-1].errmsg(("%s is not a signal number"
... | def set_signal_replacement(self, signum, handle):
"""A replacement for signal.signal which chains the signal behind
the debugger's handler"""
signame = lookup_signame(signum)
if signame is None:
self.dbgr.intf[-1].errmsg(("%s is not a signal number"
... | [
"A",
"replacement",
"for",
"signal",
".",
"signal",
"which",
"chains",
"the",
"signal",
"behind",
"the",
"debugger",
"s",
"handler"
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/lib/sighandler.py#L221-L235 | [
"def",
"set_signal_replacement",
"(",
"self",
",",
"signum",
",",
"handle",
")",
":",
"signame",
"=",
"lookup_signame",
"(",
"signum",
")",
"if",
"signame",
"is",
"None",
":",
"self",
".",
"dbgr",
".",
"intf",
"[",
"-",
"1",
"]",
".",
"errmsg",
"(",
... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | SignalManager.check_and_adjust_sighandler | Check to see if a single signal handler that we are interested
in has changed or has not been set initially. On return
self.sigs[signame] should have our signal handler. True is
returned if the same or adjusted, False or None if error or
not found. | trepan/lib/sighandler.py | def check_and_adjust_sighandler(self, signame, sigs):
"""
Check to see if a single signal handler that we are interested
in has changed or has not been set initially. On return
self.sigs[signame] should have our signal handler. True is
returned if the same or adjusted, False or N... | def check_and_adjust_sighandler(self, signame, sigs):
"""
Check to see if a single signal handler that we are interested
in has changed or has not been set initially. On return
self.sigs[signame] should have our signal handler. True is
returned if the same or adjusted, False or N... | [
"Check",
"to",
"see",
"if",
"a",
"single",
"signal",
"handler",
"that",
"we",
"are",
"interested",
"in",
"has",
"changed",
"or",
"has",
"not",
"been",
"set",
"initially",
".",
"On",
"return",
"self",
".",
"sigs",
"[",
"signame",
"]",
"should",
"have",
... | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/lib/sighandler.py#L237-L273 | [
"def",
"check_and_adjust_sighandler",
"(",
"self",
",",
"signame",
",",
"sigs",
")",
":",
"signum",
"=",
"lookup_signum",
"(",
"signame",
")",
"try",
":",
"old_handler",
"=",
"signal",
".",
"getsignal",
"(",
"signum",
")",
"except",
"ValueError",
":",
"# On ... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | SignalManager.check_and_adjust_sighandlers | Check to see if any of the signal handlers we are interested in have
changed or is not initially set. Change any that are not right. | trepan/lib/sighandler.py | def check_and_adjust_sighandlers(self):
"""Check to see if any of the signal handlers we are interested in have
changed or is not initially set. Change any that are not right. """
for signame in list(self.sigs.keys()):
if not self.check_and_adjust_sighandler(signame, self.sigs):
... | def check_and_adjust_sighandlers(self):
"""Check to see if any of the signal handlers we are interested in have
changed or is not initially set. Change any that are not right. """
for signame in list(self.sigs.keys()):
if not self.check_and_adjust_sighandler(signame, self.sigs):
... | [
"Check",
"to",
"see",
"if",
"any",
"of",
"the",
"signal",
"handlers",
"we",
"are",
"interested",
"in",
"have",
"changed",
"or",
"is",
"not",
"initially",
"set",
".",
"Change",
"any",
"that",
"are",
"not",
"right",
"."
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/lib/sighandler.py#L275-L282 | [
"def",
"check_and_adjust_sighandlers",
"(",
"self",
")",
":",
"for",
"signame",
"in",
"list",
"(",
"self",
".",
"sigs",
".",
"keys",
"(",
")",
")",
":",
"if",
"not",
"self",
".",
"check_and_adjust_sighandler",
"(",
"signame",
",",
"self",
".",
"sigs",
")... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | SignalManager.print_info_signal_entry | Print status for a single signal name (signame) | trepan/lib/sighandler.py | def print_info_signal_entry(self, signame):
"""Print status for a single signal name (signame)"""
if signame in signal_description:
description=signal_description[signame]
else:
description=""
pass
if signame not in list(self.sigs.keys()):
... | def print_info_signal_entry(self, signame):
"""Print status for a single signal name (signame)"""
if signame in signal_description:
description=signal_description[signame]
else:
description=""
pass
if signame not in list(self.sigs.keys()):
... | [
"Print",
"status",
"for",
"a",
"single",
"signal",
"name",
"(",
"signame",
")"
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/lib/sighandler.py#L296-L318 | [
"def",
"print_info_signal_entry",
"(",
"self",
",",
"signame",
")",
":",
"if",
"signame",
"in",
"signal_description",
":",
"description",
"=",
"signal_description",
"[",
"signame",
"]",
"else",
":",
"description",
"=",
"\"\"",
"pass",
"if",
"signame",
"not",
"... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | SignalManager.info_signal | Print information about a signal | trepan/lib/sighandler.py | def info_signal(self, args):
"""Print information about a signal"""
if len(args) == 0: return None
signame = args[0]
if signame in ['handle', 'signal']:
# This has come from dbgr's info command
if len(args) == 1:
# Show all signal handlers
... | def info_signal(self, args):
"""Print information about a signal"""
if len(args) == 0: return None
signame = args[0]
if signame in ['handle', 'signal']:
# This has come from dbgr's info command
if len(args) == 1:
# Show all signal handlers
... | [
"Print",
"information",
"about",
"a",
"signal"
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/lib/sighandler.py#L320-L340 | [
"def",
"info_signal",
"(",
"self",
",",
"args",
")",
":",
"if",
"len",
"(",
"args",
")",
"==",
"0",
":",
"return",
"None",
"signame",
"=",
"args",
"[",
"0",
"]",
"if",
"signame",
"in",
"[",
"'handle'",
",",
"'signal'",
"]",
":",
"# This has come from... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | SignalManager.action | Delegate the actions specified in 'arg' to another
method. | trepan/lib/sighandler.py | def action(self, arg):
"""Delegate the actions specified in 'arg' to another
method.
"""
if not arg:
self.info_signal(['handle'])
return True
args = arg.split()
signame = args[0]
signame = self.is_name_or_number(args[0])
if not sign... | def action(self, arg):
"""Delegate the actions specified in 'arg' to another
method.
"""
if not arg:
self.info_signal(['handle'])
return True
args = arg.split()
signame = args[0]
signame = self.is_name_or_number(args[0])
if not sign... | [
"Delegate",
"the",
"actions",
"specified",
"in",
"arg",
"to",
"another",
"method",
"."
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/lib/sighandler.py#L342-L387 | [
"def",
"action",
"(",
"self",
",",
"arg",
")",
":",
"if",
"not",
"arg",
":",
"self",
".",
"info_signal",
"(",
"[",
"'handle'",
"]",
")",
"return",
"True",
"args",
"=",
"arg",
".",
"split",
"(",
")",
"signame",
"=",
"args",
"[",
"0",
"]",
"signame... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | SignalManager.handle_print_stack | Set whether we stop or not when this signal is caught.
If 'set_stop' is True your program will stop when this signal
happens. | trepan/lib/sighandler.py | def handle_print_stack(self, signame, print_stack):
"""Set whether we stop or not when this signal is caught.
If 'set_stop' is True your program will stop when this signal
happens."""
self.sigs[signame].print_stack = print_stack
return print_stack | def handle_print_stack(self, signame, print_stack):
"""Set whether we stop or not when this signal is caught.
If 'set_stop' is True your program will stop when this signal
happens."""
self.sigs[signame].print_stack = print_stack
return print_stack | [
"Set",
"whether",
"we",
"stop",
"or",
"not",
"when",
"this",
"signal",
"is",
"caught",
".",
"If",
"set_stop",
"is",
"True",
"your",
"program",
"will",
"stop",
"when",
"this",
"signal",
"happens",
"."
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/lib/sighandler.py#L389-L394 | [
"def",
"handle_print_stack",
"(",
"self",
",",
"signame",
",",
"print_stack",
")",
":",
"self",
".",
"sigs",
"[",
"signame",
"]",
".",
"print_stack",
"=",
"print_stack",
"return",
"print_stack"
] | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | SignalManager.handle_stop | Set whether we stop or not when this signal is caught.
If 'set_stop' is True your program will stop when this signal
happens. | trepan/lib/sighandler.py | def handle_stop(self, signame, set_stop):
"""Set whether we stop or not when this signal is caught.
If 'set_stop' is True your program will stop when this signal
happens."""
if set_stop:
self.sigs[signame].b_stop = True
# stop keyword implies print AND nopas... | def handle_stop(self, signame, set_stop):
"""Set whether we stop or not when this signal is caught.
If 'set_stop' is True your program will stop when this signal
happens."""
if set_stop:
self.sigs[signame].b_stop = True
# stop keyword implies print AND nopas... | [
"Set",
"whether",
"we",
"stop",
"or",
"not",
"when",
"this",
"signal",
"is",
"caught",
".",
"If",
"set_stop",
"is",
"True",
"your",
"program",
"will",
"stop",
"when",
"this",
"signal",
"happens",
"."
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/lib/sighandler.py#L396-L408 | [
"def",
"handle_stop",
"(",
"self",
",",
"signame",
",",
"set_stop",
")",
":",
"if",
"set_stop",
":",
"self",
".",
"sigs",
"[",
"signame",
"]",
".",
"b_stop",
"=",
"True",
"# stop keyword implies print AND nopass",
"self",
".",
"sigs",
"[",
"signame",
"]",
... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | SignalManager.handle_pass | Set whether we pass this signal to the program (or not)
when this signal is caught. If set_pass is True, Dbgr should allow
your program to see this signal. | trepan/lib/sighandler.py | def handle_pass(self, signame, set_pass):
"""Set whether we pass this signal to the program (or not)
when this signal is caught. If set_pass is True, Dbgr should allow
your program to see this signal.
"""
self.sigs[signame].pass_along = set_pass
if set_pass:
#... | def handle_pass(self, signame, set_pass):
"""Set whether we pass this signal to the program (or not)
when this signal is caught. If set_pass is True, Dbgr should allow
your program to see this signal.
"""
self.sigs[signame].pass_along = set_pass
if set_pass:
#... | [
"Set",
"whether",
"we",
"pass",
"this",
"signal",
"to",
"the",
"program",
"(",
"or",
"not",
")",
"when",
"this",
"signal",
"is",
"caught",
".",
"If",
"set_pass",
"is",
"True",
"Dbgr",
"should",
"allow",
"your",
"program",
"to",
"see",
"this",
"signal",
... | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/lib/sighandler.py#L410-L420 | [
"def",
"handle_pass",
"(",
"self",
",",
"signame",
",",
"set_pass",
")",
":",
"self",
".",
"sigs",
"[",
"signame",
"]",
".",
"pass_along",
"=",
"set_pass",
"if",
"set_pass",
":",
"# Pass implies nostop",
"self",
".",
"sigs",
"[",
"signame",
"]",
".",
"b_... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | SignalManager.handle_print | Set whether we print or not when this signal is caught. | trepan/lib/sighandler.py | def handle_print(self, signame, set_print):
"""Set whether we print or not when this signal is caught."""
if set_print:
self.sigs[signame].print_method = self.dbgr.intf[-1].msg
else:
self.sigs[signame].print_method = None
pass
return set_print | def handle_print(self, signame, set_print):
"""Set whether we print or not when this signal is caught."""
if set_print:
self.sigs[signame].print_method = self.dbgr.intf[-1].msg
else:
self.sigs[signame].print_method = None
pass
return set_print | [
"Set",
"whether",
"we",
"print",
"or",
"not",
"when",
"this",
"signal",
"is",
"caught",
"."
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/lib/sighandler.py#L428-L435 | [
"def",
"handle_print",
"(",
"self",
",",
"signame",
",",
"set_print",
")",
":",
"if",
"set_print",
":",
"self",
".",
"sigs",
"[",
"signame",
"]",
".",
"print_method",
"=",
"self",
".",
"dbgr",
".",
"intf",
"[",
"-",
"1",
"]",
".",
"msg",
"else",
":... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | SigHandler.handle | This method is called when a signal is received. | trepan/lib/sighandler.py | def handle(self, signum, frame):
"""This method is called when a signal is received."""
if self.print_method:
self.print_method('\nProgram received signal %s.'
% self.signame)
if self.print_stack:
import traceback
strings = traceb... | def handle(self, signum, frame):
"""This method is called when a signal is received."""
if self.print_method:
self.print_method('\nProgram received signal %s.'
% self.signame)
if self.print_stack:
import traceback
strings = traceb... | [
"This",
"method",
"is",
"called",
"when",
"a",
"signal",
"is",
"received",
"."
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/lib/sighandler.py#L466-L494 | [
"def",
"handle",
"(",
"self",
",",
"signum",
",",
"frame",
")",
":",
"if",
"self",
".",
"print_method",
":",
"self",
".",
"print_method",
"(",
"'\\nProgram received signal %s.'",
"%",
"self",
".",
"signame",
")",
"if",
"self",
".",
"print_stack",
":",
"imp... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | is_ok_line_for_breakpoint | 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. | trepan/clifns.py | def is_ok_line_for_breakpoint(filename, lineno, errmsg_fn):
"""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.
"""
line = linecache.getline(filename, lineno)
if not lin... | def is_ok_line_for_breakpoint(filename, lineno, errmsg_fn):
"""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.
"""
line = linecache.getline(filename, lineno)
if not lin... | [
"Check",
"whether",
"specified",
"line",
"seems",
"to",
"be",
"executable",
"."
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/clifns.py#L21-L37 | [
"def",
"is_ok_line_for_breakpoint",
"(",
"filename",
",",
"lineno",
",",
"errmsg_fn",
")",
":",
"line",
"=",
"linecache",
".",
"getline",
"(",
"filename",
",",
"lineno",
")",
"if",
"not",
"line",
":",
"errmsg_fn",
"(",
"'End of file'",
")",
"return",
"False"... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | file2module | Given a file name, extract the most likely module name. | trepan/clifns.py | def file2module(filename):
"""Given a file name, extract the most likely module name. """
basename = osp.basename(filename)
if '.' in basename:
pos = basename.rfind('.')
return basename[:pos]
else:
return basename
return None | def file2module(filename):
"""Given a file name, extract the most likely module name. """
basename = osp.basename(filename)
if '.' in basename:
pos = basename.rfind('.')
return basename[:pos]
else:
return basename
return None | [
"Given",
"a",
"file",
"name",
"extract",
"the",
"most",
"likely",
"module",
"name",
"."
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/clifns.py#L40-L48 | [
"def",
"file2module",
"(",
"filename",
")",
":",
"basename",
"=",
"osp",
".",
"basename",
"(",
"filename",
")",
"if",
"'.'",
"in",
"basename",
":",
"pos",
"=",
"basename",
".",
"rfind",
"(",
"'.'",
")",
"return",
"basename",
"[",
":",
"pos",
"]",
"el... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | search_file | Return a full pathname for filename if we can find one. path
is a list of directories to prepend to filename. If no file is
found we'll return None | trepan/clifns.py | def search_file(filename, directories, cdir):
"""Return a full pathname for filename if we can find one. path
is a list of directories to prepend to filename. If no file is
found we'll return None"""
for trydir in directories:
# Handle $cwd and $cdir
if trydir =='$cwd': trydir='.'
... | def search_file(filename, directories, cdir):
"""Return a full pathname for filename if we can find one. path
is a list of directories to prepend to filename. If no file is
found we'll return None"""
for trydir in directories:
# Handle $cwd and $cdir
if trydir =='$cwd': trydir='.'
... | [
"Return",
"a",
"full",
"pathname",
"for",
"filename",
"if",
"we",
"can",
"find",
"one",
".",
"path",
"is",
"a",
"list",
"of",
"directories",
"to",
"prepend",
"to",
"filename",
".",
"If",
"no",
"file",
"is",
"found",
"we",
"ll",
"return",
"None"
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/clifns.py#L51-L65 | [
"def",
"search_file",
"(",
"filename",
",",
"directories",
",",
"cdir",
")",
":",
"for",
"trydir",
"in",
"directories",
":",
"# Handle $cwd and $cdir",
"if",
"trydir",
"==",
"'$cwd'",
":",
"trydir",
"=",
"'.'",
"elif",
"trydir",
"==",
"'$cdir'",
":",
"trydir... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | whence_file | Do a shell-like path lookup for py_script and return the results.
If we can't find anything return py_script | trepan/clifns.py | def whence_file(py_script, dirnames=None):
"""Do a shell-like path lookup for py_script and return the results.
If we can't find anything return py_script"""
if py_script.find(os.sep) != -1:
# Don't search since this name has path separator components
return py_script
if dirnames is None... | def whence_file(py_script, dirnames=None):
"""Do a shell-like path lookup for py_script and return the results.
If we can't find anything return py_script"""
if py_script.find(os.sep) != -1:
# Don't search since this name has path separator components
return py_script
if dirnames is None... | [
"Do",
"a",
"shell",
"-",
"like",
"path",
"lookup",
"for",
"py_script",
"and",
"return",
"the",
"results",
".",
"If",
"we",
"can",
"t",
"find",
"anything",
"return",
"py_script"
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/clifns.py#L68-L81 | [
"def",
"whence_file",
"(",
"py_script",
",",
"dirnames",
"=",
"None",
")",
":",
"if",
"py_script",
".",
"find",
"(",
"os",
".",
"sep",
")",
"!=",
"-",
"1",
":",
"# Don't search since this name has path separator components",
"return",
"py_script",
"if",
"dirname... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | print_obj | Return a string representation of an object | trepan/lib/printing.py | def print_obj(arg, frame, format=None, short=False):
"""Return a string representation of an object """
try:
if not frame:
# ?? Should we have set up a dummy globals
# to have persistence?
obj = eval(arg, None, None)
else:
obj = eval(arg, frame.f_g... | def print_obj(arg, frame, format=None, short=False):
"""Return a string representation of an object """
try:
if not frame:
# ?? Should we have set up a dummy globals
# to have persistence?
obj = eval(arg, None, None)
else:
obj = eval(arg, frame.f_g... | [
"Return",
"a",
"string",
"representation",
"of",
"an",
"object"
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/lib/printing.py#L44-L84 | [
"def",
"print_obj",
"(",
"arg",
",",
"frame",
",",
"format",
"=",
"None",
",",
"short",
"=",
"False",
")",
":",
"try",
":",
"if",
"not",
"frame",
":",
"# ?? Should we have set up a dummy globals",
"# to have persistence?",
"obj",
"=",
"eval",
"(",
"arg",
","... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | pyfiles | All python files caller's dir without the path and trailing .py | trepan/misc.py | def pyfiles(callername, level=2):
"All python files caller's dir without the path and trailing .py"
d = os.path.dirname(callername)
# Get the name of our directory.
# A glob pattern that will get all *.py files but not __init__.py
glob(os.path.join(d, '[a-zA-Z]*.py'))
py_files = glob(os.path.joi... | def pyfiles(callername, level=2):
"All python files caller's dir without the path and trailing .py"
d = os.path.dirname(callername)
# Get the name of our directory.
# A glob pattern that will get all *.py files but not __init__.py
glob(os.path.join(d, '[a-zA-Z]*.py'))
py_files = glob(os.path.joi... | [
"All",
"python",
"files",
"caller",
"s",
"dir",
"without",
"the",
"path",
"and",
"trailing",
".",
"py"
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/misc.py#L42-L49 | [
"def",
"pyfiles",
"(",
"callername",
",",
"level",
"=",
"2",
")",
":",
"d",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"callername",
")",
"# Get the name of our directory.",
"# A glob pattern that will get all *.py files but not __init__.py",
"glob",
"(",
"os",
".... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | BWProcessor.adjust_frame | Adjust stack frame by pos positions. If absolute_pos then
pos is an absolute number. Otherwise it is a relative number.
A negative number indexes from the other end. | trepan/bwprocessor/main.py | def adjust_frame(self, pos, absolute_pos):
"""Adjust stack frame by pos positions. If absolute_pos then
pos is an absolute number. Otherwise it is a relative number.
A negative number indexes from the other end."""
if not self.curframe:
Mmsg.errmsg(self, "No stack.")
... | def adjust_frame(self, pos, absolute_pos):
"""Adjust stack frame by pos positions. If absolute_pos then
pos is an absolute number. Otherwise it is a relative number.
A negative number indexes from the other end."""
if not self.curframe:
Mmsg.errmsg(self, "No stack.")
... | [
"Adjust",
"stack",
"frame",
"by",
"pos",
"positions",
".",
"If",
"absolute_pos",
"then",
"pos",
"is",
"an",
"absolute",
"number",
".",
"Otherwise",
"it",
"is",
"a",
"relative",
"number",
"."
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/bwprocessor/main.py#L141-L173 | [
"def",
"adjust_frame",
"(",
"self",
",",
"pos",
",",
"absolute_pos",
")",
":",
"if",
"not",
"self",
".",
"curframe",
":",
"Mmsg",
".",
"errmsg",
"(",
"self",
",",
"\"No stack.\"",
")",
"return",
"# Below we remove any negativity. At the end, pos will be",
"# the n... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | BWProcessor.ok_for_running | We separate some of the common debugger command checks here:
whether it makes sense to run the command in this execution state,
if the command has the right number of arguments and so on. | trepan/bwprocessor/main.py | def ok_for_running(self, cmd_obj, name, cmd_hash):
'''We separate some of the common debugger command checks here:
whether it makes sense to run the command in this execution state,
if the command has the right number of arguments and so on.
'''
if hasattr(cmd_obj, 'execution_set... | def ok_for_running(self, cmd_obj, name, cmd_hash):
'''We separate some of the common debugger command checks here:
whether it makes sense to run the command in this execution state,
if the command has the right number of arguments and so on.
'''
if hasattr(cmd_obj, 'execution_set... | [
"We",
"separate",
"some",
"of",
"the",
"common",
"debugger",
"command",
"checks",
"here",
":",
"whether",
"it",
"makes",
"sense",
"to",
"run",
"the",
"command",
"in",
"this",
"execution",
"state",
"if",
"the",
"command",
"has",
"the",
"right",
"number",
"o... | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/bwprocessor/main.py#L259-L279 | [
"def",
"ok_for_running",
"(",
"self",
",",
"cmd_obj",
",",
"name",
",",
"cmd_hash",
")",
":",
"if",
"hasattr",
"(",
"cmd_obj",
",",
"'execution_set'",
")",
":",
"if",
"not",
"(",
"self",
".",
"core",
".",
"execution_status",
"in",
"cmd_obj",
".",
"execut... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | BWProcessor.setup | Initialization done before entering the debugger-command
loop. In particular we set up the call stack used for local
variable lookup and frame/up/down commands.
We return True if we should NOT enter the debugger-command
loop. | trepan/bwprocessor/main.py | def setup(self):
"""Initialization done before entering the debugger-command
loop. In particular we set up the call stack used for local
variable lookup and frame/up/down commands.
We return True if we should NOT enter the debugger-command
loop."""
self.forget()
... | def setup(self):
"""Initialization done before entering the debugger-command
loop. In particular we set up the call stack used for local
variable lookup and frame/up/down commands.
We return True if we should NOT enter the debugger-command
loop."""
self.forget()
... | [
"Initialization",
"done",
"before",
"entering",
"the",
"debugger",
"-",
"command",
"loop",
".",
"In",
"particular",
"we",
"set",
"up",
"the",
"call",
"stack",
"used",
"for",
"local",
"variable",
"lookup",
"and",
"frame",
"/",
"up",
"/",
"down",
"commands",
... | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/bwprocessor/main.py#L370-L403 | [
"def",
"setup",
"(",
"self",
")",
":",
"self",
".",
"forget",
"(",
")",
"if",
"self",
".",
"settings",
"(",
"'dbg_trepan'",
")",
":",
"self",
".",
"frame",
"=",
"inspect",
".",
"currentframe",
"(",
")",
"pass",
"if",
"self",
".",
"event",
"in",
"["... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | BWProcessor._populate_commands | Create an instance of each of the debugger
commands. Commands are found by importing files in the
directory 'command'. Some files are excluded via an array set
in __init__. For each of the remaining files, we import them
and scan for class names inside those files and for each class
... | trepan/bwprocessor/main.py | def _populate_commands(self):
""" Create an instance of each of the debugger
commands. Commands are found by importing files in the
directory 'command'. Some files are excluded via an array set
in __init__. For each of the remaining files, we import them
and scan for class names... | def _populate_commands(self):
""" Create an instance of each of the debugger
commands. Commands are found by importing files in the
directory 'command'. Some files are excluded via an array set
in __init__. For each of the remaining files, we import them
and scan for class names... | [
"Create",
"an",
"instance",
"of",
"each",
"of",
"the",
"debugger",
"commands",
".",
"Commands",
"are",
"found",
"by",
"importing",
"files",
"in",
"the",
"directory",
"command",
".",
"Some",
"files",
"are",
"excluded",
"via",
"an",
"array",
"set",
"in",
"__... | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/bwprocessor/main.py#L410-L445 | [
"def",
"_populate_commands",
"(",
"self",
")",
":",
"cmd_instances",
"=",
"[",
"]",
"from",
"trepan",
".",
"bwprocessor",
"import",
"command",
"as",
"Mcommand",
"eval_cmd_template",
"=",
"'command_mod.%s(self)'",
"for",
"mod_name",
"in",
"Mcommand",
".",
"__module... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | BWProcessor._populate_cmd_lists | Populate self.commands | trepan/bwprocessor/main.py | def _populate_cmd_lists(self):
""" Populate self.commands"""
self.commands = {}
for cmd_instance in self.cmd_instances:
cmd_name = cmd_instance.name
self.commands[cmd_name] = cmd_instance
pass
return | def _populate_cmd_lists(self):
""" Populate self.commands"""
self.commands = {}
for cmd_instance in self.cmd_instances:
cmd_name = cmd_instance.name
self.commands[cmd_name] = cmd_instance
pass
return | [
"Populate",
"self",
".",
"commands"
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/bwprocessor/main.py#L447-L454 | [
"def",
"_populate_cmd_lists",
"(",
"self",
")",
":",
"self",
".",
"commands",
"=",
"{",
"}",
"for",
"cmd_instance",
"in",
"self",
".",
"cmd_instances",
":",
"cmd_name",
"=",
"cmd_instance",
".",
"name",
"self",
".",
"commands",
"[",
"cmd_name",
"]",
"=",
... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | format_location | Show where we are. GUI's and front-end interfaces often
use this to update displays. So it is helpful to make sure
we give at least some place that's located in a file. | trepan/bwprocessor/location.py | def format_location(proc_obj):
"""Show where we are. GUI's and front-end interfaces often
use this to update displays. So it is helpful to make sure
we give at least some place that's located in a file.
"""
i_stack = proc_obj.curindex
if i_stack is None or proc_obj.stack is None:
return ... | def format_location(proc_obj):
"""Show where we are. GUI's and front-end interfaces often
use this to update displays. So it is helpful to make sure
we give at least some place that's located in a file.
"""
i_stack = proc_obj.curindex
if i_stack is None or proc_obj.stack is None:
return ... | [
"Show",
"where",
"we",
"are",
".",
"GUI",
"s",
"and",
"front",
"-",
"end",
"interfaces",
"often",
"use",
"this",
"to",
"update",
"displays",
".",
"So",
"it",
"is",
"helpful",
"to",
"make",
"sure",
"we",
"give",
"at",
"least",
"some",
"place",
"that",
... | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/bwprocessor/location.py#L9-L65 | [
"def",
"format_location",
"(",
"proc_obj",
")",
":",
"i_stack",
"=",
"proc_obj",
".",
"curindex",
"if",
"i_stack",
"is",
"None",
"or",
"proc_obj",
".",
"stack",
"is",
"None",
":",
"return",
"False",
"location",
"=",
"{",
"}",
"core_obj",
"=",
"proc_obj",
... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | TrepanInterface.msg | used to write to a debugger that is connected to this
server; `str' written will have a newline added to it | trepan/interface.py | def msg(self, msg):
""" used to write to a debugger that is connected to this
server; `str' written will have a newline added to it
"""
if hasattr(self.output, 'writeline'):
self.output.writeline(msg)
elif hasattr(self.output, 'writelines'):
self.output.wr... | def msg(self, msg):
""" used to write to a debugger that is connected to this
server; `str' written will have a newline added to it
"""
if hasattr(self.output, 'writeline'):
self.output.writeline(msg)
elif hasattr(self.output, 'writelines'):
self.output.wr... | [
"used",
"to",
"write",
"to",
"a",
"debugger",
"that",
"is",
"connected",
"to",
"this",
"server",
";",
"str",
"written",
"will",
"have",
"a",
"newline",
"added",
"to",
"it"
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/interface.py#L57-L66 | [
"def",
"msg",
"(",
"self",
",",
"msg",
")",
":",
"if",
"hasattr",
"(",
"self",
".",
"output",
",",
"'writeline'",
")",
":",
"self",
".",
"output",
".",
"writeline",
"(",
"msg",
")",
"elif",
"hasattr",
"(",
"self",
".",
"output",
",",
"'writelines'",
... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | InfoProgram.run | Execution status of the program. | trepan/processor/command/info_subcmd/program.py | def run(self, args):
"""Execution status of the program."""
mainfile = self.core.filename(None)
if self.core.is_running():
if mainfile:
part1 = "Python program '%s' is stopped" % mainfile
else:
part1 = 'Program is stopped'
p... | def run(self, args):
"""Execution status of the program."""
mainfile = self.core.filename(None)
if self.core.is_running():
if mainfile:
part1 = "Python program '%s' is stopped" % mainfile
else:
part1 = 'Program is stopped'
p... | [
"Execution",
"status",
"of",
"the",
"program",
"."
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/command/info_subcmd/program.py#L42-L91 | [
"def",
"run",
"(",
"self",
",",
"args",
")",
":",
"mainfile",
"=",
"self",
".",
"core",
".",
"filename",
"(",
"None",
")",
"if",
"self",
".",
"core",
".",
"is_running",
"(",
")",
":",
"if",
"mainfile",
":",
"part1",
"=",
"\"Python program '%s' is stopp... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | DebuggerCommand.columnize_commands | List commands arranged in an aligned columns | trepan/processor/command/base_cmd.py | def columnize_commands(self, commands):
"""List commands arranged in an aligned columns"""
commands.sort()
width = self.debugger.settings['width']
return columnize.columnize(commands, displaywidth=width,
lineprefix=' ') | def columnize_commands(self, commands):
"""List commands arranged in an aligned columns"""
commands.sort()
width = self.debugger.settings['width']
return columnize.columnize(commands, displaywidth=width,
lineprefix=' ') | [
"List",
"commands",
"arranged",
"in",
"an",
"aligned",
"columns"
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/command/base_cmd.py#L58-L63 | [
"def",
"columnize_commands",
"(",
"self",
",",
"commands",
")",
":",
"commands",
".",
"sort",
"(",
")",
"width",
"=",
"self",
".",
"debugger",
".",
"settings",
"[",
"'width'",
"]",
"return",
"columnize",
".",
"columnize",
"(",
"commands",
",",
"displaywidt... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | DebuggerCommand.confirm | Convenience short-hand for self.debugger.intf[-1].confirm | trepan/processor/command/base_cmd.py | def confirm(self, msg, default=False):
""" Convenience short-hand for self.debugger.intf[-1].confirm """
return self.debugger.intf[-1].confirm(msg, default) | def confirm(self, msg, default=False):
""" Convenience short-hand for self.debugger.intf[-1].confirm """
return self.debugger.intf[-1].confirm(msg, default) | [
"Convenience",
"short",
"-",
"hand",
"for",
"self",
".",
"debugger",
".",
"intf",
"[",
"-",
"1",
"]",
".",
"confirm"
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/command/base_cmd.py#L65-L67 | [
"def",
"confirm",
"(",
"self",
",",
"msg",
",",
"default",
"=",
"False",
")",
":",
"return",
"self",
".",
"debugger",
".",
"intf",
"[",
"-",
"1",
"]",
".",
"confirm",
"(",
"msg",
",",
"default",
")"
] | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | DebuggerCommand.errmsg | Convenience short-hand for self.debugger.intf[-1].errmsg | trepan/processor/command/base_cmd.py | def errmsg(self, msg, opts={}):
""" Convenience short-hand for self.debugger.intf[-1].errmsg """
try:
return(self.debugger.intf[-1].errmsg(msg))
except EOFError:
# FIXME: what do we do here?
pass
return None | def errmsg(self, msg, opts={}):
""" Convenience short-hand for self.debugger.intf[-1].errmsg """
try:
return(self.debugger.intf[-1].errmsg(msg))
except EOFError:
# FIXME: what do we do here?
pass
return None | [
"Convenience",
"short",
"-",
"hand",
"for",
"self",
".",
"debugger",
".",
"intf",
"[",
"-",
"1",
"]",
".",
"errmsg"
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/command/base_cmd.py#L75-L82 | [
"def",
"errmsg",
"(",
"self",
",",
"msg",
",",
"opts",
"=",
"{",
"}",
")",
":",
"try",
":",
"return",
"(",
"self",
".",
"debugger",
".",
"intf",
"[",
"-",
"1",
"]",
".",
"errmsg",
"(",
"msg",
")",
")",
"except",
"EOFError",
":",
"# FIXME: what do... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | DebuggerCommand.msg | Convenience short-hand for self.debugger.intf[-1].msg | trepan/processor/command/base_cmd.py | def msg(self, msg, opts={}):
""" Convenience short-hand for self.debugger.intf[-1].msg """
try:
return(self.debugger.intf[-1].msg(msg))
except EOFError:
# FIXME: what do we do here?
pass
return None | def msg(self, msg, opts={}):
""" Convenience short-hand for self.debugger.intf[-1].msg """
try:
return(self.debugger.intf[-1].msg(msg))
except EOFError:
# FIXME: what do we do here?
pass
return None | [
"Convenience",
"short",
"-",
"hand",
"for",
"self",
".",
"debugger",
".",
"intf",
"[",
"-",
"1",
"]",
".",
"msg"
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/command/base_cmd.py#L84-L91 | [
"def",
"msg",
"(",
"self",
",",
"msg",
",",
"opts",
"=",
"{",
"}",
")",
":",
"try",
":",
"return",
"(",
"self",
".",
"debugger",
".",
"intf",
"[",
"-",
"1",
"]",
".",
"msg",
"(",
"msg",
")",
")",
"except",
"EOFError",
":",
"# FIXME: what do we do... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | DebuggerCommand.msg_nocr | Convenience short-hand for self.debugger.intf[-1].msg_nocr | trepan/processor/command/base_cmd.py | def msg_nocr(self, msg, opts={}):
""" Convenience short-hand for self.debugger.intf[-1].msg_nocr """
try:
return(self.debugger.intf[-1].msg_nocr(msg))
except EOFError:
# FIXME: what do we do here?
pass
return None | def msg_nocr(self, msg, opts={}):
""" Convenience short-hand for self.debugger.intf[-1].msg_nocr """
try:
return(self.debugger.intf[-1].msg_nocr(msg))
except EOFError:
# FIXME: what do we do here?
pass
return None | [
"Convenience",
"short",
"-",
"hand",
"for",
"self",
".",
"debugger",
".",
"intf",
"[",
"-",
"1",
"]",
".",
"msg_nocr"
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/command/base_cmd.py#L93-L100 | [
"def",
"msg_nocr",
"(",
"self",
",",
"msg",
",",
"opts",
"=",
"{",
"}",
")",
":",
"try",
":",
"return",
"(",
"self",
".",
"debugger",
".",
"intf",
"[",
"-",
"1",
"]",
".",
"msg_nocr",
"(",
"msg",
")",
")",
"except",
"EOFError",
":",
"# FIXME: wha... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | DebuggerCommand.rst_msg | Convert ReStructuredText and run through msg() | trepan/processor/command/base_cmd.py | def rst_msg(self, text, opts={}):
"""Convert ReStructuredText and run through msg()"""
text = Mformat.rst_text(text,
'plain' == self.debugger.settings['highlight'],
self.debugger.settings['width'])
return self.msg(text) | def rst_msg(self, text, opts={}):
"""Convert ReStructuredText and run through msg()"""
text = Mformat.rst_text(text,
'plain' == self.debugger.settings['highlight'],
self.debugger.settings['width'])
return self.msg(text) | [
"Convert",
"ReStructuredText",
"and",
"run",
"through",
"msg",
"()"
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/command/base_cmd.py#L102-L107 | [
"def",
"rst_msg",
"(",
"self",
",",
"text",
",",
"opts",
"=",
"{",
"}",
")",
":",
"text",
"=",
"Mformat",
".",
"rst_text",
"(",
"text",
",",
"'plain'",
"==",
"self",
".",
"debugger",
".",
"settings",
"[",
"'highlight'",
"]",
",",
"self",
".",
"debu... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | get_last_or_frame_exception | Intended to be used going into post mortem routines. If
sys.last_traceback is set, we will return that and assume that
this is what post-mortem will want. If sys.last_traceback has not
been set, then perhaps we *about* to raise an error and are
fielding an exception. So assume that sys.exc_info()[2]
... | trepan/post_mortem.py | def get_last_or_frame_exception():
"""Intended to be used going into post mortem routines. If
sys.last_traceback is set, we will return that and assume that
this is what post-mortem will want. If sys.last_traceback has not
been set, then perhaps we *about* to raise an error and are
fielding an exce... | def get_last_or_frame_exception():
"""Intended to be used going into post mortem routines. If
sys.last_traceback is set, we will return that and assume that
this is what post-mortem will want. If sys.last_traceback has not
been set, then perhaps we *about* to raise an error and are
fielding an exce... | [
"Intended",
"to",
"be",
"used",
"going",
"into",
"post",
"mortem",
"routines",
".",
"If",
"sys",
".",
"last_traceback",
"is",
"set",
"we",
"will",
"return",
"that",
"and",
"assume",
"that",
"this",
"is",
"what",
"post",
"-",
"mortem",
"will",
"want",
"."... | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/post_mortem.py#L25-L39 | [
"def",
"get_last_or_frame_exception",
"(",
")",
":",
"try",
":",
"if",
"inspect",
".",
"istraceback",
"(",
"sys",
".",
"last_traceback",
")",
":",
"# We do have a traceback so prefer that.",
"return",
"sys",
".",
"last_type",
",",
"sys",
".",
"last_value",
",",
... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | post_mortem | Enter debugger read loop after your program has crashed.
exc is a triple like you get back from sys.exc_info. If no exc
parameter, is supplied, the values from sys.last_type,
sys.last_value, sys.last_traceback are used. And if these don't
exist either we'll assume that sys.exc_info() contains what we
... | trepan/post_mortem.py | def post_mortem(exc=None, frameno=1, dbg=None):
"""Enter debugger read loop after your program has crashed.
exc is a triple like you get back from sys.exc_info. If no exc
parameter, is supplied, the values from sys.last_type,
sys.last_value, sys.last_traceback are used. And if these don't
exist ei... | def post_mortem(exc=None, frameno=1, dbg=None):
"""Enter debugger read loop after your program has crashed.
exc is a triple like you get back from sys.exc_info. If no exc
parameter, is supplied, the values from sys.last_type,
sys.last_value, sys.last_traceback are used. And if these don't
exist ei... | [
"Enter",
"debugger",
"read",
"loop",
"after",
"your",
"program",
"has",
"crashed",
"."
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/post_mortem.py#L80-L168 | [
"def",
"post_mortem",
"(",
"exc",
"=",
"None",
",",
"frameno",
"=",
"1",
",",
"dbg",
"=",
"None",
")",
":",
"if",
"dbg",
"is",
"None",
":",
"# Check for a global debugger object",
"if",
"Mdebugger",
".",
"debugger_obj",
"is",
"None",
":",
"Mdebugger",
".",... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | TCPServer.close | Closes both socket and server connection. | trepan/inout/tcpserver.py | def close(self):
""" Closes both socket and server connection. """
self.state = 'closing'
if self.inout:
self.inout.close()
pass
self.state = 'closing connection'
if self.conn:
self.conn.close()
self.state = 'disconnected'
retur... | def close(self):
""" Closes both socket and server connection. """
self.state = 'closing'
if self.inout:
self.inout.close()
pass
self.state = 'closing connection'
if self.conn:
self.conn.close()
self.state = 'disconnected'
retur... | [
"Closes",
"both",
"socket",
"and",
"server",
"connection",
"."
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/inout/tcpserver.py#L56-L66 | [
"def",
"close",
"(",
"self",
")",
":",
"self",
".",
"state",
"=",
"'closing'",
"if",
"self",
".",
"inout",
":",
"self",
".",
"inout",
".",
"close",
"(",
")",
"pass",
"self",
".",
"state",
"=",
"'closing connection'",
"if",
"self",
".",
"conn",
":",
... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | TCPServer.write | This method the debugger uses to write. In contrast to
writeline, no newline is added to the end to `str'. Also
msg doesn't have to be a string. | trepan/inout/tcpserver.py | def write(self, msg):
""" This method the debugger uses to write. In contrast to
writeline, no newline is added to the end to `str'. Also
msg doesn't have to be a string.
"""
if self.state != 'connected':
self.wait_for_connect()
pass
buffer = Mtcpf... | def write(self, msg):
""" This method the debugger uses to write. In contrast to
writeline, no newline is added to the end to `str'. Also
msg doesn't have to be a string.
"""
if self.state != 'connected':
self.wait_for_connect()
pass
buffer = Mtcpf... | [
"This",
"method",
"the",
"debugger",
"uses",
"to",
"write",
".",
"In",
"contrast",
"to",
"writeline",
"no",
"newline",
"is",
"added",
"to",
"the",
"end",
"to",
"str",
".",
"Also",
"msg",
"doesn",
"t",
"have",
"to",
"be",
"a",
"string",
"."
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/inout/tcpserver.py#L150-L162 | [
"def",
"write",
"(",
"self",
",",
"msg",
")",
":",
"if",
"self",
".",
"state",
"!=",
"'connected'",
":",
"self",
".",
"wait_for_connect",
"(",
")",
"pass",
"buffer",
"=",
"Mtcpfns",
".",
"pack_msg",
"(",
"msg",
")",
"while",
"len",
"(",
"buffer",
")"... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | complete_token_filtered | Find all starting matches in dictionary *aliases* that start
with *prefix*, but filter out any matches already in
*expanded*. | trepan/processor/complete.py | def complete_token_filtered(aliases, prefix, expanded):
"""Find all starting matches in dictionary *aliases* that start
with *prefix*, but filter out any matches already in
*expanded*."""
complete_ary = list(aliases.keys())
results = [cmd for cmd in
complete_ary if cmd.startswith(pr... | def complete_token_filtered(aliases, prefix, expanded):
"""Find all starting matches in dictionary *aliases* that start
with *prefix*, but filter out any matches already in
*expanded*."""
complete_ary = list(aliases.keys())
results = [cmd for cmd in
complete_ary if cmd.startswith(pr... | [
"Find",
"all",
"starting",
"matches",
"in",
"dictionary",
"*",
"aliases",
"*",
"that",
"start",
"with",
"*",
"prefix",
"*",
"but",
"filter",
"out",
"any",
"matches",
"already",
"in",
"*",
"expanded",
"*",
"."
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/complete.py#L22-L32 | [
"def",
"complete_token_filtered",
"(",
"aliases",
",",
"prefix",
",",
"expanded",
")",
":",
"complete_ary",
"=",
"list",
"(",
"aliases",
".",
"keys",
"(",
")",
")",
"results",
"=",
"[",
"cmd",
"for",
"cmd",
"in",
"complete_ary",
"if",
"cmd",
".",
"starts... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | complete_identifier | Complete an arbitrary expression. | trepan/processor/complete.py | def complete_identifier(cmd, prefix):
'''Complete an arbitrary expression.'''
if not cmd.proc.curframe: return [None]
# Collect globals and locals. It is usually not really sensible to also
# complete builtins, and they clutter the namespace quite heavily, so we
# leave them out.
ns = cmd.proc.... | def complete_identifier(cmd, prefix):
'''Complete an arbitrary expression.'''
if not cmd.proc.curframe: return [None]
# Collect globals and locals. It is usually not really sensible to also
# complete builtins, and they clutter the namespace quite heavily, so we
# leave them out.
ns = cmd.proc.... | [
"Complete",
"an",
"arbitrary",
"expression",
"."
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/complete.py#L125-L149 | [
"def",
"complete_identifier",
"(",
"cmd",
",",
"prefix",
")",
":",
"if",
"not",
"cmd",
".",
"proc",
".",
"curframe",
":",
"return",
"[",
"None",
"]",
"# Collect globals and locals. It is usually not really sensible to also",
"# complete builtins, and they clutter the names... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | Processor.errmsg | Convenience short-hand for self.intf[-1].errmsg | trepan/vprocessor.py | def errmsg(self, message, opts={}):
""" Convenience short-hand for self.intf[-1].errmsg """
if 'plain' != self.debugger.settings['highlight']:
message = colorize('standout', message)
pass
return(self.intf[-1].errmsg(message)) | def errmsg(self, message, opts={}):
""" Convenience short-hand for self.intf[-1].errmsg """
if 'plain' != self.debugger.settings['highlight']:
message = colorize('standout', message)
pass
return(self.intf[-1].errmsg(message)) | [
"Convenience",
"short",
"-",
"hand",
"for",
"self",
".",
"intf",
"[",
"-",
"1",
"]",
".",
"errmsg"
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/vprocessor.py#L39-L44 | [
"def",
"errmsg",
"(",
"self",
",",
"message",
",",
"opts",
"=",
"{",
"}",
")",
":",
"if",
"'plain'",
"!=",
"self",
".",
"debugger",
".",
"settings",
"[",
"'highlight'",
"]",
":",
"message",
"=",
"colorize",
"(",
"'standout'",
",",
"message",
")",
"pa... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | Processor.rst_msg | Convert ReStructuredText and run through msg() | trepan/vprocessor.py | def rst_msg(self, text, opts={}):
"""Convert ReStructuredText and run through msg()"""
from trepan.lib.format import rst_text
text = rst_text(text,
'plain' == self.debugger.settings['highlight'],
self.debugger.settings['width'])
return self... | def rst_msg(self, text, opts={}):
"""Convert ReStructuredText and run through msg()"""
from trepan.lib.format import rst_text
text = rst_text(text,
'plain' == self.debugger.settings['highlight'],
self.debugger.settings['width'])
return self... | [
"Convert",
"ReStructuredText",
"and",
"run",
"through",
"msg",
"()"
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/vprocessor.py#L57-L63 | [
"def",
"rst_msg",
"(",
"self",
",",
"text",
",",
"opts",
"=",
"{",
"}",
")",
":",
"from",
"trepan",
".",
"lib",
".",
"format",
"import",
"rst_text",
"text",
"=",
"rst_text",
"(",
"text",
",",
"'plain'",
"==",
"self",
".",
"debugger",
".",
"settings",... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | PythonCommand.dbgr | Invoke a debugger command from inside a python shell called inside
the debugger. | trepan/processor/command/bpy.py | def dbgr(self, string):
'''Invoke a debugger command from inside a python shell called inside
the debugger.
'''
print('')
self.proc.cmd_queue.append(string)
self.proc.process_command()
return | def dbgr(self, string):
'''Invoke a debugger command from inside a python shell called inside
the debugger.
'''
print('')
self.proc.cmd_queue.append(string)
self.proc.process_command()
return | [
"Invoke",
"a",
"debugger",
"command",
"from",
"inside",
"a",
"python",
"shell",
"called",
"inside",
"the",
"debugger",
"."
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/command/bpy.py#L44-L51 | [
"def",
"dbgr",
"(",
"self",
",",
"string",
")",
":",
"print",
"(",
"''",
")",
"self",
".",
"proc",
".",
"cmd_queue",
".",
"append",
"(",
"string",
")",
"self",
".",
"proc",
".",
"process_command",
"(",
")",
"return"
] | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | QuitCommand.nothread_quit | quit command when there's just one thread. | trepan/bwprocessor/command/quit.py | def nothread_quit(self, arg):
""" quit command when there's just one thread. """
self.debugger.core.stop()
self.debugger.core.execution_status = 'Quit command'
self.proc.response['event'] = 'terminated'
self.proc.response['name'] = 'status'
self.proc.intf[-1].msg(self.p... | def nothread_quit(self, arg):
""" quit command when there's just one thread. """
self.debugger.core.stop()
self.debugger.core.execution_status = 'Quit command'
self.proc.response['event'] = 'terminated'
self.proc.response['name'] = 'status'
self.proc.intf[-1].msg(self.p... | [
"quit",
"command",
"when",
"there",
"s",
"just",
"one",
"thread",
"."
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/bwprocessor/command/quit.py#L43-L51 | [
"def",
"nothread_quit",
"(",
"self",
",",
"arg",
")",
":",
"self",
".",
"debugger",
".",
"core",
".",
"stop",
"(",
")",
"self",
".",
"debugger",
".",
"core",
".",
"execution_status",
"=",
"'Quit command'",
"self",
".",
"proc",
".",
"response",
"[",
"'e... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | parse_addr_list_cmd | Parses arguments for the "list" command and returns the tuple:
(filename, first line number, last line number)
or sets these to None if there was some problem. | trepan/processor/cmd_addrlist.py | def parse_addr_list_cmd(proc, args, listsize=40):
"""Parses arguments for the "list" command and returns the tuple:
(filename, first line number, last line number)
or sets these to None if there was some problem."""
text = proc.current_command[len(args[0])+1:].strip()
if text in frozenset(('', '.'... | def parse_addr_list_cmd(proc, args, listsize=40):
"""Parses arguments for the "list" command and returns the tuple:
(filename, first line number, last line number)
or sets these to None if there was some problem."""
text = proc.current_command[len(args[0])+1:].strip()
if text in frozenset(('', '.'... | [
"Parses",
"arguments",
"for",
"the",
"list",
"command",
"and",
"returns",
"the",
"tuple",
":",
"(",
"filename",
"first",
"line",
"number",
"last",
"line",
"number",
")",
"or",
"sets",
"these",
"to",
"None",
"if",
"there",
"was",
"some",
"problem",
"."
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/cmd_addrlist.py#L23-L122 | [
"def",
"parse_addr_list_cmd",
"(",
"proc",
",",
"args",
",",
"listsize",
"=",
"40",
")",
":",
"text",
"=",
"proc",
".",
"current_command",
"[",
"len",
"(",
"args",
"[",
"0",
"]",
")",
"+",
"1",
":",
"]",
".",
"strip",
"(",
")",
"if",
"text",
"in"... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | TrepanCore.add_ignore | Add `frame_or_fn' to the list of functions that are not to
be debugged | trepan/lib/core.py | def add_ignore(self, *frames_or_fns):
"""Add `frame_or_fn' to the list of functions that are not to
be debugged"""
for frame_or_fn in frames_or_fns:
rc = self.ignore_filter.add_include(frame_or_fn)
pass
return rc | def add_ignore(self, *frames_or_fns):
"""Add `frame_or_fn' to the list of functions that are not to
be debugged"""
for frame_or_fn in frames_or_fns:
rc = self.ignore_filter.add_include(frame_or_fn)
pass
return rc | [
"Add",
"frame_or_fn",
"to",
"the",
"list",
"of",
"functions",
"that",
"are",
"not",
"to",
"be",
"debugged"
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/lib/core.py#L133-L139 | [
"def",
"add_ignore",
"(",
"self",
",",
"*",
"frames_or_fns",
")",
":",
"for",
"frame_or_fn",
"in",
"frames_or_fns",
":",
"rc",
"=",
"self",
".",
"ignore_filter",
".",
"add_include",
"(",
"frame_or_fn",
")",
"pass",
"return",
"rc"
] | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | TrepanCore.canonic | Turns `filename' into its canonic representation and returns this
string. This allows a user to refer to a given file in one of several
equivalent ways.
Relative filenames need to be fully resolved, since the current working
directory might change over the course of execution.
... | trepan/lib/core.py | def canonic(self, filename):
""" Turns `filename' into its canonic representation and returns this
string. This allows a user to refer to a given file in one of several
equivalent ways.
Relative filenames need to be fully resolved, since the current working
directory might chang... | def canonic(self, filename):
""" Turns `filename' into its canonic representation and returns this
string. This allows a user to refer to a given file in one of several
equivalent ways.
Relative filenames need to be fully resolved, since the current working
directory might chang... | [
"Turns",
"filename",
"into",
"its",
"canonic",
"representation",
"and",
"returns",
"this",
"string",
".",
"This",
"allows",
"a",
"user",
"to",
"refer",
"to",
"a",
"given",
"file",
"in",
"one",
"of",
"several",
"equivalent",
"ways",
"."
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/lib/core.py#L141-L177 | [
"def",
"canonic",
"(",
"self",
",",
"filename",
")",
":",
"if",
"filename",
"==",
"\"<\"",
"+",
"filename",
"[",
"1",
":",
"-",
"1",
"]",
"+",
"\">\"",
":",
"return",
"filename",
"canonic",
"=",
"self",
".",
"filename_cache",
".",
"get",
"(",
"filena... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | TrepanCore.filename | Return filename or the basename of that depending on the
basename setting | trepan/lib/core.py | def filename(self, filename=None):
"""Return filename or the basename of that depending on the
basename setting"""
if filename is None:
if self.debugger.mainpyfile:
filename = self.debugger.mainpyfile
else:
return None
if self.debug... | def filename(self, filename=None):
"""Return filename or the basename of that depending on the
basename setting"""
if filename is None:
if self.debugger.mainpyfile:
filename = self.debugger.mainpyfile
else:
return None
if self.debug... | [
"Return",
"filename",
"or",
"the",
"basename",
"of",
"that",
"depending",
"on",
"the",
"basename",
"setting"
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/lib/core.py#L184-L194 | [
"def",
"filename",
"(",
"self",
",",
"filename",
"=",
"None",
")",
":",
"if",
"filename",
"is",
"None",
":",
"if",
"self",
".",
"debugger",
".",
"mainpyfile",
":",
"filename",
"=",
"self",
".",
"debugger",
".",
"mainpyfile",
"else",
":",
"return",
"Non... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | TrepanCore.is_started | Return True if debugging is in progress. | trepan/lib/core.py | def is_started(self):
'''Return True if debugging is in progress.'''
return (tracer.is_started() and
not self.trace_hook_suspend
and tracer.find_hook(self.trace_dispatch)) | def is_started(self):
'''Return True if debugging is in progress.'''
return (tracer.is_started() and
not self.trace_hook_suspend
and tracer.find_hook(self.trace_dispatch)) | [
"Return",
"True",
"if",
"debugging",
"is",
"in",
"progress",
"."
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/lib/core.py#L199-L203 | [
"def",
"is_started",
"(",
"self",
")",
":",
"return",
"(",
"tracer",
".",
"is_started",
"(",
")",
"and",
"not",
"self",
".",
"trace_hook_suspend",
"and",
"tracer",
".",
"find_hook",
"(",
"self",
".",
"trace_dispatch",
")",
")"
] | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | TrepanCore.start | We've already created a debugger object, but here we start
debugging in earnest. We can also turn off debugging (but have
the hooks suspended or not) using 'stop'.
'opts' is a hash of every known value you might want to set when
starting the debugger. See START_OPTS of module default. | trepan/lib/core.py | def start(self, opts=None):
""" We've already created a debugger object, but here we start
debugging in earnest. We can also turn off debugging (but have
the hooks suspended or not) using 'stop'.
'opts' is a hash of every known value you might want to set when
starting the debug... | def start(self, opts=None):
""" We've already created a debugger object, but here we start
debugging in earnest. We can also turn off debugging (but have
the hooks suspended or not) using 'stop'.
'opts' is a hash of every known value you might want to set when
starting the debug... | [
"We",
"ve",
"already",
"created",
"a",
"debugger",
"object",
"but",
"here",
"we",
"start",
"debugging",
"in",
"earnest",
".",
"We",
"can",
"also",
"turn",
"off",
"debugging",
"(",
"but",
"have",
"the",
"hooks",
"suspended",
"or",
"not",
")",
"using",
"st... | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/lib/core.py#L210-L244 | [
"def",
"start",
"(",
"self",
",",
"opts",
"=",
"None",
")",
":",
"# The below is our fancy equivalent of:",
"# sys.settrace(self._trace_dispatch)",
"try",
":",
"self",
".",
"trace_hook_suspend",
"=",
"True",
"get_option",
"=",
"lambda",
"key",
":",
"Mmisc",
".",
... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | TrepanCore.is_stop_here | Does the magic to determine if we stop here and run a
command processor or not. If so, return True and set
self.stop_reason; if not, return False.
Determining factors can be whether a breakpoint was
encountered, whether we are stepping, next'ing, finish'ing,
and, if so, whether ... | trepan/lib/core.py | def is_stop_here(self, frame, event, arg):
""" Does the magic to determine if we stop here and run a
command processor or not. If so, return True and set
self.stop_reason; if not, return False.
Determining factors can be whether a breakpoint was
encountered, whether we are stepp... | def is_stop_here(self, frame, event, arg):
""" Does the magic to determine if we stop here and run a
command processor or not. If so, return True and set
self.stop_reason; if not, return False.
Determining factors can be whether a breakpoint was
encountered, whether we are stepp... | [
"Does",
"the",
"magic",
"to",
"determine",
"if",
"we",
"stop",
"here",
"and",
"run",
"a",
"command",
"processor",
"or",
"not",
".",
"If",
"so",
"return",
"True",
"and",
"set",
"self",
".",
"stop_reason",
";",
"if",
"not",
"return",
"False",
"."
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/lib/core.py#L323-L370 | [
"def",
"is_stop_here",
"(",
"self",
",",
"frame",
",",
"event",
",",
"arg",
")",
":",
"# Add an generic event filter here?",
"# FIXME TODO: Check for",
"# - thread switching (under set option)",
"# Check for \"next\" and \"finish\" stopping via stop_level",
"# Do we want a different... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | TrepanCore.set_next | Sets to stop on the next event that happens in frame 'frame'. | trepan/lib/core.py | def set_next(self, frame, step_ignore=0, step_events=None):
"Sets to stop on the next event that happens in frame 'frame'."
self.step_events = None # Consider all events
self.stop_level = Mstack.count_frames(frame)
self.last_level = self.stop_level
self.last_fra... | def set_next(self, frame, step_ignore=0, step_events=None):
"Sets to stop on the next event that happens in frame 'frame'."
self.step_events = None # Consider all events
self.stop_level = Mstack.count_frames(frame)
self.last_level = self.stop_level
self.last_fra... | [
"Sets",
"to",
"stop",
"on",
"the",
"next",
"event",
"that",
"happens",
"in",
"frame",
"frame",
"."
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/lib/core.py#L382-L390 | [
"def",
"set_next",
"(",
"self",
",",
"frame",
",",
"step_ignore",
"=",
"0",
",",
"step_events",
"=",
"None",
")",
":",
"self",
".",
"step_events",
"=",
"None",
"# Consider all events",
"self",
".",
"stop_level",
"=",
"Mstack",
".",
"count_frames",
"(",
"fr... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | TrepanCore.trace_dispatch | A trace event occurred. Filter or pass the information to a
specialized event processor. Note that there may be more filtering
that goes on in the command processor (e.g. to force a
different line). We could put that here, but since that seems
processor-specific I think it best to distri... | trepan/lib/core.py | def trace_dispatch(self, frame, event, arg):
'''A trace event occurred. Filter or pass the information to a
specialized event processor. Note that there may be more filtering
that goes on in the command processor (e.g. to force a
different line). We could put that here, but since that se... | def trace_dispatch(self, frame, event, arg):
'''A trace event occurred. Filter or pass the information to a
specialized event processor. Note that there may be more filtering
that goes on in the command processor (e.g. to force a
different line). We could put that here, but since that se... | [
"A",
"trace",
"event",
"occurred",
".",
"Filter",
"or",
"pass",
"the",
"information",
"to",
"a",
"specialized",
"event",
"processor",
".",
"Note",
"that",
"there",
"may",
"be",
"more",
"filtering",
"that",
"goes",
"on",
"in",
"the",
"command",
"processor",
... | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/lib/core.py#L392-L451 | [
"def",
"trace_dispatch",
"(",
"self",
",",
"frame",
",",
"event",
",",
"arg",
")",
":",
"# For now we only allow one instance in a process",
"# In Python 2.6 and beyond one can use \"with threading.Lock():\"",
"try",
":",
"self",
".",
"debugger_lock",
".",
"acquire",
"(",
... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | InfoThread.stack_trace | A mini stack trace routine for threads. | trepan/processor/command/info_subcmd/threads.py | def stack_trace(self, f):
"""A mini stack trace routine for threads."""
while f:
if (not self.core.ignore_filter.is_included(f)
or self.settings['dbg_trepan']):
s = Mstack.format_stack_entry(self, (f, f.f_lineno))
self.msg(" "*4 + s)
... | def stack_trace(self, f):
"""A mini stack trace routine for threads."""
while f:
if (not self.core.ignore_filter.is_included(f)
or self.settings['dbg_trepan']):
s = Mstack.format_stack_entry(self, (f, f.f_lineno))
self.msg(" "*4 + s)
... | [
"A",
"mini",
"stack",
"trace",
"routine",
"for",
"threads",
"."
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/command/info_subcmd/threads.py#L55-L65 | [
"def",
"stack_trace",
"(",
"self",
",",
"f",
")",
":",
"while",
"f",
":",
"if",
"(",
"not",
"self",
".",
"core",
".",
"ignore_filter",
".",
"is_included",
"(",
"f",
")",
"or",
"self",
".",
"settings",
"[",
"'dbg_trepan'",
"]",
")",
":",
"s",
"=",
... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | InfoFiles.run | Get file information | trepan/processor/command/info_subcmd/files.py | def run(self, args):
"""Get file information"""
if len(args) == 0:
if not self.proc.curframe:
self.errmsg("No frame - no default file.")
return False
filename = self.proc.curframe.f_code.co_filename
else:
filename = args[0]
... | def run(self, args):
"""Get file information"""
if len(args) == 0:
if not self.proc.curframe:
self.errmsg("No frame - no default file.")
return False
filename = self.proc.curframe.f_code.co_filename
else:
filename = args[0]
... | [
"Get",
"file",
"information"
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/command/info_subcmd/files.py#L51-L128 | [
"def",
"run",
"(",
"self",
",",
"args",
")",
":",
"if",
"len",
"(",
"args",
")",
"==",
"0",
":",
"if",
"not",
"self",
".",
"proc",
".",
"curframe",
":",
"self",
".",
"errmsg",
"(",
"\"No frame - no default file.\"",
")",
"return",
"False",
"filename",
... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | NextCommand.run | **next**[**+**|**-**] [*count*]
Step one statement ignoring steps into function calls at this level.
With an integer argument, perform `next` that many times. However if
an exception occurs at this level, or we *return*, *yield* or the
thread changes, we stop regardless of count.
A suffix of `+` on the command or an... | trepan/processor/command/next.py | def run(self, args):
"""**next**[**+**|**-**] [*count*]
Step one statement ignoring steps into function calls at this level.
With an integer argument, perform `next` that many times. However if
an exception occurs at this level, or we *return*, *yield* or the
thread changes, we stop regardless of count.
A su... | def run(self, args):
"""**next**[**+**|**-**] [*count*]
Step one statement ignoring steps into function calls at this level.
With an integer argument, perform `next` that many times. However if
an exception occurs at this level, or we *return*, *yield* or the
thread changes, we stop regardless of count.
A su... | [
"**",
"next",
"**",
"[",
"**",
"+",
"**",
"|",
"**",
"-",
"**",
"]",
"[",
"*",
"count",
"*",
"]"
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/command/next.py#L35-L70 | [
"def",
"run",
"(",
"self",
",",
"args",
")",
":",
"if",
"len",
"(",
"args",
")",
"<=",
"1",
":",
"step_ignore",
"=",
"0",
"else",
":",
"step_ignore",
"=",
"self",
".",
"proc",
".",
"get_int",
"(",
"args",
"[",
"1",
"]",
",",
"default",
"=",
"1"... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | checkfuncname | Check whether we should break here because of `b.funcname`. | trepan/lib/breakpoint.py | def checkfuncname(b, frame):
"""Check whether we should break here because of `b.funcname`."""
if not b.funcname:
# Breakpoint was set via line number.
if b.line != frame.f_lineno:
# Breakpoint was set at a line with a def statement and the function
# defined is called: d... | def checkfuncname(b, frame):
"""Check whether we should break here because of `b.funcname`."""
if not b.funcname:
# Breakpoint was set via line number.
if b.line != frame.f_lineno:
# Breakpoint was set at a line with a def statement and the function
# defined is called: d... | [
"Check",
"whether",
"we",
"should",
"break",
"here",
"because",
"of",
"b",
".",
"funcname",
"."
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/lib/breakpoint.py#L291-L315 | [
"def",
"checkfuncname",
"(",
"b",
",",
"frame",
")",
":",
"if",
"not",
"b",
".",
"funcname",
":",
"# Breakpoint was set via line number.",
"if",
"b",
".",
"line",
"!=",
"frame",
".",
"f_lineno",
":",
"# Breakpoint was set at a line with a def statement and the functio... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | BreakpointManager.delete_breakpoint | remove breakpoint `bp | trepan/lib/breakpoint.py | def delete_breakpoint(self, bp):
" remove breakpoint `bp'"
bpnum = bp.number
self.bpbynumber[bpnum] = None # No longer in list
index = (bp.filename, bp.line)
if index not in self.bplist: return False
self.bplist[index].remove(bp)
if not self.bplist[index]:
... | def delete_breakpoint(self, bp):
" remove breakpoint `bp'"
bpnum = bp.number
self.bpbynumber[bpnum] = None # No longer in list
index = (bp.filename, bp.line)
if index not in self.bplist: return False
self.bplist[index].remove(bp)
if not self.bplist[index]:
... | [
"remove",
"breakpoint",
"bp"
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/lib/breakpoint.py#L83-L93 | [
"def",
"delete_breakpoint",
"(",
"self",
",",
"bp",
")",
":",
"bpnum",
"=",
"bp",
".",
"number",
"self",
".",
"bpbynumber",
"[",
"bpnum",
"]",
"=",
"None",
"# No longer in list",
"index",
"=",
"(",
"bp",
".",
"filename",
",",
"bp",
".",
"line",
")",
... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | BreakpointManager.delete_breakpoint_by_number | Remove a breakpoint given its breakpoint number. | trepan/lib/breakpoint.py | def delete_breakpoint_by_number(self, bpnum):
"Remove a breakpoint given its breakpoint number."
success, msg, bp = self.get_breakpoint(bpnum)
if not success:
return False, msg
self.delete_breakpoint(bp)
return (True, '') | def delete_breakpoint_by_number(self, bpnum):
"Remove a breakpoint given its breakpoint number."
success, msg, bp = self.get_breakpoint(bpnum)
if not success:
return False, msg
self.delete_breakpoint(bp)
return (True, '') | [
"Remove",
"a",
"breakpoint",
"given",
"its",
"breakpoint",
"number",
"."
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/lib/breakpoint.py#L95-L101 | [
"def",
"delete_breakpoint_by_number",
"(",
"self",
",",
"bpnum",
")",
":",
"success",
",",
"msg",
",",
"bp",
"=",
"self",
".",
"get_breakpoint",
"(",
"bpnum",
")",
"if",
"not",
"success",
":",
"return",
"False",
",",
"msg",
"self",
".",
"delete_breakpoint"... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | BreakpointManager.en_disable_all_breakpoints | Enable or disable all breakpoints. | trepan/lib/breakpoint.py | def en_disable_all_breakpoints(self, do_enable=True):
"Enable or disable all breakpoints."
bp_list = [bp for bp in self.bpbynumber if bp]
bp_nums = []
if do_enable:
endis = 'en'
else:
endis = 'dis'
pass
if not bp_list:
retu... | def en_disable_all_breakpoints(self, do_enable=True):
"Enable or disable all breakpoints."
bp_list = [bp for bp in self.bpbynumber if bp]
bp_nums = []
if do_enable:
endis = 'en'
else:
endis = 'dis'
pass
if not bp_list:
retu... | [
"Enable",
"or",
"disable",
"all",
"breakpoints",
"."
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/lib/breakpoint.py#L103-L118 | [
"def",
"en_disable_all_breakpoints",
"(",
"self",
",",
"do_enable",
"=",
"True",
")",
":",
"bp_list",
"=",
"[",
"bp",
"for",
"bp",
"in",
"self",
".",
"bpbynumber",
"if",
"bp",
"]",
"bp_nums",
"=",
"[",
"]",
"if",
"do_enable",
":",
"endis",
"=",
"'en'",... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | BreakpointManager.en_disable_breakpoint_by_number | Enable or disable a breakpoint given its breakpoint number. | trepan/lib/breakpoint.py | def en_disable_breakpoint_by_number(self, bpnum, do_enable=True):
"Enable or disable a breakpoint given its breakpoint number."
success, msg, bp = self.get_breakpoint(bpnum)
if not success:
return success, msg
if do_enable:
endis = 'en'
else:
e... | def en_disable_breakpoint_by_number(self, bpnum, do_enable=True):
"Enable or disable a breakpoint given its breakpoint number."
success, msg, bp = self.get_breakpoint(bpnum)
if not success:
return success, msg
if do_enable:
endis = 'en'
else:
e... | [
"Enable",
"or",
"disable",
"a",
"breakpoint",
"given",
"its",
"breakpoint",
"number",
"."
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/lib/breakpoint.py#L120-L134 | [
"def",
"en_disable_breakpoint_by_number",
"(",
"self",
",",
"bpnum",
",",
"do_enable",
"=",
"True",
")",
":",
"success",
",",
"msg",
",",
"bp",
"=",
"self",
".",
"get_breakpoint",
"(",
"bpnum",
")",
"if",
"not",
"success",
":",
"return",
"success",
",",
... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | BreakpointManager.delete_breakpoints_by_lineno | Removes all breakpoints at a give filename and line number.
Returns a list of breakpoints numbers deleted. | trepan/lib/breakpoint.py | def delete_breakpoints_by_lineno(self, filename, lineno):
"""Removes all breakpoints at a give filename and line number.
Returns a list of breakpoints numbers deleted.
"""
if (filename, lineno) not in self.bplist:
return []
breakpoints = self.bplist[(filename, lineno)... | def delete_breakpoints_by_lineno(self, filename, lineno):
"""Removes all breakpoints at a give filename and line number.
Returns a list of breakpoints numbers deleted.
"""
if (filename, lineno) not in self.bplist:
return []
breakpoints = self.bplist[(filename, lineno)... | [
"Removes",
"all",
"breakpoints",
"at",
"a",
"give",
"filename",
"and",
"line",
"number",
".",
"Returns",
"a",
"list",
"of",
"breakpoints",
"numbers",
"deleted",
"."
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/lib/breakpoint.py#L136-L146 | [
"def",
"delete_breakpoints_by_lineno",
"(",
"self",
",",
"filename",
",",
"lineno",
")",
":",
"if",
"(",
"filename",
",",
"lineno",
")",
"not",
"in",
"self",
".",
"bplist",
":",
"return",
"[",
"]",
"breakpoints",
"=",
"self",
".",
"bplist",
"[",
"(",
"... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | BreakpointManager.find_bp | Determine which breakpoint for this file:line is to be acted upon.
Called only if we know there is a bpt at this
location. Returns breakpoint that was triggered and a flag
that indicates if it is ok to delete a temporary breakpoint. | trepan/lib/breakpoint.py | def find_bp(self, filename, lineno, frame):
"""Determine which breakpoint for this file:line is to be acted upon.
Called only if we know there is a bpt at this
location. Returns breakpoint that was triggered and a flag
that indicates if it is ok to delete a temporary breakpoint.
... | def find_bp(self, filename, lineno, frame):
"""Determine which breakpoint for this file:line is to be acted upon.
Called only if we know there is a bpt at this
location. Returns breakpoint that was triggered and a flag
that indicates if it is ok to delete a temporary breakpoint.
... | [
"Determine",
"which",
"breakpoint",
"for",
"this",
"file",
":",
"line",
"is",
"to",
"be",
"acted",
"upon",
"."
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/lib/breakpoint.py#L148-L196 | [
"def",
"find_bp",
"(",
"self",
",",
"filename",
",",
"lineno",
",",
"frame",
")",
":",
"possibles",
"=",
"self",
".",
"bplist",
"[",
"filename",
",",
"lineno",
"]",
"for",
"i",
"in",
"range",
"(",
"0",
",",
"len",
"(",
"possibles",
")",
")",
":",
... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | ScriptInput.open | Use this to set what file to read from. | trepan/inout/scriptin.py | def open(self, inp, opts=None):
"""Use this to set what file to read from. """
if isinstance(inp, io.TextIOWrapper):
self.input = inp
elif isinstance(inp, 'string'.__class__): # FIXME
self.name = inp
self.input = open(inp, 'r')
else:
rais... | def open(self, inp, opts=None):
"""Use this to set what file to read from. """
if isinstance(inp, io.TextIOWrapper):
self.input = inp
elif isinstance(inp, 'string'.__class__): # FIXME
self.name = inp
self.input = open(inp, 'r')
else:
rais... | [
"Use",
"this",
"to",
"set",
"what",
"file",
"to",
"read",
"from",
"."
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/inout/scriptin.py#L41-L51 | [
"def",
"open",
"(",
"self",
",",
"inp",
",",
"opts",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"inp",
",",
"io",
".",
"TextIOWrapper",
")",
":",
"self",
".",
"input",
"=",
"inp",
"elif",
"isinstance",
"(",
"inp",
",",
"'string'",
".",
"__clas... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
test | ScriptInput.readline | Read a line of input. Prompt and use_raw exist to be
compatible with other input routines and are ignored.
EOFError will be raised on EOF. | trepan/inout/scriptin.py | def readline(self, prompt='', use_raw=None):
"""Read a line of input. Prompt and use_raw exist to be
compatible with other input routines and are ignored.
EOFError will be raised on EOF.
"""
line = self.input.readline()
if not line: raise EOFError
return line.rstr... | def readline(self, prompt='', use_raw=None):
"""Read a line of input. Prompt and use_raw exist to be
compatible with other input routines and are ignored.
EOFError will be raised on EOF.
"""
line = self.input.readline()
if not line: raise EOFError
return line.rstr... | [
"Read",
"a",
"line",
"of",
"input",
".",
"Prompt",
"and",
"use_raw",
"exist",
"to",
"be",
"compatible",
"with",
"other",
"input",
"routines",
"and",
"are",
"ignored",
".",
"EOFError",
"will",
"be",
"raised",
"on",
"EOF",
"."
] | rocky/python3-trepan | python | https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/inout/scriptin.py#L53-L60 | [
"def",
"readline",
"(",
"self",
",",
"prompt",
"=",
"''",
",",
"use_raw",
"=",
"None",
")",
":",
"line",
"=",
"self",
".",
"input",
".",
"readline",
"(",
")",
"if",
"not",
"line",
":",
"raise",
"EOFError",
"return",
"line",
".",
"rstrip",
"(",
"\"\... | 14e91bc0acce090d67be145b1ac040cab92ac5f3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.