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
LokyManager.start
Spawn a server process for this manager object
loky/backend/managers.py
def start(self, initializer=None, initargs=()): '''Spawn a server process for this manager object''' assert self._state.value == State.INITIAL if (initializer is not None and not hasattr(initializer, '__call__')): raise TypeError('initializer must be a callable') ...
def start(self, initializer=None, initargs=()): '''Spawn a server process for this manager object''' assert self._state.value == State.INITIAL if (initializer is not None and not hasattr(initializer, '__call__')): raise TypeError('initializer must be a callable') ...
[ "Spawn", "a", "server", "process", "for", "this", "manager", "object" ]
tomMoral/loky
python
https://github.com/tomMoral/loky/blob/dc2d941d8285a96f3a5b666a4bd04875b0b25984/loky/backend/managers.py#L18-L51
[ "def", "start", "(", "self", ",", "initializer", "=", "None", ",", "initargs", "=", "(", ")", ")", ":", "assert", "self", ".", "_state", ".", "value", "==", "State", ".", "INITIAL", "if", "(", "initializer", "is", "not", "None", "and", "not", "hasatt...
dc2d941d8285a96f3a5b666a4bd04875b0b25984
test
DupFd
Return a wrapper for an fd.
loky/backend/_posix_reduction.py
def DupFd(fd): '''Return a wrapper for an fd.''' popen_obj = get_spawning_popen() if popen_obj is not None: return popen_obj.DupFd(popen_obj.duplicate_for_child(fd)) elif HAVE_SEND_HANDLE and sys.version_info[:2] > (3, 3): from multiprocessing import resource_sharer return resour...
def DupFd(fd): '''Return a wrapper for an fd.''' popen_obj = get_spawning_popen() if popen_obj is not None: return popen_obj.DupFd(popen_obj.duplicate_for_child(fd)) elif HAVE_SEND_HANDLE and sys.version_info[:2] > (3, 3): from multiprocessing import resource_sharer return resour...
[ "Return", "a", "wrapper", "for", "an", "fd", "." ]
tomMoral/loky
python
https://github.com/tomMoral/loky/blob/dc2d941d8285a96f3a5b666a4bd04875b0b25984/loky/backend/_posix_reduction.py#L34-L46
[ "def", "DupFd", "(", "fd", ")", ":", "popen_obj", "=", "get_spawning_popen", "(", ")", "if", "popen_obj", "is", "not", "None", ":", "return", "popen_obj", ".", "DupFd", "(", "popen_obj", ".", "duplicate_for_child", "(", "fd", ")", ")", "elif", "HAVE_SEND_H...
dc2d941d8285a96f3a5b666a4bd04875b0b25984
test
get_reusable_executor
Return the current ReusableExectutor instance. Start a new instance if it has not been started already or if the previous instance was left in a broken state. If the previous instance does not have the requested number of workers, the executor is dynamically resized to adjust the number of workers pri...
loky/reusable_executor.py
def get_reusable_executor(max_workers=None, context=None, timeout=10, kill_workers=False, reuse="auto", job_reducers=None, result_reducers=None, initializer=None, initargs=()): """Return the current ReusableExectutor instance. Start ...
def get_reusable_executor(max_workers=None, context=None, timeout=10, kill_workers=False, reuse="auto", job_reducers=None, result_reducers=None, initializer=None, initargs=()): """Return the current ReusableExectutor instance. Start ...
[ "Return", "the", "current", "ReusableExectutor", "instance", "." ]
tomMoral/loky
python
https://github.com/tomMoral/loky/blob/dc2d941d8285a96f3a5b666a4bd04875b0b25984/loky/reusable_executor.py#L40-L134
[ "def", "get_reusable_executor", "(", "max_workers", "=", "None", ",", "context", "=", "None", ",", "timeout", "=", "10", ",", "kill_workers", "=", "False", ",", "reuse", "=", "\"auto\"", ",", "job_reducers", "=", "None", ",", "result_reducers", "=", "None", ...
dc2d941d8285a96f3a5b666a4bd04875b0b25984
test
_ReusablePoolExecutor._wait_job_completion
Wait for the cache to be empty before resizing the pool.
loky/reusable_executor.py
def _wait_job_completion(self): """Wait for the cache to be empty before resizing the pool.""" # Issue a warning to the user about the bad effect of this usage. if len(self._pending_work_items) > 0: warnings.warn("Trying to resize an executor with running jobs: " ...
def _wait_job_completion(self): """Wait for the cache to be empty before resizing the pool.""" # Issue a warning to the user about the bad effect of this usage. if len(self._pending_work_items) > 0: warnings.warn("Trying to resize an executor with running jobs: " ...
[ "Wait", "for", "the", "cache", "to", "be", "empty", "before", "resizing", "the", "pool", "." ]
tomMoral/loky
python
https://github.com/tomMoral/loky/blob/dc2d941d8285a96f3a5b666a4bd04875b0b25984/loky/reusable_executor.py#L187-L198
[ "def", "_wait_job_completion", "(", "self", ")", ":", "# Issue a warning to the user about the bad effect of this usage.", "if", "len", "(", "self", ".", "_pending_work_items", ")", ">", "0", ":", "warnings", ".", "warn", "(", "\"Trying to resize an executor with running jo...
dc2d941d8285a96f3a5b666a4bd04875b0b25984
test
get_preparation_data
Return info about parent needed by child to unpickle process object
loky/backend/spawn.py
def get_preparation_data(name, init_main_module=True): ''' Return info about parent needed by child to unpickle process object ''' _check_not_importing_main() d = dict( log_to_stderr=util._log_to_stderr, authkey=bytes(process.current_process().authkey), ) if util._logger is ...
def get_preparation_data(name, init_main_module=True): ''' Return info about parent needed by child to unpickle process object ''' _check_not_importing_main() d = dict( log_to_stderr=util._log_to_stderr, authkey=bytes(process.current_process().authkey), ) if util._logger is ...
[ "Return", "info", "about", "parent", "needed", "by", "child", "to", "unpickle", "process", "object" ]
tomMoral/loky
python
https://github.com/tomMoral/loky/blob/dc2d941d8285a96f3a5b666a4bd04875b0b25984/loky/backend/spawn.py#L53-L111
[ "def", "get_preparation_data", "(", "name", ",", "init_main_module", "=", "True", ")", ":", "_check_not_importing_main", "(", ")", "d", "=", "dict", "(", "log_to_stderr", "=", "util", ".", "_log_to_stderr", ",", "authkey", "=", "bytes", "(", "process", ".", ...
dc2d941d8285a96f3a5b666a4bd04875b0b25984
test
prepare
Try to get current process ready to unpickle process object
loky/backend/spawn.py
def prepare(data): ''' Try to get current process ready to unpickle process object ''' if 'name' in data: process.current_process().name = data['name'] if 'authkey' in data: process.current_process().authkey = data['authkey'] if 'log_to_stderr' in data and data['log_to_stderr']...
def prepare(data): ''' Try to get current process ready to unpickle process object ''' if 'name' in data: process.current_process().name = data['name'] if 'authkey' in data: process.current_process().authkey = data['authkey'] if 'log_to_stderr' in data and data['log_to_stderr']...
[ "Try", "to", "get", "current", "process", "ready", "to", "unpickle", "process", "object" ]
tomMoral/loky
python
https://github.com/tomMoral/loky/blob/dc2d941d8285a96f3a5b666a4bd04875b0b25984/loky/backend/spawn.py#L120-L161
[ "def", "prepare", "(", "data", ")", ":", "if", "'name'", "in", "data", ":", "process", ".", "current_process", "(", ")", ".", "name", "=", "data", "[", "'name'", "]", "if", "'authkey'", "in", "data", ":", "process", ".", "current_process", "(", ")", ...
dc2d941d8285a96f3a5b666a4bd04875b0b25984
test
wait
Wait till an object in object_list is ready/readable. Returns list of those objects which are ready/readable.
loky/backend/_posix_wait.py
def wait(object_list, timeout=None): ''' Wait till an object in object_list is ready/readable. Returns list of those objects which are ready/readable. ''' if timeout is not None: if timeout <= 0: return _poll(object_list, 0) else: deadline = monotonic() + time...
def wait(object_list, timeout=None): ''' Wait till an object in object_list is ready/readable. Returns list of those objects which are ready/readable. ''' if timeout is not None: if timeout <= 0: return _poll(object_list, 0) else: deadline = monotonic() + time...
[ "Wait", "till", "an", "object", "in", "object_list", "is", "ready", "/", "readable", ".", "Returns", "list", "of", "those", "objects", "which", "are", "ready", "/", "readable", "." ]
tomMoral/loky
python
https://github.com/tomMoral/loky/blob/dc2d941d8285a96f3a5b666a4bd04875b0b25984/loky/backend/_posix_wait.py#L88-L105
[ "def", "wait", "(", "object_list", ",", "timeout", "=", "None", ")", ":", "if", "timeout", "is", "not", "None", ":", "if", "timeout", "<=", "0", ":", "return", "_poll", "(", "object_list", ",", "0", ")", "else", ":", "deadline", "=", "monotonic", "("...
dc2d941d8285a96f3a5b666a4bd04875b0b25984
test
close_fds
Close all the file descriptors except those in keep_fds.
loky/backend/fork_exec.py
def close_fds(keep_fds): # pragma: no cover """Close all the file descriptors except those in keep_fds.""" # Make sure to keep stdout and stderr open for logging purpose keep_fds = set(keep_fds).union([1, 2]) # We try to retrieve all the open fds try: open_fds = set(int(fd) for fd in os.l...
def close_fds(keep_fds): # pragma: no cover """Close all the file descriptors except those in keep_fds.""" # Make sure to keep stdout and stderr open for logging purpose keep_fds = set(keep_fds).union([1, 2]) # We try to retrieve all the open fds try: open_fds = set(int(fd) for fd in os.l...
[ "Close", "all", "the", "file", "descriptors", "except", "those", "in", "keep_fds", "." ]
tomMoral/loky
python
https://github.com/tomMoral/loky/blob/dc2d941d8285a96f3a5b666a4bd04875b0b25984/loky/backend/fork_exec.py#L14-L33
[ "def", "close_fds", "(", "keep_fds", ")", ":", "# pragma: no cover", "# Make sure to keep stdout and stderr open for logging purpose", "keep_fds", "=", "set", "(", "keep_fds", ")", ".", "union", "(", "[", "1", ",", "2", "]", ")", "# We try to retrieve all the open fds",...
dc2d941d8285a96f3a5b666a4bd04875b0b25984
test
_recursive_terminate_without_psutil
Terminate a process and its descendants.
loky/backend/utils.py
def _recursive_terminate_without_psutil(process): """Terminate a process and its descendants. """ try: _recursive_terminate(process.pid) except OSError as e: warnings.warn("Failed to kill subprocesses on this platform. Please" "install psutil: https://github.com/gia...
def _recursive_terminate_without_psutil(process): """Terminate a process and its descendants. """ try: _recursive_terminate(process.pid) except OSError as e: warnings.warn("Failed to kill subprocesses on this platform. Please" "install psutil: https://github.com/gia...
[ "Terminate", "a", "process", "and", "its", "descendants", "." ]
tomMoral/loky
python
https://github.com/tomMoral/loky/blob/dc2d941d8285a96f3a5b666a4bd04875b0b25984/loky/backend/utils.py#L49-L60
[ "def", "_recursive_terminate_without_psutil", "(", "process", ")", ":", "try", ":", "_recursive_terminate", "(", "process", ".", "pid", ")", "except", "OSError", "as", "e", ":", "warnings", ".", "warn", "(", "\"Failed to kill subprocesses on this platform. Please\"", ...
dc2d941d8285a96f3a5b666a4bd04875b0b25984
test
_recursive_terminate
Recursively kill the descendants of a process before killing it.
loky/backend/utils.py
def _recursive_terminate(pid): """Recursively kill the descendants of a process before killing it. """ if sys.platform == "win32": # On windows, the taskkill function with option `/T` terminate a given # process pid and its children. try: subprocess.check_output( ...
def _recursive_terminate(pid): """Recursively kill the descendants of a process before killing it. """ if sys.platform == "win32": # On windows, the taskkill function with option `/T` terminate a given # process pid and its children. try: subprocess.check_output( ...
[ "Recursively", "kill", "the", "descendants", "of", "a", "process", "before", "killing", "it", "." ]
tomMoral/loky
python
https://github.com/tomMoral/loky/blob/dc2d941d8285a96f3a5b666a4bd04875b0b25984/loky/backend/utils.py#L63-L116
[ "def", "_recursive_terminate", "(", "pid", ")", ":", "if", "sys", ".", "platform", "==", "\"win32\"", ":", "# On windows, the taskkill function with option `/T` terminate a given", "# process pid and its children.", "try", ":", "subprocess", ".", "check_output", "(", "[", ...
dc2d941d8285a96f3a5b666a4bd04875b0b25984
test
get_exitcodes_terminated_worker
Return a formated string with the exitcodes of terminated workers. If necessary, wait (up to .25s) for the system to correctly set the exitcode of one terminated worker.
loky/backend/utils.py
def get_exitcodes_terminated_worker(processes): """Return a formated string with the exitcodes of terminated workers. If necessary, wait (up to .25s) for the system to correctly set the exitcode of one terminated worker. """ patience = 5 # Catch the exitcode of the terminated workers. There sh...
def get_exitcodes_terminated_worker(processes): """Return a formated string with the exitcodes of terminated workers. If necessary, wait (up to .25s) for the system to correctly set the exitcode of one terminated worker. """ patience = 5 # Catch the exitcode of the terminated workers. There sh...
[ "Return", "a", "formated", "string", "with", "the", "exitcodes", "of", "terminated", "workers", "." ]
tomMoral/loky
python
https://github.com/tomMoral/loky/blob/dc2d941d8285a96f3a5b666a4bd04875b0b25984/loky/backend/utils.py#L119-L138
[ "def", "get_exitcodes_terminated_worker", "(", "processes", ")", ":", "patience", "=", "5", "# Catch the exitcode of the terminated workers. There should at least be", "# one. If not, wait a bit for the system to correctly set the exitcode of", "# the terminated worker.", "exitcodes", "=",...
dc2d941d8285a96f3a5b666a4bd04875b0b25984
test
_format_exitcodes
Format a list of exit code with names of the signals if possible
loky/backend/utils.py
def _format_exitcodes(exitcodes): """Format a list of exit code with names of the signals if possible""" str_exitcodes = ["{}({})".format(_get_exitcode_name(e), e) for e in exitcodes if e is not None] return "{" + ", ".join(str_exitcodes) + "}"
def _format_exitcodes(exitcodes): """Format a list of exit code with names of the signals if possible""" str_exitcodes = ["{}({})".format(_get_exitcode_name(e), e) for e in exitcodes if e is not None] return "{" + ", ".join(str_exitcodes) + "}"
[ "Format", "a", "list", "of", "exit", "code", "with", "names", "of", "the", "signals", "if", "possible" ]
tomMoral/loky
python
https://github.com/tomMoral/loky/blob/dc2d941d8285a96f3a5b666a4bd04875b0b25984/loky/backend/utils.py#L141-L145
[ "def", "_format_exitcodes", "(", "exitcodes", ")", ":", "str_exitcodes", "=", "[", "\"{}({})\"", ".", "format", "(", "_get_exitcode_name", "(", "e", ")", ",", "e", ")", "for", "e", "in", "exitcodes", "if", "e", "is", "not", "None", "]", "return", "\"{\""...
dc2d941d8285a96f3a5b666a4bd04875b0b25984
test
main
Run semaphore tracker.
loky/backend/semaphore_tracker.py
def main(fd, verbose=0): '''Run semaphore tracker.''' # protect the process from ^C and "killall python" etc signal.signal(signal.SIGINT, signal.SIG_IGN) signal.signal(signal.SIGTERM, signal.SIG_IGN) if _HAVE_SIGMASK: signal.pthread_sigmask(signal.SIG_UNBLOCK, _IGNORED_SIGNALS) for f i...
def main(fd, verbose=0): '''Run semaphore tracker.''' # protect the process from ^C and "killall python" etc signal.signal(signal.SIGINT, signal.SIG_IGN) signal.signal(signal.SIGTERM, signal.SIG_IGN) if _HAVE_SIGMASK: signal.pthread_sigmask(signal.SIG_UNBLOCK, _IGNORED_SIGNALS) for f i...
[ "Run", "semaphore", "tracker", "." ]
tomMoral/loky
python
https://github.com/tomMoral/loky/blob/dc2d941d8285a96f3a5b666a4bd04875b0b25984/loky/backend/semaphore_tracker.py#L170-L247
[ "def", "main", "(", "fd", ",", "verbose", "=", "0", ")", ":", "# protect the process from ^C and \"killall python\" etc", "signal", ".", "signal", "(", "signal", ".", "SIGINT", ",", "signal", ".", "SIG_IGN", ")", "signal", ".", "signal", "(", "signal", ".", ...
dc2d941d8285a96f3a5b666a4bd04875b0b25984
test
SemaphoreTracker.ensure_running
Make sure that semaphore tracker process is running. This can be run from any process. Usually a child process will use the semaphore created by its parent.
loky/backend/semaphore_tracker.py
def ensure_running(self): '''Make sure that semaphore tracker process is running. This can be run from any process. Usually a child process will use the semaphore created by its parent.''' with self._lock: if self._fd is not None: # semaphore tracker was lau...
def ensure_running(self): '''Make sure that semaphore tracker process is running. This can be run from any process. Usually a child process will use the semaphore created by its parent.''' with self._lock: if self._fd is not None: # semaphore tracker was lau...
[ "Make", "sure", "that", "semaphore", "tracker", "process", "is", "running", "." ]
tomMoral/loky
python
https://github.com/tomMoral/loky/blob/dc2d941d8285a96f3a5b666a4bd04875b0b25984/loky/backend/semaphore_tracker.py#L61-L132
[ "def", "ensure_running", "(", "self", ")", ":", "with", "self", ".", "_lock", ":", "if", "self", ".", "_fd", "is", "not", "None", ":", "# semaphore tracker was launched before, is it still running?", "if", "self", ".", "_check_alive", "(", ")", ":", "# => still ...
dc2d941d8285a96f3a5b666a4bd04875b0b25984
test
PrintProcessor.event_processor
A simple event processor that prints out events.
trepan/processor/trace.py
def event_processor(self, frame, event, arg): 'A simple event processor that prints out events.' out = self.debugger.intf[-1].output lineno = frame.f_lineno filename = self.core.canonic_filename(frame) filename = self.core.filename(filename) if not out: print(...
def event_processor(self, frame, event, arg): 'A simple event processor that prints out events.' out = self.debugger.intf[-1].output lineno = frame.f_lineno filename = self.core.canonic_filename(frame) filename = self.core.filename(filename) if not out: print(...
[ "A", "simple", "event", "processor", "that", "prints", "out", "events", "." ]
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/trace.py#L36-L52
[ "def", "event_processor", "(", "self", ",", "frame", ",", "event", ",", "arg", ")", ":", "out", "=", "self", ".", "debugger", ".", "intf", "[", "-", "1", "]", ".", "output", "lineno", "=", "frame", ".", "f_lineno", "filename", "=", "self", ".", "co...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
InfoPC.run
Program counter.
trepan/processor/command/info_subcmd/pc.py
def run(self, args): """Program counter.""" mainfile = self.core.filename(None) if self.core.is_running(): curframe = self.proc.curframe if curframe: line_no = inspect.getlineno(curframe) offset = curframe.f_lasti self.msg(...
def run(self, args): """Program counter.""" mainfile = self.core.filename(None) if self.core.is_running(): curframe = self.proc.curframe if curframe: line_no = inspect.getlineno(curframe) offset = curframe.f_lasti self.msg(...
[ "Program", "counter", "." ]
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/command/info_subcmd/pc.py#L42-L73
[ "def", "run", "(", "self", ",", "args", ")", ":", "mainfile", "=", "self", ".", "core", ".", "filename", "(", "None", ")", "if", "self", ".", "core", ".", "is_running", "(", ")", ":", "curframe", "=", "self", ".", "proc", ".", "curframe", "if", "...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
interact
Almost a copy of code.interact Closely emulate the interactive Python interpreter. This is a backwards compatible interface to the InteractiveConsole class. When readfunc is not specified, it attempts to import the readline module to enable GNU readline if it is available. Arguments (all optional...
trepan/processor/command/ipython.py
def interact(banner=None, readfunc=None, my_locals=None, my_globals=None): """Almost a copy of code.interact Closely emulate the interactive Python interpreter. This is a backwards compatible interface to the InteractiveConsole class. When readfunc is not specified, it attempts to import the readl...
def interact(banner=None, readfunc=None, my_locals=None, my_globals=None): """Almost a copy of code.interact Closely emulate the interactive Python interpreter. This is a backwards compatible interface to the InteractiveConsole class. When readfunc is not specified, it attempts to import the readl...
[ "Almost", "a", "copy", "of", "code", ".", "interact", "Closely", "emulate", "the", "interactive", "Python", "interpreter", "." ]
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/command/ipython.py#L137-L163
[ "def", "interact", "(", "banner", "=", "None", ",", "readfunc", "=", "None", ",", "my_locals", "=", "None", ",", "my_globals", "=", "None", ")", ":", "console", "=", "code", ".", "InteractiveConsole", "(", "my_locals", ",", "filename", "=", "'<trepan>'", ...
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/ipython.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/ipython.py#L167-L190
[ "def", "runcode", "(", "obj", ",", "code_obj", ")", ":", "try", ":", "exec", "(", "code_obj", ",", "obj", ".", "locals", ",", "obj", ".", "globals", ")", "except", "SystemExit", ":", "raise", "except", ":", "obj", ".", "showtraceback", "(", ")", "els...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
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/processor/frame.py
def adjust_frame(proc_obj, name, 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 proc_obj.curframe: proc_obj.errmsg("No stack.") return ...
def adjust_frame(proc_obj, name, 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 proc_obj.curframe: proc_obj.errmsg("No stack.") return ...
[ "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/processor/frame.py#L45-L81
[ "def", "adjust_frame", "(", "proc_obj", ",", "name", ",", "pos", ",", "absolute_pos", ")", ":", "if", "not", "proc_obj", ".", "curframe", ":", "proc_obj", ".", "errmsg", "(", "\"No stack.\"", ")", "return", "# Below we remove any negativity. At the end, pos will be"...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
parse_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/cmdlist.py
def parse_list_cmd(proc, args, listsize=10): """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_list_cmd(proc, args, listsize=10): """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/cmdlist.py#L23-L107
[ "def", "parse_list_cmd", "(", "proc", ",", "args", ",", "listsize", "=", "10", ")", ":", "text", "=", "proc", ".", "current_command", "[", "len", "(", "args", "[", "0", "]", ")", "+", "1", ":", "]", ".", "strip", "(", ")", "if", "text", "in", "...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
DebuggerUserInput.open
Use this to set where to read from. Set opts['try_lineedit'] if you want this input to interact with GNU-like readline library. By default, we will assume to try importing and using readline. If readline is not importable, line editing is not available whether or not opts['try_r...
trepan/inout/input.py
def open(self, inp, opts={}): """Use this to set where to read from. Set opts['try_lineedit'] if you want this input to interact with GNU-like readline library. By default, we will assume to try importing and using readline. If readline is not importable, line editing is not ava...
def open(self, inp, opts={}): """Use this to set where to read from. Set opts['try_lineedit'] if you want this input to interact with GNU-like readline library. By default, we will assume to try importing and using readline. If readline is not importable, line editing is not ava...
[ "Use", "this", "to", "set", "where", "to", "read", "from", "." ]
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/inout/input.py#L57-L90
[ "def", "open", "(", "self", ",", "inp", ",", "opts", "=", "{", "}", ")", ":", "get_option", "=", "lambda", "key", ":", "Mmisc", ".", "option_set", "(", "opts", ",", "key", ",", "self", ".", "DEFAULT_OPEN_READ_OPTS", ")", "if", "(", "isinstance", "(",...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
DebuggerUserInput.readline
Read a line of input. EOFError will be raised on EOF. Note: some user interfaces may decide to arrange to call DebuggerOutput.write() first with the prompt rather than pass it here.. If `use_raw' is set raw_input() will be used in that is supported by the specific input input. If this o...
trepan/inout/input.py
def readline(self, use_raw=None, prompt=''): """Read a line of input. EOFError will be raised on EOF. Note: some user interfaces may decide to arrange to call DebuggerOutput.write() first with the prompt rather than pass it here.. If `use_raw' is set raw_input() will be used in that ...
def readline(self, use_raw=None, prompt=''): """Read a line of input. EOFError will be raised on EOF. Note: some user interfaces may decide to arrange to call DebuggerOutput.write() first with the prompt rather than pass it here.. If `use_raw' is set raw_input() will be used in that ...
[ "Read", "a", "line", "of", "input", ".", "EOFError", "will", "be", "raised", "on", "EOF", "." ]
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/inout/input.py#L92-L119
[ "def", "readline", "(", "self", ",", "use_raw", "=", "None", ",", "prompt", "=", "''", ")", ":", "# FIXME we don't do command completion.", "if", "use_raw", "is", "None", ":", "use_raw", "=", "self", ".", "use_raw", "pass", "if", "use_raw", ":", "try", ":"...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
Trepan.run
Run debugger on string `cmd' using builtin function eval and if that builtin exec. Arguments `globals_' and `locals_' are the dictionaries to use for local and global variables. By default, the value of globals is globals(), the current global variables. If `locals_' is not given, it be...
trepan/debugger.py
def run(self, cmd, start_opts=None, globals_=None, locals_=None): """ Run debugger on string `cmd' using builtin function eval and if that builtin exec. Arguments `globals_' and `locals_' are the dictionaries to use for local and global variables. By default, the value of globals is glo...
def run(self, cmd, start_opts=None, globals_=None, locals_=None): """ Run debugger on string `cmd' using builtin function eval and if that builtin exec. Arguments `globals_' and `locals_' are the dictionaries to use for local and global variables. By default, the value of globals is glo...
[ "Run", "debugger", "on", "string", "cmd", "using", "builtin", "function", "eval", "and", "if", "that", "builtin", "exec", ".", "Arguments", "globals_", "and", "locals_", "are", "the", "dictionaries", "to", "use", "for", "local", "and", "global", "variables", ...
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/debugger.py#L62-L101
[ "def", "run", "(", "self", ",", "cmd", ",", "start_opts", "=", "None", ",", "globals_", "=", "None", ",", "locals_", "=", "None", ")", ":", "if", "globals_", "is", "None", ":", "globals_", "=", "globals", "(", ")", "if", "locals_", "is", "None", ":...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
Trepan.run_exec
Run debugger on string `cmd' which will executed via the builtin function exec. Arguments `globals_' and `locals_' are the dictionaries to use for local and global variables. By default, the value of globals is globals(), the current global variables. If `locals_' is not given, it become...
trepan/debugger.py
def run_exec(self, cmd, start_opts=None, globals_=None, locals_=None): """ Run debugger on string `cmd' which will executed via the builtin function exec. Arguments `globals_' and `locals_' are the dictionaries to use for local and global variables. By default, the value of globals is gl...
def run_exec(self, cmd, start_opts=None, globals_=None, locals_=None): """ Run debugger on string `cmd' which will executed via the builtin function exec. Arguments `globals_' and `locals_' are the dictionaries to use for local and global variables. By default, the value of globals is gl...
[ "Run", "debugger", "on", "string", "cmd", "which", "will", "executed", "via", "the", "builtin", "function", "exec", ".", "Arguments", "globals_", "and", "locals_", "are", "the", "dictionaries", "to", "use", "for", "local", "and", "global", "variables", ".", ...
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/debugger.py#L103-L132
[ "def", "run_exec", "(", "self", ",", "cmd", ",", "start_opts", "=", "None", ",", "globals_", "=", "None", ",", "locals_", "=", "None", ")", ":", "if", "globals_", "is", "None", ":", "globals_", "=", "globals", "(", ")", "if", "locals_", "is", "None",...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
Trepan.run_call
Run debugger on function call: `func(*args, **kwds)' See also `run_eval' if what you want to run is an eval'able expression have that result returned and `run' if you want to debug a statment via exec.
trepan/debugger.py
def run_call(self, func, start_opts=None, *args, **kwds): """ Run debugger on function call: `func(*args, **kwds)' See also `run_eval' if what you want to run is an eval'able expression have that result returned and `run' if you want to debug a statment via exec. """ res...
def run_call(self, func, start_opts=None, *args, **kwds): """ Run debugger on function call: `func(*args, **kwds)' See also `run_eval' if what you want to run is an eval'able expression have that result returned and `run' if you want to debug a statment via exec. """ res...
[ "Run", "debugger", "on", "function", "call", ":", "func", "(", "*", "args", "**", "kwds", ")" ]
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/debugger.py#L134-L149
[ "def", "run_call", "(", "self", ",", "func", ",", "start_opts", "=", "None", ",", "*", "args", ",", "*", "*", "kwds", ")", ":", "res", "=", "None", "self", ".", "core", ".", "start", "(", "opts", "=", "start_opts", ")", "try", ":", "res", "=", ...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
Trepan.run_eval
Run debugger on string `expr' which will executed via the built-in Python function: eval; `globals_' and `locals_' are the dictionaries to use for local and global variables. If `globals' is not given, __main__.__dict__ (the current global variables) is used. If `locals_' is not given, i...
trepan/debugger.py
def run_eval(self, expr, start_opts=None, globals_=None, locals_=None): """ Run debugger on string `expr' which will executed via the built-in Python function: eval; `globals_' and `locals_' are the dictionaries to use for local and global variables. If `globals' is not given, __main__._...
def run_eval(self, expr, start_opts=None, globals_=None, locals_=None): """ Run debugger on string `expr' which will executed via the built-in Python function: eval; `globals_' and `locals_' are the dictionaries to use for local and global variables. If `globals' is not given, __main__._...
[ "Run", "debugger", "on", "string", "expr", "which", "will", "executed", "via", "the", "built", "-", "in", "Python", "function", ":", "eval", ";", "globals_", "and", "locals_", "are", "the", "dictionaries", "to", "use", "for", "local", "and", "global", "var...
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/debugger.py#L151-L179
[ "def", "run_eval", "(", "self", ",", "expr", ",", "start_opts", "=", "None", ",", "globals_", "=", "None", ",", "locals_", "=", "None", ")", ":", "if", "globals_", "is", "None", ":", "globals_", "=", "globals", "(", ")", "if", "locals_", "is", "None"...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
Trepan.run_script
Run debugger on Python script `filename'. The script may inspect sys.argv for command arguments. `globals_' and `locals_' are the dictionaries to use for local and global variables. If `globals' is not given, globals() (the current global variables) is used. If `locals_' is not given, it...
trepan/debugger.py
def run_script(self, filename, start_opts=None, globals_=None, locals_=None): """ Run debugger on Python script `filename'. The script may inspect sys.argv for command arguments. `globals_' and `locals_' are the dictionaries to use for local and global variables. If `g...
def run_script(self, filename, start_opts=None, globals_=None, locals_=None): """ Run debugger on Python script `filename'. The script may inspect sys.argv for command arguments. `globals_' and `locals_' are the dictionaries to use for local and global variables. If `g...
[ "Run", "debugger", "on", "Python", "script", "filename", ".", "The", "script", "may", "inspect", "sys", ".", "argv", "for", "command", "arguments", ".", "globals_", "and", "locals_", "are", "the", "dictionaries", "to", "use", "for", "local", "and", "global",...
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/debugger.py#L181-L233
[ "def", "run_script", "(", "self", ",", "filename", ",", "start_opts", "=", "None", ",", "globals_", "=", "None", ",", "locals_", "=", "None", ")", ":", "self", ".", "mainpyfile", "=", "self", ".", "core", ".", "canonic", "(", "filename", ")", "# Start ...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
arg_split
Split a command line's arguments in a shell-like manner returned as a list of lists. Use ';;' with white space to indicate separate commands. This is a modified version of the standard library's shlex.split() function, but with a default of posix=False for splitting, so that quotes in inputs are re...
trepan/processor/cmdproc.py
def arg_split(s, posix=False): """Split a command line's arguments in a shell-like manner returned as a list of lists. Use ';;' with white space to indicate separate commands. This is a modified version of the standard library's shlex.split() function, but with a default of posix=False for splittin...
def arg_split(s, posix=False): """Split a command line's arguments in a shell-like manner returned as a list of lists. Use ';;' with white space to indicate separate commands. This is a modified version of the standard library's shlex.split() function, but with a default of posix=False for splittin...
[ "Split", "a", "command", "line", "s", "arguments", "in", "a", "shell", "-", "like", "manner", "returned", "as", "a", "list", "of", "lists", ".", "Use", ";;", "with", "white", "space", "to", "indicate", "separate", "commands", "." ]
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/cmdproc.py#L49-L73
[ "def", "arg_split", "(", "s", ",", "posix", "=", "False", ")", ":", "args_list", "=", "[", "[", "]", "]", "if", "isinstance", "(", "s", ",", "bytes", ")", ":", "s", "=", "s", ".", "decode", "(", "\"utf-8\"", ")", "lex", "=", "shlex", ".", "shle...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
get_stack
Return a stack of frames which the debugger will use for in showing backtraces and in frame switching. As such various frame that are really around may be excluded unless we are debugging the sebugger. Also we will add traceback frame on top if that exists.
trepan/processor/cmdproc.py
def get_stack(f, t, botframe, proc_obj=None): """Return a stack of frames which the debugger will use for in showing backtraces and in frame switching. As such various frame that are really around may be excluded unless we are debugging the sebugger. Also we will add traceback frame on top if that e...
def get_stack(f, t, botframe, proc_obj=None): """Return a stack of frames which the debugger will use for in showing backtraces and in frame switching. As such various frame that are really around may be excluded unless we are debugging the sebugger. Also we will add traceback frame on top if that e...
[ "Return", "a", "stack", "of", "frames", "which", "the", "debugger", "will", "use", "for", "in", "showing", "backtraces", "and", "in", "frame", "switching", ".", "As", "such", "various", "frame", "that", "are", "really", "around", "may", "be", "excluded", "...
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/cmdproc.py#L75-L105
[ "def", "get_stack", "(", "f", ",", "t", ",", "botframe", ",", "proc_obj", "=", "None", ")", ":", "exclude_frame", "=", "lambda", "f", ":", "False", "if", "proc_obj", ":", "settings", "=", "proc_obj", ".", "debugger", ".", "settings", "if", "not", "sett...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
run_hooks
Run each function in `hooks' with args
trepan/processor/cmdproc.py
def run_hooks(obj, hooks, *args): """Run each function in `hooks' with args""" for hook in hooks: if hook(obj, *args): return True pass return False
def run_hooks(obj, hooks, *args): """Run each function in `hooks' with args""" for hook in hooks: if hook(obj, *args): return True pass return False
[ "Run", "each", "function", "in", "hooks", "with", "args" ]
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/cmdproc.py#L107-L112
[ "def", "run_hooks", "(", "obj", ",", "hooks", ",", "*", "args", ")", ":", "for", "hook", "in", "hooks", ":", "if", "hook", "(", "obj", ",", "*", "args", ")", ":", "return", "True", "pass", "return", "False" ]
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
print_source_location_info
Print out a source location , e.g. the first line in line in: (/tmp.py:2 @21): <module> L -- 2 import sys,os (trepan3k)
trepan/processor/cmdproc.py
def print_source_location_info(print_fn, filename, lineno, fn_name=None, f_lasti=None, remapped_file=None): """Print out a source location , e.g. the first line in line in: (/tmp.py:2 @21): <module> L -- 2 import sys,os (trepan3k) """ if remapped_f...
def print_source_location_info(print_fn, filename, lineno, fn_name=None, f_lasti=None, remapped_file=None): """Print out a source location , e.g. the first line in line in: (/tmp.py:2 @21): <module> L -- 2 import sys,os (trepan3k) """ if remapped_f...
[ "Print", "out", "a", "source", "location", "e", ".", "g", ".", "the", "first", "line", "in", "line", "in", ":", "(", "/", "tmp", ".", "py", ":", "2" ]
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/cmdproc.py#L143-L163
[ "def", "print_source_location_info", "(", "print_fn", ",", "filename", ",", "lineno", ",", "fn_name", "=", "None", ",", "f_lasti", "=", "None", ",", "remapped_file", "=", "None", ")", ":", "if", "remapped_file", ":", "mess", "=", "'(%s:%s remapped %s'", "%", ...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
print_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/processor/cmdproc.py
def print_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 F...
def print_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 F...
[ "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/processor/cmdproc.py#L165-L319
[ "def", "print_location", "(", "proc_obj", ")", ":", "i_stack", "=", "proc_obj", ".", "curindex", "if", "i_stack", "is", "None", "or", "proc_obj", ".", "stack", "is", "None", ":", "return", "False", "core_obj", "=", "proc_obj", ".", "core", "dbgr_obj", "=",...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
CommandProcessor.event_processor
command event processor: reading a commands do something with them.
trepan/processor/cmdproc.py
def event_processor(self, frame, event, event_arg, prompt='trepan3k'): 'command event processor: reading a commands do something with them.' self.frame = frame self.event = event self.event_arg = event_arg filename = frame.f_code.co_filename lineno = frame.f_li...
def event_processor(self, frame, event, event_arg, prompt='trepan3k'): 'command event processor: reading a commands do something with them.' self.frame = frame self.event = event self.event_arg = event_arg filename = frame.f_code.co_filename lineno = frame.f_li...
[ "command", "event", "processor", ":", "reading", "a", "commands", "do", "something", "with", "them", "." ]
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/cmdproc.py#L438-L467
[ "def", "event_processor", "(", "self", ",", "frame", ",", "event", ",", "event_arg", ",", "prompt", "=", "'trepan3k'", ")", ":", "self", ".", "frame", "=", "frame", "self", ".", "event", "=", "event", "self", ".", "event_arg", "=", "event_arg", "filename...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
CommandProcessor.forget
Remove memory of state variables set in the command processor
trepan/processor/cmdproc.py
def forget(self): """ Remove memory of state variables set in the command processor """ self.stack = [] self.curindex = 0 self.curframe = None self.thread_name = None self.frame_thread_name = None return
def forget(self): """ Remove memory of state variables set in the command processor """ self.stack = [] self.curindex = 0 self.curframe = None self.thread_name = None self.frame_thread_name = None return
[ "Remove", "memory", "of", "state", "variables", "set", "in", "the", "command", "processor" ]
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/cmdproc.py#L469-L476
[ "def", "forget", "(", "self", ")", ":", "self", ".", "stack", "=", "[", "]", "self", ".", "curindex", "=", "0", "self", ".", "curframe", "=", "None", "self", ".", "thread_name", "=", "None", "self", ".", "frame_thread_name", "=", "None", "return" ]
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
CommandProcessor.get_an_int
Like cmdfns.get_an_int(), but if there's a stack frame use that in evaluation.
trepan/processor/cmdproc.py
def get_an_int(self, arg, msg_on_error, min_value=None, max_value=None): """Like cmdfns.get_an_int(), but if there's a stack frame use that in evaluation.""" ret_value = self.get_int_noerr(arg) if ret_value is None: if msg_on_error: self.errmsg(msg_on_error) ...
def get_an_int(self, arg, msg_on_error, min_value=None, max_value=None): """Like cmdfns.get_an_int(), but if there's a stack frame use that in evaluation.""" ret_value = self.get_int_noerr(arg) if ret_value is None: if msg_on_error: self.errmsg(msg_on_error) ...
[ "Like", "cmdfns", ".", "get_an_int", "()", "but", "if", "there", "s", "a", "stack", "frame", "use", "that", "in", "evaluation", "." ]
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/cmdproc.py#L516-L535
[ "def", "get_an_int", "(", "self", ",", "arg", ",", "msg_on_error", ",", "min_value", "=", "None", ",", "max_value", "=", "None", ")", ":", "ret_value", "=", "self", ".", "get_int_noerr", "(", "arg", ")", "if", "ret_value", "is", "None", ":", "if", "msg...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
CommandProcessor.get_int_noerr
Eval arg and it is an integer return the value. Otherwise return None
trepan/processor/cmdproc.py
def get_int_noerr(self, arg): """Eval arg and it is an integer return the value. Otherwise return None""" if self.curframe: g = self.curframe.f_globals l = self.curframe.f_locals else: g = globals() l = locals() pass try...
def get_int_noerr(self, arg): """Eval arg and it is an integer return the value. Otherwise return None""" if self.curframe: g = self.curframe.f_globals l = self.curframe.f_locals else: g = globals() l = locals() pass try...
[ "Eval", "arg", "and", "it", "is", "an", "integer", "return", "the", "value", ".", "Otherwise", "return", "None" ]
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/cmdproc.py#L537-L551
[ "def", "get_int_noerr", "(", "self", ",", "arg", ")", ":", "if", "self", ".", "curframe", ":", "g", "=", "self", ".", "curframe", ".", "f_globals", "l", "=", "self", ".", "curframe", ".", "f_locals", "else", ":", "g", "=", "globals", "(", ")", "l",...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
CommandProcessor.get_int
If no argument use the default. If arg is a an integer between least min_value and at_most, use that. Otherwise report an error. If there's a stack frame use that in evaluation.
trepan/processor/cmdproc.py
def get_int(self, arg, min_value=0, default=1, cmdname=None, at_most=None): """If no argument use the default. If arg is a an integer between least min_value and at_most, use that. Otherwise report an error. If there's a stack frame use that in evaluation.""" if arg is N...
def get_int(self, arg, min_value=0, default=1, cmdname=None, at_most=None): """If no argument use the default. If arg is a an integer between least min_value and at_most, use that. Otherwise report an error. If there's a stack frame use that in evaluation.""" if arg is N...
[ "If", "no", "argument", "use", "the", "default", ".", "If", "arg", "is", "a", "an", "integer", "between", "least", "min_value", "and", "at_most", "use", "that", ".", "Otherwise", "report", "an", "error", ".", "If", "there", "s", "a", "stack", "frame", ...
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/cmdproc.py#L553-L592
[ "def", "get_int", "(", "self", ",", "arg", ",", "min_value", "=", "0", ",", "default", "=", "1", ",", "cmdname", "=", "None", ",", "at_most", "=", "None", ")", ":", "if", "arg", "is", "None", ":", "return", "default", "default", "=", "self", ".", ...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
CommandProcessor.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/processor/cmdproc.py
def ok_for_running(self, cmd_obj, name, nargs): """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, nargs): """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/processor/cmdproc.py#L608-L637
[ "def", "ok_for_running", "(", "self", ",", "cmd_obj", ",", "name", ",", "nargs", ")", ":", "if", "hasattr", "(", "cmd_obj", ",", "'execution_set'", ")", ":", "if", "not", "(", "self", ".", "core", ".", "execution_status", "in", "cmd_obj", ".", "execution...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
CommandProcessor.process_commands
Handle debugger commands.
trepan/processor/cmdproc.py
def process_commands(self): """Handle debugger commands.""" if self.core.execution_status != 'No program': self.setup() self.location() pass leave_loop = run_hooks(self, self.preloop_hooks) self.continue_running = False while not leave_loop: ...
def process_commands(self): """Handle debugger commands.""" if self.core.execution_status != 'No program': self.setup() self.location() pass leave_loop = run_hooks(self, self.preloop_hooks) self.continue_running = False while not leave_loop: ...
[ "Handle", "debugger", "commands", "." ]
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/cmdproc.py#L639-L674
[ "def", "process_commands", "(", "self", ")", ":", "if", "self", ".", "core", ".", "execution_status", "!=", "'No program'", ":", "self", ".", "setup", "(", ")", "self", ".", "location", "(", ")", "pass", "leave_loop", "=", "run_hooks", "(", "self", ",", ...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
CommandProcessor.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/processor/cmdproc.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/processor/cmdproc.py#L782-L825
[ "def", "setup", "(", "self", ")", ":", "self", ".", "forget", "(", ")", "if", "self", ".", "settings", "(", "'dbg_trepan'", ")", ":", "self", ".", "frame", "=", "inspect", ".", "currentframe", "(", ")", "pass", "if", "self", ".", "event", "in", "["...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
CommandProcessor.queue_startfile
Arrange for file of debugger commands to get read in the process-command loop.
trepan/processor/cmdproc.py
def queue_startfile(self, cmdfile): """Arrange for file of debugger commands to get read in the process-command loop.""" expanded_cmdfile = os.path.expanduser(cmdfile) is_readable = Mfile.readable(expanded_cmdfile) if is_readable: self.cmd_queue.append('source ' + exp...
def queue_startfile(self, cmdfile): """Arrange for file of debugger commands to get read in the process-command loop.""" expanded_cmdfile = os.path.expanduser(cmdfile) is_readable = Mfile.readable(expanded_cmdfile) if is_readable: self.cmd_queue.append('source ' + exp...
[ "Arrange", "for", "file", "of", "debugger", "commands", "to", "get", "read", "in", "the", "process", "-", "command", "loop", "." ]
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/cmdproc.py#L827-L840
[ "def", "queue_startfile", "(", "self", ",", "cmdfile", ")", ":", "expanded_cmdfile", "=", "os", ".", "path", ".", "expanduser", "(", "cmdfile", ")", "is_readable", "=", "Mfile", ".", "readable", "(", "expanded_cmdfile", ")", "if", "is_readable", ":", "self",...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
CommandProcessor.read_history_file
Read the command history file -- possibly.
trepan/processor/cmdproc.py
def read_history_file(self): """Read the command history file -- possibly.""" histfile = self.debugger.intf[-1].histfile try: import readline readline.read_history_file(histfile) except IOError: pass except ImportError: pass ...
def read_history_file(self): """Read the command history file -- possibly.""" histfile = self.debugger.intf[-1].histfile try: import readline readline.read_history_file(histfile) except IOError: pass except ImportError: pass ...
[ "Read", "the", "command", "history", "file", "--", "possibly", "." ]
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/cmdproc.py#L847-L857
[ "def", "read_history_file", "(", "self", ")", ":", "histfile", "=", "self", ".", "debugger", ".", "intf", "[", "-", "1", "]", ".", "histfile", "try", ":", "import", "readline", "readline", ".", "read_history_file", "(", "histfile", ")", "except", "IOError"...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
CommandProcessor.write_history_file
Write the command history file -- possibly.
trepan/processor/cmdproc.py
def write_history_file(self): """Write the command history file -- possibly.""" settings = self.debugger.settings histfile = self.debugger.intf[-1].histfile if settings['hist_save']: try: import readline try: readline.write_...
def write_history_file(self): """Write the command history file -- possibly.""" settings = self.debugger.settings histfile = self.debugger.intf[-1].histfile if settings['hist_save']: try: import readline try: readline.write_...
[ "Write", "the", "command", "history", "file", "--", "possibly", "." ]
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/cmdproc.py#L859-L873
[ "def", "write_history_file", "(", "self", ")", ":", "settings", "=", "self", ".", "debugger", ".", "settings", "histfile", "=", "self", ".", "debugger", ".", "intf", "[", "-", "1", "]", ".", "histfile", "if", "settings", "[", "'hist_save'", "]", ":", "...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
CommandProcessor._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/processor/cmdproc.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/processor/cmdproc.py#L875-L888
[ "def", "_populate_commands", "(", "self", ")", ":", "from", "trepan", ".", "processor", "import", "command", "as", "Mcommand", "if", "hasattr", "(", "Mcommand", ",", "'__modules__'", ")", ":", "return", "self", ".", "populate_commands_easy_install", "(", "Mcomma...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
CommandProcessor._populate_cmd_lists
Populate self.lists and hashes: self.commands, and self.aliases, self.category
trepan/processor/cmdproc.py
def _populate_cmd_lists(self): """ Populate self.lists and hashes: self.commands, and self.aliases, self.category """ self.commands = {} self.aliases = {} self.category = {} # self.short_help = {} for cmd_instance in self.cmd_instances: if not hasattr(...
def _populate_cmd_lists(self): """ Populate self.lists and hashes: self.commands, and self.aliases, self.category """ self.commands = {} self.aliases = {} self.category = {} # self.short_help = {} for cmd_instance in self.cmd_instances: if not hasattr(...
[ "Populate", "self", ".", "lists", "and", "hashes", ":", "self", ".", "commands", "and", "self", ".", "aliases", "self", ".", "category" ]
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/cmdproc.py#L974-L1004
[ "def", "_populate_cmd_lists", "(", "self", ")", ":", "self", ".", "commands", "=", "{", "}", "self", ".", "aliases", "=", "{", "}", "self", ".", "category", "=", "{", "}", "# self.short_help = {}", "for", "cmd_instance", "in", "self", ".", "cmd_ins...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
complete_token_filtered_with_next
Find all starting matches in dictionary *aliases* that start with *prefix*, but filter out any matches already in *expanded*.
trepan/lib/complete.py
def complete_token_filtered_with_next(aliases, prefix, expanded, commands): """Find all starting matches in dictionary *aliases* that start with *prefix*, but filter out any matches already in *expanded*.""" complete_ary = list(aliases.keys()) expanded_ary = list(expanded.keys()) # result = [cm...
def complete_token_filtered_with_next(aliases, prefix, expanded, commands): """Find all starting matches in dictionary *aliases* that start with *prefix*, but filter out any matches already in *expanded*.""" complete_ary = list(aliases.keys()) expanded_ary = list(expanded.keys()) # result = [cm...
[ "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/lib/complete.py#L38-L58
[ "def", "complete_token_filtered_with_next", "(", "aliases", ",", "prefix", ",", "expanded", ",", "commands", ")", ":", "complete_ary", "=", "list", "(", "aliases", ".", "keys", "(", ")", ")", "expanded_ary", "=", "list", "(", "expanded", ".", "keys", "(", ...
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/lib/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 = aliases.keys() return [cmd for cmd in complete_ary if cmd.startswith(prefix)]
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 = aliases.keys() return [cmd for cmd in complete_ary if cmd.startswith(prefix)]
[ "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/lib/complete.py#L61-L66
[ "def", "complete_token_filtered", "(", "aliases", ",", "prefix", ",", "expanded", ")", ":", "complete_ary", "=", "aliases", ".", "keys", "(", ")", "return", "[", "cmd", "for", "cmd", "in", "complete_ary", "if", "cmd", ".", "startswith", "(", "prefix", ")",...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
next_token
Find the next token in str string from start_pos, we return the token and the next blank position after the token or str.size if this is the last token. Tokens are delimited by white space.
trepan/lib/complete.py
def next_token(str, start_pos): """Find the next token in str string from start_pos, we return the token and the next blank position after the token or str.size if this is the last token. Tokens are delimited by white space.""" look_at = str[start_pos:] match = re.search('\S', look_at) if ma...
def next_token(str, start_pos): """Find the next token in str string from start_pos, we return the token and the next blank position after the token or str.size if this is the last token. Tokens are delimited by white space.""" look_at = str[start_pos:] match = re.search('\S', look_at) if ma...
[ "Find", "the", "next", "token", "in", "str", "string", "from", "start_pos", "we", "return", "the", "token", "and", "the", "next", "blank", "position", "after", "the", "token", "or", "str", ".", "size", "if", "this", "is", "the", "last", "token", ".", "...
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/lib/complete.py#L71-L90
[ "def", "next_token", "(", "str", ",", "start_pos", ")", ":", "look_at", "=", "str", "[", "start_pos", ":", "]", "match", "=", "re", ".", "search", "(", "'\\S'", ",", "look_at", ")", "if", "match", ":", "pos", "=", "match", ".", "start", "(", ")", ...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
ScriptInterface.errmsg
Common routine for reporting debugger error messages.
trepan/interfaces/script.py
def errmsg(self, msg, prefix="** "): """Common routine for reporting debugger error messages. """ # self.verbose shows lines so we don't have to duplicate info # here. Perhaps there should be a 'terse' mode to never show # position info. if not self.verbose: ...
def errmsg(self, msg, prefix="** "): """Common routine for reporting debugger error messages. """ # self.verbose shows lines so we don't have to duplicate info # here. Perhaps there should be a 'terse' mode to never show # position info. if not self.verbose: ...
[ "Common", "routine", "for", "reporting", "debugger", "error", "messages", "." ]
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/interfaces/script.py#L62-L78
[ "def", "errmsg", "(", "self", ",", "msg", ",", "prefix", "=", "\"** \"", ")", ":", "# self.verbose shows lines so we don't have to duplicate info", "# here. Perhaps there should be a 'terse' mode to never show", "# position info.", "if", "not", "self", ".", "verbose", ":",...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
ScriptInterface.read_command
Script interface to read a command. `prompt' is a parameter for compatibilty and is ignored.
trepan/interfaces/script.py
def read_command(self, prompt=''): '''Script interface to read a command. `prompt' is a parameter for compatibilty and is ignored.''' self.input_lineno += 1 line = self.readline() if self.verbose: location = "%s line %s" % (self.script_name, self.input_lineno) ...
def read_command(self, prompt=''): '''Script interface to read a command. `prompt' is a parameter for compatibilty and is ignored.''' self.input_lineno += 1 line = self.readline() if self.verbose: location = "%s line %s" % (self.script_name, self.input_lineno) ...
[ "Script", "interface", "to", "read", "a", "command", ".", "prompt", "is", "a", "parameter", "for", "compatibilty", "and", "is", "ignored", "." ]
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/interfaces/script.py#L86-L96
[ "def", "read_command", "(", "self", ",", "prompt", "=", "''", ")", ":", "self", ".", "input_lineno", "+=", "1", "line", "=", "self", ".", "readline", "(", ")", "if", "self", ".", "verbose", ":", "location", "=", "\"%s line %s\"", "%", "(", "self", "....
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
FIFOClient.close
Closes both input and output
trepan/inout/fifoclient.py
def close(self): """ Closes both input and output """ self.state = 'closing' if self.input: self.input.close() pass if self.output: self.output.close() pass self.state = 'disconnnected' return
def close(self): """ Closes both input and output """ self.state = 'closing' if self.input: self.input.close() pass if self.output: self.output.close() pass self.state = 'disconnnected' return
[ "Closes", "both", "input", "and", "output" ]
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/inout/fifoclient.py#L45-L55
[ "def", "close", "(", "self", ")", ":", "self", ".", "state", "=", "'closing'", "if", "self", ".", "input", ":", "self", ".", "input", ".", "close", "(", ")", "pass", "if", "self", ".", "output", ":", "self", ".", "output", ".", "close", "(", ")",...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
FIFOClient.read_msg
Read a line of input. EOFError will be raised on EOF. Note that we don't support prompting
trepan/inout/fifoclient.py
def read_msg(self): """Read a line of input. EOFError will be raised on EOF. Note that we don't support prompting""" # FIXME: do we have to create and check a buffer for # lines? if self.state == 'active': if not self.input: self.input = open(self.in_...
def read_msg(self): """Read a line of input. EOFError will be raised on EOF. Note that we don't support prompting""" # FIXME: do we have to create and check a buffer for # lines? if self.state == 'active': if not self.input: self.input = open(self.in_...
[ "Read", "a", "line", "of", "input", ".", "EOFError", "will", "be", "raised", "on", "EOF", "." ]
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/inout/fifoclient.py#L87-L104
[ "def", "read_msg", "(", "self", ")", ":", "# FIXME: do we have to create and check a buffer for", "# lines?", "if", "self", ".", "state", "==", "'active'", ":", "if", "not", "self", ".", "input", ":", "self", ".", "input", "=", "open", "(", "self", ".", "in_...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
FIFOClient.write
This method the debugger uses to write. In contrast to writeline, no newline is added to the end to `str'.
trepan/inout/fifoclient.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.state == 'active': if not self.output: self.output = open(self.out_name, 'w') pass pass...
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.state == 'active': if not self.output: self.output = open(self.out_name, 'w') pass pass...
[ "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/fifoclient.py#L106-L119
[ "def", "write", "(", "self", ",", "msg", ")", ":", "if", "self", ".", "state", "==", "'active'", ":", "if", "not", "self", ".", "output", ":", "self", ".", "output", "=", "open", "(", "self", ".", "out_name", ",", "'w'", ")", "pass", "pass", "els...
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/client.py
def process_options(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.""" usage_str=""...
def process_options(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.""" usage_str=""...
[ "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/client.py#L30-L62
[ "def", "process_options", "(", "pkg_version", ",", "sys_argv", ",", "option_list", "=", "None", ")", ":", "usage_str", "=", "\"\"\"%prog [debugger-options]]\n\n Client connection to an out-of-process trepan3k debugger session\"\"\"", "# serverChoices = ('TCP','FIFO', None) # we use ...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
dis
Disassemble classes, methods, functions, or code. With no argument, disassemble the last traceback.
trepan/lib/disassemble.py
def dis(msg, msg_nocr, section, errmsg, x=None, start_line=-1, end_line=None, relative_pos = False, highlight='light', start_offset=0, end_offset=None, include_header=False): """Disassemble classes, methods, functions, or code. With no argument, disassemble the last traceback. """ last...
def dis(msg, msg_nocr, section, errmsg, x=None, start_line=-1, end_line=None, relative_pos = False, highlight='light', start_offset=0, end_offset=None, include_header=False): """Disassemble classes, methods, functions, or code. With no argument, disassemble the last traceback. """ last...
[ "Disassemble", "classes", "methods", "functions", "or", "code", "." ]
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/lib/disassemble.py#L35-L128
[ "def", "dis", "(", "msg", ",", "msg_nocr", ",", "section", ",", "errmsg", ",", "x", "=", "None", ",", "start_line", "=", "-", "1", ",", "end_line", "=", "None", ",", "relative_pos", "=", "False", ",", "highlight", "=", "'light'", ",", "start_offset", ...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
disassemble
Disassemble a code object.
trepan/lib/disassemble.py
def disassemble(msg, msg_nocr, section, co, lasti=-1, start_line=-1, end_line=None, relative_pos=False, highlight='light', start_offset=0, end_offset=None): """Disassemble a code object.""" return disassemble_bytes(msg, msg_nocr, co.co_code, lasti, co.co_firstlineno, ...
def disassemble(msg, msg_nocr, section, co, lasti=-1, start_line=-1, end_line=None, relative_pos=False, highlight='light', start_offset=0, end_offset=None): """Disassemble a code object.""" return disassemble_bytes(msg, msg_nocr, co.co_code, lasti, co.co_firstlineno, ...
[ "Disassemble", "a", "code", "object", "." ]
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/lib/disassemble.py#L131-L140
[ "def", "disassemble", "(", "msg", ",", "msg_nocr", ",", "section", ",", "co", ",", "lasti", "=", "-", "1", ",", "start_line", "=", "-", "1", ",", "end_line", "=", "None", ",", "relative_pos", "=", "False", ",", "highlight", "=", "'light'", ",", "star...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
disassemble_bytes
Disassemble byte string of code. If end_line is negative it counts the number of statement linestarts to use.
trepan/lib/disassemble.py
def disassemble_bytes(orig_msg, orig_msg_nocr, code, lasti=-1, cur_line=0, start_line=-1, end_line=None, relative_pos=False, varnames=(), names=(), constants=(), cells=(), freevars=(), linestarts={}, highlight='light', start_offset=...
def disassemble_bytes(orig_msg, orig_msg_nocr, code, lasti=-1, cur_line=0, start_line=-1, end_line=None, relative_pos=False, varnames=(), names=(), constants=(), cells=(), freevars=(), linestarts={}, highlight='light', start_offset=...
[ "Disassemble", "byte", "string", "of", "code", ".", "If", "end_line", "is", "negative", "it", "counts", "the", "number", "of", "statement", "linestarts", "to", "use", "." ]
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/lib/disassemble.py#L150-L226
[ "def", "disassemble_bytes", "(", "orig_msg", ",", "orig_msg_nocr", ",", "code", ",", "lasti", "=", "-", "1", ",", "cur_line", "=", "0", ",", "start_line", "=", "-", "1", ",", "end_line", "=", "None", ",", "relative_pos", "=", "False", ",", "varnames", ...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
count_frames
Return a count of the number of frames
trepan/lib/stack.py
def count_frames(frame, count_start=0): "Return a count of the number of frames" count = -count_start while frame: count += 1 frame = frame.f_back return count
def count_frames(frame, count_start=0): "Return a count of the number of frames" count = -count_start while frame: count += 1 frame = frame.f_back return count
[ "Return", "a", "count", "of", "the", "number", "of", "frames" ]
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/lib/stack.py#L31-L37
[ "def", "count_frames", "(", "frame", ",", "count_start", "=", "0", ")", ":", "count", "=", "-", "count_start", "while", "frame", ":", "count", "+=", "1", "frame", "=", "frame", ".", "f_back", "return", "count" ]
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
format_stack_entry
Format and return a stack entry gdb-style. Note: lprefix is not used. It is kept for compatibility.
trepan/lib/stack.py
def format_stack_entry(dbg_obj, frame_lineno, lprefix=': ', include_location=True, color='plain'): """Format and return a stack entry gdb-style. Note: lprefix is not used. It is kept for compatibility. """ frame, lineno = frame_lineno filename = frame2file(dbg_obj.core, frame)...
def format_stack_entry(dbg_obj, frame_lineno, lprefix=': ', include_location=True, color='plain'): """Format and return a stack entry gdb-style. Note: lprefix is not used. It is kept for compatibility. """ frame, lineno = frame_lineno filename = frame2file(dbg_obj.core, frame)...
[ "Format", "and", "return", "a", "stack", "entry", "gdb", "-", "style", ".", "Note", ":", "lprefix", "is", "not", "used", ".", "It", "is", "kept", "for", "compatibility", "." ]
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/lib/stack.py#L60-L144
[ "def", "format_stack_entry", "(", "dbg_obj", ",", "frame_lineno", ",", "lprefix", "=", "': '", ",", "include_location", "=", "True", ",", "color", "=", "'plain'", ")", ":", "frame", ",", "lineno", "=", "frame_lineno", "filename", "=", "frame2file", "(", "dbg...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
get_call_function_name
If f_back is looking at a call function, return the name for it. Otherwise return None
trepan/lib/stack.py
def get_call_function_name(frame): """If f_back is looking at a call function, return the name for it. Otherwise return None""" f_back = frame.f_back if not f_back: return None if 'CALL_FUNCTION' != Mbytecode.op_at_frame(f_back): return None co = f_back.f_code code = co.co_cod...
def get_call_function_name(frame): """If f_back is looking at a call function, return the name for it. Otherwise return None""" f_back = frame.f_back if not f_back: return None if 'CALL_FUNCTION' != Mbytecode.op_at_frame(f_back): return None co = f_back.f_code code = co.co_cod...
[ "If", "f_back", "is", "looking", "at", "a", "call", "function", "return", "the", "name", "for", "it", ".", "Otherwise", "return", "None" ]
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/lib/stack.py#L188-L224
[ "def", "get_call_function_name", "(", "frame", ")", ":", "f_back", "=", "frame", ".", "f_back", "if", "not", "f_back", ":", "return", "None", "if", "'CALL_FUNCTION'", "!=", "Mbytecode", ".", "op_at_frame", "(", "f_back", ")", ":", "return", "None", "co", "...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
print_stack_trace
Print count entries of the stack trace
trepan/lib/stack.py
def print_stack_trace(proc_obj, count=None, color='plain', opts={}): "Print count entries of the stack trace" if count is None: n=len(proc_obj.stack) else: n=min(len(proc_obj.stack), count) try: for i in range(n): print_stack_entry(proc_obj, i, color=color, opts=opts)...
def print_stack_trace(proc_obj, count=None, color='plain', opts={}): "Print count entries of the stack trace" if count is None: n=len(proc_obj.stack) else: n=min(len(proc_obj.stack), count) try: for i in range(n): print_stack_entry(proc_obj, i, color=color, opts=opts)...
[ "Print", "count", "entries", "of", "the", "stack", "trace" ]
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/lib/stack.py#L282-L293
[ "def", "print_stack_trace", "(", "proc_obj", ",", "count", "=", "None", ",", "color", "=", "'plain'", ",", "opts", "=", "{", "}", ")", ":", "if", "count", "is", "None", ":", "n", "=", "len", "(", "proc_obj", ".", "stack", ")", "else", ":", "n", "...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
eval_print_obj
Return a string representation of an object
trepan/lib/stack.py
def eval_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? val = eval(arg, None, None) else: val = eval(arg, fram...
def eval_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? val = eval(arg, None, None) else: val = eval(arg, fram...
[ "Return", "a", "string", "representation", "of", "an", "object" ]
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/lib/stack.py#L314-L327
[ "def", "eval_print_obj", "(", "arg", ",", "frame", ",", "format", "=", "None", ",", "short", "=", "False", ")", ":", "try", ":", "if", "not", "frame", ":", "# ?? Should we have set up a dummy globals", "# to have persistence?", "val", "=", "eval", "(", "arg", ...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
print_obj
Return a string representation of an object
trepan/lib/stack.py
def print_obj(arg, val, format=None, short=False): """Return a string representation of an object """ what = arg if format: what = format + ' ' + arg val = Mprint.printf(val, format) pass s = '%s = %s' % (what, val) if not short: s += '\n type = %s' % type(val) ...
def print_obj(arg, val, format=None, short=False): """Return a string representation of an object """ what = arg if format: what = format + ' ' + arg val = Mprint.printf(val, format) pass s = '%s = %s' % (what, val) if not short: s += '\n type = %s' % type(val) ...
[ "Return", "a", "string", "representation", "of", "an", "object" ]
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/lib/stack.py#L330-L348
[ "def", "print_obj", "(", "arg", ",", "val", ",", "format", "=", "None", ",", "short", "=", "False", ")", ":", "what", "=", "arg", "if", "format", ":", "what", "=", "format", "+", "' '", "+", "arg", "val", "=", "Mprint", ".", "printf", "(", "val",...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
Subcmd.lookup
Find subcmd in self.subcmds
trepan/processor/subcmd.py
def lookup(self, subcmd_prefix): """Find subcmd in self.subcmds""" for subcmd_name in list(self.subcmds.keys()): if subcmd_name.startswith(subcmd_prefix) \ and len(subcmd_prefix) >= \ self.subcmds[subcmd_name].__class__.min_abbrev: return self.su...
def lookup(self, subcmd_prefix): """Find subcmd in self.subcmds""" for subcmd_name in list(self.subcmds.keys()): if subcmd_name.startswith(subcmd_prefix) \ and len(subcmd_prefix) >= \ self.subcmds[subcmd_name].__class__.min_abbrev: return self.su...
[ "Find", "subcmd", "in", "self", ".", "subcmds" ]
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/subcmd.py#L28-L36
[ "def", "lookup", "(", "self", ",", "subcmd_prefix", ")", ":", "for", "subcmd_name", "in", "list", "(", "self", ".", "subcmds", ".", "keys", "(", ")", ")", ":", "if", "subcmd_name", ".", "startswith", "(", "subcmd_prefix", ")", "and", "len", "(", "subcm...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
Subcmd.short_help
Show short help for a subcommand.
trepan/processor/subcmd.py
def short_help(self, subcmd_cb, subcmd_name, label=False): """Show short help for a subcommand.""" entry = self.lookup(subcmd_name) if entry: if label: prefix = entry.name else: prefix = '' pass if hasattr(entry,...
def short_help(self, subcmd_cb, subcmd_name, label=False): """Show short help for a subcommand.""" entry = self.lookup(subcmd_name) if entry: if label: prefix = entry.name else: prefix = '' pass if hasattr(entry,...
[ "Show", "short", "help", "for", "a", "subcommand", "." ]
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/subcmd.py#L38-L55
[ "def", "short_help", "(", "self", ",", "subcmd_cb", ",", "subcmd_name", ",", "label", "=", "False", ")", ":", "entry", "=", "self", ".", "lookup", "(", "subcmd_name", ")", "if", "entry", ":", "if", "label", ":", "prefix", "=", "entry", ".", "name", "...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
Subcmd.add
Add subcmd to the available subcommands for this object. It will have the supplied docstring, and subcmd_cb will be called when we want to run the command. min_len is the minimum length allowed to abbreviate the command. in_list indicates with the show command will be run when giving a l...
trepan/processor/subcmd.py
def add(self, subcmd_cb): """Add subcmd to the available subcommands for this object. It will have the supplied docstring, and subcmd_cb will be called when we want to run the command. min_len is the minimum length allowed to abbreviate the command. in_list indicates with the sho...
def add(self, subcmd_cb): """Add subcmd to the available subcommands for this object. It will have the supplied docstring, and subcmd_cb will be called when we want to run the command. min_len is the minimum length allowed to abbreviate the command. in_list indicates with the sho...
[ "Add", "subcmd", "to", "the", "available", "subcommands", "for", "this", "object", ".", "It", "will", "have", "the", "supplied", "docstring", "and", "subcmd_cb", "will", "be", "called", "when", "we", "want", "to", "run", "the", "command", ".", "min_len", "...
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/subcmd.py#L57-L70
[ "def", "add", "(", "self", ",", "subcmd_cb", ")", ":", "subcmd_name", "=", "subcmd_cb", ".", "name", "self", ".", "subcmds", "[", "subcmd_name", "]", "=", "subcmd_cb", "# We keep a list of subcommands to assist command completion", "self", ".", "cmdlist", ".", "ap...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
Subcmd.run
Run subcmd_name with args using obj for the environent
trepan/processor/subcmd.py
def run(self, subcmd_name, arg): """Run subcmd_name with args using obj for the environent""" entry=self.lookup(subcmd_name) if entry: entry['callback'](arg) else: self.cmdproc.undefined_cmd(entry.__class__.name, subcmd_name) pass return
def run(self, subcmd_name, arg): """Run subcmd_name with args using obj for the environent""" entry=self.lookup(subcmd_name) if entry: entry['callback'](arg) else: self.cmdproc.undefined_cmd(entry.__class__.name, subcmd_name) pass return
[ "Run", "subcmd_name", "with", "args", "using", "obj", "for", "the", "environent" ]
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/subcmd.py#L72-L80
[ "def", "run", "(", "self", ",", "subcmd_name", ",", "arg", ")", ":", "entry", "=", "self", ".", "lookup", "(", "subcmd_name", ")", "if", "entry", ":", "entry", "[", "'callback'", "]", "(", "arg", ")", "else", ":", "self", ".", "cmdproc", ".", "unde...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
Subcmd.help
help for subcommands.
trepan/processor/subcmd.py
def help(self, *args): """help for subcommands.""" print(args) subcmd_prefix = args[0] if not subcmd_prefix or len(subcmd_prefix) == 0: self.msg(self.doc) self.msg(""" List of %s subcommands: """ % (self.name)) for subcmd_name in self.list(): ...
def help(self, *args): """help for subcommands.""" print(args) subcmd_prefix = args[0] if not subcmd_prefix or len(subcmd_prefix) == 0: self.msg(self.doc) self.msg(""" List of %s subcommands: """ % (self.name)) for subcmd_name in self.list(): ...
[ "help", "for", "subcommands", "." ]
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/subcmd.py#L83-L102
[ "def", "help", "(", "self", ",", "*", "args", ")", ":", "print", "(", "args", ")", "subcmd_prefix", "=", "args", "[", "0", "]", "if", "not", "subcmd_prefix", "or", "len", "(", "subcmd_prefix", ")", "==", "0", ":", "self", ".", "msg", "(", "self", ...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
yield_sphinx_only_markup
:param file_inp: a `filename` or ``sys.stdin``? :param file_out: a `filename` or ``sys.stdout`?`
rst2html.py
def yield_sphinx_only_markup(lines): """ :param file_inp: a `filename` or ``sys.stdin``? :param file_out: a `filename` or ``sys.stdout`?` """ substs = [ ## Selected Sphinx-only Roles. # (r':abbr:`([^`]+)`', r'\1'), (r':ref:`([^`]+)`', r'`\1`_')...
def yield_sphinx_only_markup(lines): """ :param file_inp: a `filename` or ``sys.stdin``? :param file_out: a `filename` or ``sys.stdout`?` """ substs = [ ## Selected Sphinx-only Roles. # (r':abbr:`([^`]+)`', r'\1'), (r':ref:`([^`]+)`', r'`\1`_')...
[ ":", "param", "file_inp", ":", "a", "filename", "or", "sys", ".", "stdin", "?", ":", "param", "file_out", ":", "a", "filename", "or", "sys", ".", "stdout", "?" ]
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/rst2html.py#L14-L65
[ "def", "yield_sphinx_only_markup", "(", "lines", ")", ":", "substs", "=", "[", "## Selected Sphinx-only Roles.", "#", "(", "r':abbr:`([^`]+)`'", ",", "r'\\1'", ")", ",", "(", "r':ref:`([^`]+)`'", ",", "r'`\\1`_'", ")", ",", "(", "r':term:`([^`]+)`'", ",", "r'**\\1...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
run_eval
Evaluate the expression (given as a string) under debugger control starting with the statement subsequent to the place that this appears in your program. This is a wrapper to Debugger.run_eval(), so see that. When run_eval() returns, it returns the value of the expression. Otherwise this function ...
trepan/api.py
def run_eval(expression, debug_opts=None, start_opts=None, globals_=None, locals_=None, tb_fn = None): """Evaluate the expression (given as a string) under debugger control starting with the statement subsequent to the place that this appears in your program. This is a wrapper to Debugger...
def run_eval(expression, debug_opts=None, start_opts=None, globals_=None, locals_=None, tb_fn = None): """Evaluate the expression (given as a string) under debugger control starting with the statement subsequent to the place that this appears in your program. This is a wrapper to Debugger...
[ "Evaluate", "the", "expression", "(", "given", "as", "a", "string", ")", "under", "debugger", "control", "starting", "with", "the", "statement", "subsequent", "to", "the", "place", "that", "this", "appears", "in", "your", "program", "." ]
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/api.py#L45-L68
[ "def", "run_eval", "(", "expression", ",", "debug_opts", "=", "None", ",", "start_opts", "=", "None", ",", "globals_", "=", "None", ",", "locals_", "=", "None", ",", "tb_fn", "=", "None", ")", ":", "dbg", "=", "Mdebugger", ".", "Trepan", "(", "opts", ...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
run_call
Call the function (a function or method object, not a string) with the given arguments starting with the statement subsequent to the place that this appears in your program. When run_call() returns, it returns whatever the function call returned. The debugger prompt appears as soon as the function is ...
trepan/api.py
def run_call(func, debug_opts=None, start_opts=None, *args, **kwds): """Call the function (a function or method object, not a string) with the given arguments starting with the statement subsequent to the place that this appears in your program. When run_call() returns, it returns whatever the functio...
def run_call(func, debug_opts=None, start_opts=None, *args, **kwds): """Call the function (a function or method object, not a string) with the given arguments starting with the statement subsequent to the place that this appears in your program. When run_call() returns, it returns whatever the functio...
[ "Call", "the", "function", "(", "a", "function", "or", "method", "object", "not", "a", "string", ")", "with", "the", "given", "arguments", "starting", "with", "the", "statement", "subsequent", "to", "the", "place", "that", "this", "appears", "in", "your", ...
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/api.py#L71-L87
[ "def", "run_call", "(", "func", ",", "debug_opts", "=", "None", ",", "start_opts", "=", "None", ",", "*", "args", ",", "*", "*", "kwds", ")", ":", "dbg", "=", "Mdebugger", ".", "Trepan", "(", "opts", "=", "debug_opts", ")", "try", ":", "return", "d...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
run_exec
Execute the statement (given as a string) under debugger control starting with the statement subsequent to the place that this run_call appears in your program. This is a wrapper to Debugger.run_exec(), so see that. The debugger prompt appears before any code is executed; you can set breakpoints a...
trepan/api.py
def run_exec(statement, debug_opts=None, start_opts=None, globals_=None, locals_=None): """Execute the statement (given as a string) under debugger control starting with the statement subsequent to the place that this run_call appears in your program. This is a wrapper to Debugger.run_exe...
def run_exec(statement, debug_opts=None, start_opts=None, globals_=None, locals_=None): """Execute the statement (given as a string) under debugger control starting with the statement subsequent to the place that this run_call appears in your program. This is a wrapper to Debugger.run_exe...
[ "Execute", "the", "statement", "(", "given", "as", "a", "string", ")", "under", "debugger", "control", "starting", "with", "the", "statement", "subsequent", "to", "the", "place", "that", "this", "run_call", "appears", "in", "your", "program", "." ]
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/api.py#L90-L114
[ "def", "run_exec", "(", "statement", ",", "debug_opts", "=", "None", ",", "start_opts", "=", "None", ",", "globals_", "=", "None", ",", "locals_", "=", "None", ")", ":", "dbg", "=", "Mdebugger", ".", "Trepan", "(", "opts", "=", "debug_opts", ")", "try"...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
debug
Enter the debugger. Parameters ---------- level : how many stack frames go back. Usually it will be the default 0. But sometimes though there may be calls in setup to the debugger that you may want to skip. step_ignore : how many line events to ignore after the debug() call. 0 means don't even wait for the debug() c...
trepan/api.py
def debug(dbg_opts=None, start_opts=None, post_mortem=True, step_ignore=1, level=0): """ Enter the debugger. Parameters ---------- level : how many stack frames go back. Usually it will be the default 0. But sometimes though there may be calls in setup to the debugger that you may want to skip. step_ig...
def debug(dbg_opts=None, start_opts=None, post_mortem=True, step_ignore=1, level=0): """ Enter the debugger. Parameters ---------- level : how many stack frames go back. Usually it will be the default 0. But sometimes though there may be calls in setup to the debugger that you may want to skip. step_ig...
[ "Enter", "the", "debugger", "." ]
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/api.py#L117-L229
[ "def", "debug", "(", "dbg_opts", "=", "None", ",", "start_opts", "=", "None", ",", "post_mortem", "=", "True", ",", "step_ignore", "=", "1", ",", "level", "=", "0", ")", ":", "if", "not", "isinstance", "(", "Mdebugger", ".", "debugger_obj", ",", "Mdebu...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
HelpCommand.list_categories
List the command categories and a short description of each.
trepan/processor/command/help.py
def list_categories(self): """List the command categories and a short description of each.""" self.section("Classes of commands:") cats = list(categories.keys()) cats.sort() for cat in cats: # Foo! iteritems() doesn't do sorting self.msg(" %-13s -- %s" % (cat, categ...
def list_categories(self): """List the command categories and a short description of each.""" self.section("Classes of commands:") cats = list(categories.keys()) cats.sort() for cat in cats: # Foo! iteritems() doesn't do sorting self.msg(" %-13s -- %s" % (cat, categ...
[ "List", "the", "command", "categories", "and", "a", "short", "description", "of", "each", "." ]
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/command/help.py#L151-L171
[ "def", "list_categories", "(", "self", ")", ":", "self", ".", "section", "(", "\"Classes of commands:\"", ")", "cats", "=", "list", "(", "categories", ".", "keys", "(", ")", ")", "cats", ".", "sort", "(", ")", "for", "cat", "in", "cats", ":", "# Foo! i...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
HelpCommand.show_category
Show short help for all commands in `category'.
trepan/processor/command/help.py
def show_category(self, category, args): """Show short help for all commands in `category'.""" n2cmd = self.proc.commands names = list(n2cmd.keys()) if len(args) == 1 and args[0] == '*': self.section("Commands in class %s:" % category) cmds = [cmd for cmd in names...
def show_category(self, category, args): """Show short help for all commands in `category'.""" n2cmd = self.proc.commands names = list(n2cmd.keys()) if len(args) == 1 and args[0] == '*': self.section("Commands in class %s:" % category) cmds = [cmd for cmd in names...
[ "Show", "short", "help", "for", "all", "commands", "in", "category", "." ]
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/command/help.py#L173-L191
[ "def", "show_category", "(", "self", ",", "category", ",", "args", ")", ":", "n2cmd", "=", "self", ".", "proc", ".", "commands", "names", "=", "list", "(", "n2cmd", ".", "keys", "(", ")", ")", "if", "len", "(", "args", ")", "==", "1", "and", "arg...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
InfoLine.run
Current line number in source file
trepan/processor/command/info_subcmd/line.py
def run(self, args): """Current line number in source file""" # info line identifier if not self.proc.curframe: self.errmsg("No line number information available.") return if len(args) == 3: # lineinfo returns (item, file, lineno) or (None,) ...
def run(self, args): """Current line number in source file""" # info line identifier if not self.proc.curframe: self.errmsg("No line number information available.") return if len(args) == 3: # lineinfo returns (item, file, lineno) or (None,) ...
[ "Current", "line", "number", "in", "source", "file" ]
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/command/info_subcmd/line.py#L94-L126
[ "def", "run", "(", "self", ",", "args", ")", ":", "# info line identifier", "if", "not", "self", ".", "proc", ".", "curframe", ":", "self", ".", "errmsg", "(", "\"No line number information available.\"", ")", "return", "if", "len", "(", "args", ")", "==", ...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
readable
Test whether a path exists and is readable. Returns None for broken symbolic links or a failing stat() and False if the file exists but does not have read permission. True is returned if the file is readable.
trepan/lib/file.py
def readable(path): """Test whether a path exists and is readable. Returns None for broken symbolic links or a failing stat() and False if the file exists but does not have read permission. True is returned if the file is readable.""" try: st = os.stat(path) return 0 != st.st_mode &...
def readable(path): """Test whether a path exists and is readable. Returns None for broken symbolic links or a failing stat() and False if the file exists but does not have read permission. True is returned if the file is readable.""" try: st = os.stat(path) return 0 != st.st_mode &...
[ "Test", "whether", "a", "path", "exists", "and", "is", "readable", ".", "Returns", "None", "for", "broken", "symbolic", "links", "or", "a", "failing", "stat", "()", "and", "False", "if", "the", "file", "exists", "but", "does", "not", "have", "read", "per...
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/lib/file.py#L31-L41
[ "def", "readable", "(", "path", ")", ":", "try", ":", "st", "=", "os", ".", "stat", "(", "path", ")", "return", "0", "!=", "st", ".", "st_mode", "&", "READABLE_MASK", "except", "os", ".", "error", ":", "return", "None", "return", "True" ]
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
lookupmodule
lookupmodule()->(module, file) translates a possibly incomplete file or module name into an absolute file name. None can be returned for either of the values positions of module or file when no or module or file is found.
trepan/lib/file.py
def lookupmodule(name): """lookupmodule()->(module, file) translates a possibly incomplete file or module name into an absolute file name. None can be returned for either of the values positions of module or file when no or module or file is found. """ if sys.modules.get(name): return (s...
def lookupmodule(name): """lookupmodule()->(module, file) translates a possibly incomplete file or module name into an absolute file name. None can be returned for either of the values positions of module or file when no or module or file is found. """ if sys.modules.get(name): return (s...
[ "lookupmodule", "()", "-", ">", "(", "module", "file", ")", "translates", "a", "possibly", "incomplete", "file", "or", "module", "name", "into", "an", "absolute", "file", "name", ".", "None", "can", "be", "returned", "for", "either", "of", "the", "values",...
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/lib/file.py#L44-L71
[ "def", "lookupmodule", "(", "name", ")", ":", "if", "sys", ".", "modules", ".", "get", "(", "name", ")", ":", "return", "(", "sys", ".", "modules", "[", "name", "]", ",", "sys", ".", "modules", "[", "name", "]", ".", "__file__", ")", "if", "os", ...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
parse_position
parse_position(errmsg, arg)->(fn, name, lineno) Parse arg as [filename|module:]lineno Make sure it works for C:\foo\bar.py:12
trepan/lib/file.py
def parse_position(errmsg, arg): """parse_position(errmsg, arg)->(fn, name, lineno) Parse arg as [filename|module:]lineno Make sure it works for C:\foo\bar.py:12 """ colon = arg.rfind(':') if colon >= 0: filename = arg[:colon].rstrip() m, f = lookupmodule(filename) if no...
def parse_position(errmsg, arg): """parse_position(errmsg, arg)->(fn, name, lineno) Parse arg as [filename|module:]lineno Make sure it works for C:\foo\bar.py:12 """ colon = arg.rfind(':') if colon >= 0: filename = arg[:colon].rstrip() m, f = lookupmodule(filename) if no...
[ "parse_position", "(", "errmsg", "arg", ")", "-", ">", "(", "fn", "name", "lineno", ")" ]
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/lib/file.py#L74-L97
[ "def", "parse_position", "(", "errmsg", ",", "arg", ")", ":", "colon", "=", "arg", ".", "rfind", "(", "':'", ")", "if", "colon", ">=", "0", ":", "filename", "=", "arg", "[", ":", "colon", "]", ".", "rstrip", "(", ")", "m", ",", "f", "=", "looku...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
find_debugged_frame
Find the first frame that is a debugged frame. We do this Generally we want traceback information without polluting it with debugger frames. We can tell these because those are frames on the top which don't have f_trace set. So we'll look back from the top to find the fist frame where f_trace is set.
trepan/lib/thred.py
def find_debugged_frame(frame): """Find the first frame that is a debugged frame. We do this Generally we want traceback information without polluting it with debugger frames. We can tell these because those are frames on the top which don't have f_trace set. So we'll look back from the top to find ...
def find_debugged_frame(frame): """Find the first frame that is a debugged frame. We do this Generally we want traceback information without polluting it with debugger frames. We can tell these because those are frames on the top which don't have f_trace set. So we'll look back from the top to find ...
[ "Find", "the", "first", "frame", "that", "is", "a", "debugged", "frame", ".", "We", "do", "this", "Generally", "we", "want", "traceback", "information", "without", "polluting", "it", "with", "debugger", "frames", ".", "We", "can", "tell", "these", "because",...
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/lib/thred.py#L25-L47
[ "def", "find_debugged_frame", "(", "frame", ")", ":", "f_prev", "=", "f", "=", "frame", "while", "f", "is", "not", "None", "and", "f", ".", "f_trace", "is", "None", ":", "f_prev", "=", "f", "f", "=", "f", ".", "f_back", "pass", "if", "f_prev", ":",...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
map_thread_names
Invert threading._active
trepan/lib/thred.py
def map_thread_names(): '''Invert threading._active''' name2id = {} for thread_id in list(threading._active.keys()): thread = threading._active[thread_id] name = thread.getName() if name not in list(name2id.keys()): name2id[name] = thread_id pass pass ...
def map_thread_names(): '''Invert threading._active''' name2id = {} for thread_id in list(threading._active.keys()): thread = threading._active[thread_id] name = thread.getName() if name not in list(name2id.keys()): name2id[name] = thread_id pass pass ...
[ "Invert", "threading", ".", "_active" ]
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/lib/thred.py#L54-L64
[ "def", "map_thread_names", "(", ")", ":", "name2id", "=", "{", "}", "for", "thread_id", "in", "list", "(", "threading", ".", "_active", ".", "keys", "(", ")", ")", ":", "thread", "=", "threading", ".", "_active", "[", "thread_id", "]", "name", "=", "...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
StringArrayInput.open
Use this to set where to read from.
trepan/inout/stringarray.py
def open(self, inp, opts=None): """Use this to set where to read from. """ if isinstance(inp, list): self.input = inp else: raise IOError("Invalid input type (%s) for %s" % (type(inp), inp)) return
def open(self, inp, opts=None): """Use this to set where to read from. """ if isinstance(inp, list): self.input = inp else: raise IOError("Invalid input type (%s) for %s" % (type(inp), inp)) return
[ "Use", "this", "to", "set", "where", "to", "read", "from", "." ]
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/inout/stringarray.py#L37-L44
[ "def", "open", "(", "self", ",", "inp", ",", "opts", "=", "None", ")", ":", "if", "isinstance", "(", "inp", ",", "list", ")", ":", "self", ".", "input", "=", "inp", "else", ":", "raise", "IOError", "(", "\"Invalid input type (%s) for %s\"", "%", "(", ...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
StringArrayInput.readline
Read a line of input. EOFError will be raised on EOF. Note that we don't support prompting
trepan/inout/stringarray.py
def readline(self, use_raw=None, prompt=''): """Read a line of input. EOFError will be raised on EOF. Note that we don't support prompting""" if self.closed: raise ValueError if 0 == len(self.input): self.closed = True raise EOFError line = self.input[0] ...
def readline(self, use_raw=None, prompt=''): """Read a line of input. EOFError will be raised on EOF. Note that we don't support prompting""" if self.closed: raise ValueError if 0 == len(self.input): self.closed = True raise EOFError line = self.input[0] ...
[ "Read", "a", "line", "of", "input", ".", "EOFError", "will", "be", "raised", "on", "EOF", "." ]
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/inout/stringarray.py#L46-L56
[ "def", "readline", "(", "self", ",", "use_raw", "=", "None", ",", "prompt", "=", "''", ")", ":", "if", "self", ".", "closed", ":", "raise", "ValueError", "if", "0", "==", "len", "(", "self", ".", "input", ")", ":", "self", ".", "closed", "=", "Tr...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
StringArrayOutput.open
Use this to set where to write to. output can be a file object or a string. This code raises IOError on error. If another file was previously open upon calling this open, that will be stacked and will come back into use after a close_write().
trepan/inout/stringarray.py
def open(self, output): """Use this to set where to write to. output can be a file object or a string. This code raises IOError on error. If another file was previously open upon calling this open, that will be stacked and will come back into use after a close_write(). "...
def open(self, output): """Use this to set where to write to. output can be a file object or a string. This code raises IOError on error. If another file was previously open upon calling this open, that will be stacked and will come back into use after a close_write(). "...
[ "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/stringarray.py#L79-L92
[ "def", "open", "(", "self", ",", "output", ")", ":", "if", "isinstance", "(", "output", ",", "types", ".", "Listype", ")", ":", "self", ".", "output", "=", "output", "else", ":", "raise", "IOError", "(", "\"Invalid output type (%s) for %s\"", "%", "(", "...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
StringArrayOutput.write
This method the debugger uses to write. In contrast to writeline, no newline is added to the end to `str'.
trepan/inout/stringarray.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.closed: raise ValueError if [] == self.output: self.output = [msg] else: self.output[-1] += msg ...
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.closed: raise ValueError if [] == self.output: self.output = [msg] else: self.output[-1] += msg ...
[ "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/stringarray.py#L94-L104
[ "def", "write", "(", "self", ",", "msg", ")", ":", "if", "self", ".", "closed", ":", "raise", "ValueError", "if", "[", "]", "==", "self", ".", "output", ":", "self", ".", "output", "=", "[", "msg", "]", "else", ":", "self", ".", "output", "[", ...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
default_configfile
Return fully expanded configuration filename location for base_filename. python2 and python3 debuggers share the smae directory: ~/.config/trepan.py
trepan/options.py
def default_configfile(base_filename): '''Return fully expanded configuration filename location for base_filename. python2 and python3 debuggers share the smae directory: ~/.config/trepan.py ''' file_dir = os.path.join(os.environ.get('HOME', '~'), '.config', 'trepanpy') file_dir = Mclifns.path_...
def default_configfile(base_filename): '''Return fully expanded configuration filename location for base_filename. python2 and python3 debuggers share the smae directory: ~/.config/trepan.py ''' file_dir = os.path.join(os.environ.get('HOME', '~'), '.config', 'trepanpy') file_dir = Mclifns.path_...
[ "Return", "fully", "expanded", "configuration", "filename", "location", "for", "base_filename", ".", "python2", "and", "python3", "debuggers", "share", "the", "smae", "directory", ":", "~", "/", ".", "config", "/", "trepan", ".", "py" ]
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/options.py#L25-L35
[ "def", "default_configfile", "(", "base_filename", ")", ":", "file_dir", "=", "os", ".", "path", ".", "join", "(", "os", ".", "environ", ".", "get", "(", "'HOME'", ",", "'~'", ")", ",", "'.config'", ",", "'trepanpy'", ")", "file_dir", "=", "Mclifns", "...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
add_startup_file
Read debugger startup file(s): both python code and debugger profile to dbg_initfiles.
trepan/options.py
def add_startup_file(dbg_initfiles): """ Read debugger startup file(s): both python code and debugger profile to dbg_initfiles.""" startup_python_file = default_configfile('profile.py') if Mfile.readable(startup_python_file): with codecs.open(startup_python_file, 'r', encoding='utf8') as fp: ...
def add_startup_file(dbg_initfiles): """ Read debugger startup file(s): both python code and debugger profile to dbg_initfiles.""" startup_python_file = default_configfile('profile.py') if Mfile.readable(startup_python_file): with codecs.open(startup_python_file, 'r', encoding='utf8') as fp: ...
[ "Read", "debugger", "startup", "file", "(", "s", ")", ":", "both", "python", "code", "and", "debugger", "profile", "to", "dbg_initfiles", "." ]
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/options.py#L37-L52
[ "def", "add_startup_file", "(", "dbg_initfiles", ")", ":", "startup_python_file", "=", "default_configfile", "(", "'profile.py'", ")", "if", "Mfile", ".", "readable", "(", "startup_python_file", ")", ":", "with", "codecs", ".", "open", "(", "startup_python_file", ...
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 optparser is returned. sys_argv is also updated.
trepan/options.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 optparser is returned. 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 optparser is returned. 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/options.py#L54-L246
[ "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/options.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/options.py#L248-L302
[ "def", "_postprocess_options", "(", "dbg", ",", "opts", ")", ":", "# Set dbg.settings['printset']", "print_events", "=", "[", "]", "if", "opts", ".", "fntrace", ":", "print_events", "=", "[", "'c_call'", ",", "'c_return'", ",", "'call'", ",", "'return'", "]", ...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
ClientInterface.read_remote
Send a message back to the server (in contrast to the local user output channel).
trepan/interfaces/client.py
def read_remote(self): '''Send a message back to the server (in contrast to the local user output channel).''' coded_line = self.inout.read_msg() if isinstance(coded_line, bytes): coded_line = coded_line.decode("utf-8") control = coded_line[0] remote_line = co...
def read_remote(self): '''Send a message back to the server (in contrast to the local user output channel).''' coded_line = self.inout.read_msg() if isinstance(coded_line, bytes): coded_line = coded_line.decode("utf-8") control = coded_line[0] remote_line = co...
[ "Send", "a", "message", "back", "to", "the", "server", "(", "in", "contrast", "to", "the", "local", "user", "output", "channel", ")", "." ]
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/interfaces/client.py#L56-L64
[ "def", "read_remote", "(", "self", ")", ":", "coded_line", "=", "self", ".", "inout", ".", "read_msg", "(", ")", "if", "isinstance", "(", "coded_line", ",", "bytes", ")", ":", "coded_line", "=", "coded_line", ".", "decode", "(", "\"utf-8\"", ")", "contro...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
get_an_int
Another get_int() routine, this one simpler and less stylized than get_int(). We eval arg return it as an integer value or None if there was an error in parsing this.
trepan/processor/cmdfns.py
def get_an_int(errmsg, arg, msg_on_error, min_value=None, max_value=None): """Another get_int() routine, this one simpler and less stylized than get_int(). We eval arg return it as an integer value or None if there was an error in parsing this. """ ret_value = None if arg: try: ...
def get_an_int(errmsg, arg, msg_on_error, min_value=None, max_value=None): """Another get_int() routine, this one simpler and less stylized than get_int(). We eval arg return it as an integer value or None if there was an error in parsing this. """ ret_value = None if arg: try: ...
[ "Another", "get_int", "()", "routine", "this", "one", "simpler", "and", "less", "stylized", "than", "get_int", "()", ".", "We", "eval", "arg", "return", "it", "as", "an", "integer", "value", "or", "None", "if", "there", "was", "an", "error", "in", "parsi...
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/cmdfns.py#L74-L100
[ "def", "get_an_int", "(", "errmsg", ",", "arg", ",", "msg_on_error", ",", "min_value", "=", "None", ",", "max_value", "=", "None", ")", ":", "ret_value", "=", "None", "if", "arg", ":", "try", ":", "# eval() is used so we will allow arithmetic expressions,", "# v...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
get_int
If arg is an int, use that otherwise take default.
trepan/processor/cmdfns.py
def get_int(errmsg, arg, default=1, cmdname=None): """If arg is an int, use that otherwise take default.""" if arg: try: # eval() is used so we will allow arithmetic expressions, # variables etc. default = int(eval(arg)) except (SyntaxError, NameError, ValueEr...
def get_int(errmsg, arg, default=1, cmdname=None): """If arg is an int, use that otherwise take default.""" if arg: try: # eval() is used so we will allow arithmetic expressions, # variables etc. default = int(eval(arg)) except (SyntaxError, NameError, ValueEr...
[ "If", "arg", "is", "an", "int", "use", "that", "otherwise", "take", "default", "." ]
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/cmdfns.py#L103-L118
[ "def", "get_int", "(", "errmsg", ",", "arg", ",", "default", "=", "1", ",", "cmdname", "=", "None", ")", ":", "if", "arg", ":", "try", ":", "# eval() is used so we will allow arithmetic expressions,", "# variables etc.", "default", "=", "int", "(", "eval", "("...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
get_onoff
Return True if arg is 'on' or 1 and False arg is 'off' or 0. Any other value is raises ValueError.
trepan/processor/cmdfns.py
def get_onoff(errmsg, arg, default=None, print_error=True): """Return True if arg is 'on' or 1 and False arg is 'off' or 0. Any other value is raises ValueError.""" if not arg: if default is None: if print_error: errmsg("Expecting 'on', 1, 'off', or 0. Got nothing.") ...
def get_onoff(errmsg, arg, default=None, print_error=True): """Return True if arg is 'on' or 1 and False arg is 'off' or 0. Any other value is raises ValueError.""" if not arg: if default is None: if print_error: errmsg("Expecting 'on', 1, 'off', or 0. Got nothing.") ...
[ "Return", "True", "if", "arg", "is", "on", "or", "1", "and", "False", "arg", "is", "off", "or", "0", ".", "Any", "other", "value", "is", "raises", "ValueError", "." ]
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/cmdfns.py#L121-L136
[ "def", "get_onoff", "(", "errmsg", ",", "arg", ",", "default", "=", "None", ",", "print_error", "=", "True", ")", ":", "if", "not", "arg", ":", "if", "default", "is", "None", ":", "if", "print_error", ":", "errmsg", "(", "\"Expecting 'on', 1, 'off', or 0. ...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
run_set_bool
set a Boolean-valued debugger setting. 'obj' is a generally a subcommand that has 'name' and 'debugger.settings' attributes
trepan/processor/cmdfns.py
def run_set_bool(obj, args): """set a Boolean-valued debugger setting. 'obj' is a generally a subcommand that has 'name' and 'debugger.settings' attributes""" try: if 0 == len(args): args = ['on'] obj.debugger.settings[obj.name] = get_onoff(obj.errmsg, args[0]) except ValueError: ...
def run_set_bool(obj, args): """set a Boolean-valued debugger setting. 'obj' is a generally a subcommand that has 'name' and 'debugger.settings' attributes""" try: if 0 == len(args): args = ['on'] obj.debugger.settings[obj.name] = get_onoff(obj.errmsg, args[0]) except ValueError: ...
[ "set", "a", "Boolean", "-", "valued", "debugger", "setting", ".", "obj", "is", "a", "generally", "a", "subcommand", "that", "has", "name", "and", "debugger", ".", "settings", "attributes" ]
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/cmdfns.py#L153-L161
[ "def", "run_set_bool", "(", "obj", ",", "args", ")", ":", "try", ":", "if", "0", "==", "len", "(", "args", ")", ":", "args", "=", "[", "'on'", "]", "obj", ".", "debugger", ".", "settings", "[", "obj", ".", "name", "]", "=", "get_onoff", "(", "o...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
run_set_int
set an Integer-valued debugger setting. 'obj' is a generally a subcommand that has 'name' and 'debugger.settings' attributes
trepan/processor/cmdfns.py
def run_set_int(obj, arg, msg_on_error, min_value=None, max_value=None): """set an Integer-valued debugger setting. 'obj' is a generally a subcommand that has 'name' and 'debugger.settings' attributes""" if '' == arg.strip(): obj.errmsg("You need to supply a number.") return obj.debugger...
def run_set_int(obj, arg, msg_on_error, min_value=None, max_value=None): """set an Integer-valued debugger setting. 'obj' is a generally a subcommand that has 'name' and 'debugger.settings' attributes""" if '' == arg.strip(): obj.errmsg("You need to supply a number.") return obj.debugger...
[ "set", "an", "Integer", "-", "valued", "debugger", "setting", ".", "obj", "is", "a", "generally", "a", "subcommand", "that", "has", "name", "and", "debugger", ".", "settings", "attributes" ]
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/cmdfns.py#L164-L172
[ "def", "run_set_int", "(", "obj", ",", "arg", ",", "msg_on_error", ",", "min_value", "=", "None", ",", "max_value", "=", "None", ")", ":", "if", "''", "==", "arg", ".", "strip", "(", ")", ":", "obj", ".", "errmsg", "(", "\"You need to supply a number.\""...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
run_show_bool
Generic subcommand showing a boolean-valued debugger setting. 'obj' is generally a subcommand that has 'name' and 'debugger.setting' attributes.
trepan/processor/cmdfns.py
def run_show_bool(obj, what=None): """Generic subcommand showing a boolean-valued debugger setting. 'obj' is generally a subcommand that has 'name' and 'debugger.setting' attributes.""" val = show_onoff(obj.debugger.settings[obj.name]) if not what: what = obj.name return obj.msg("%s is %s." % (w...
def run_show_bool(obj, what=None): """Generic subcommand showing a boolean-valued debugger setting. 'obj' is generally a subcommand that has 'name' and 'debugger.setting' attributes.""" val = show_onoff(obj.debugger.settings[obj.name]) if not what: what = obj.name return obj.msg("%s is %s." % (w...
[ "Generic", "subcommand", "showing", "a", "boolean", "-", "valued", "debugger", "setting", ".", "obj", "is", "generally", "a", "subcommand", "that", "has", "name", "and", "debugger", ".", "setting", "attributes", "." ]
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/cmdfns.py#L175-L181
[ "def", "run_show_bool", "(", "obj", ",", "what", "=", "None", ")", ":", "val", "=", "show_onoff", "(", "obj", ".", "debugger", ".", "settings", "[", "obj", ".", "name", "]", ")", "if", "not", "what", ":", "what", "=", "obj", ".", "name", "return", ...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
run_show_int
Generic subcommand integer value display
trepan/processor/cmdfns.py
def run_show_int(obj, what=None): """Generic subcommand integer value display""" val = obj.debugger.settings[obj.name] if not what: what = obj.name return obj.msg("%s is %d." % (what, val))
def run_show_int(obj, what=None): """Generic subcommand integer value display""" val = obj.debugger.settings[obj.name] if not what: what = obj.name return obj.msg("%s is %d." % (what, val))
[ "Generic", "subcommand", "integer", "value", "display" ]
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/cmdfns.py#L184-L188
[ "def", "run_show_int", "(", "obj", ",", "what", "=", "None", ")", ":", "val", "=", "obj", ".", "debugger", ".", "settings", "[", "obj", ".", "name", "]", "if", "not", "what", ":", "what", "=", "obj", ".", "name", "return", "obj", ".", "msg", "(",...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
run_show_val
Generic subcommand value display
trepan/processor/cmdfns.py
def run_show_val(obj, name): """Generic subcommand value display""" val = obj.debugger.settings[obj.name] obj.msg("%s is %s." % (obj.name, obj.cmd.proc._saferepr(val),)) return False
def run_show_val(obj, name): """Generic subcommand value display""" val = obj.debugger.settings[obj.name] obj.msg("%s is %s." % (obj.name, obj.cmd.proc._saferepr(val),)) return False
[ "Generic", "subcommand", "value", "display" ]
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/cmdfns.py#L201-L205
[ "def", "run_show_val", "(", "obj", ",", "name", ")", ":", "val", "=", "obj", ".", "debugger", ".", "settings", "[", "obj", ".", "name", "]", "obj", ".", "msg", "(", "\"%s is %s.\"", "%", "(", "obj", ".", "name", ",", "obj", ".", "cmd", ".", "proc...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
next_opcode
Return the next opcode and offset as a tuple. Tuple (-100, -1000) is returned when reaching the end.
trepan/lib/bytecode.py
def next_opcode(code, offset): '''Return the next opcode and offset as a tuple. Tuple (-100, -1000) is returned when reaching the end.''' n = len(code) while offset < n: op = code[offset] offset += 1 if op >= HAVE_ARGUMENT: offset += 2 pass yield o...
def next_opcode(code, offset): '''Return the next opcode and offset as a tuple. Tuple (-100, -1000) is returned when reaching the end.''' n = len(code) while offset < n: op = code[offset] offset += 1 if op >= HAVE_ARGUMENT: offset += 2 pass yield o...
[ "Return", "the", "next", "opcode", "and", "offset", "as", "a", "tuple", ".", "Tuple", "(", "-", "100", "-", "1000", ")", "is", "returned", "when", "reaching", "the", "end", "." ]
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/lib/bytecode.py#L36-L49
[ "def", "next_opcode", "(", "code", ",", "offset", ")", ":", "n", "=", "len", "(", "code", ")", "while", "offset", "<", "n", ":", "op", "=", "code", "[", "offset", "]", "offset", "+=", "1", "if", "op", ">=", "HAVE_ARGUMENT", ":", "offset", "+=", "...
14e91bc0acce090d67be145b1ac040cab92ac5f3
test
is_def_stmt
Return True if we are looking at a def statement
trepan/lib/bytecode.py
def is_def_stmt(line, frame): """Return True if we are looking at a def statement""" # Should really also check that operand of 'LOAD_CONST' is a code object return (line and _re_def.match(line) and op_at_frame(frame)=='LOAD_CONST' and stmt_contains_opcode(frame.f_code, frame.f_lineno, ...
def is_def_stmt(line, frame): """Return True if we are looking at a def statement""" # Should really also check that operand of 'LOAD_CONST' is a code object return (line and _re_def.match(line) and op_at_frame(frame)=='LOAD_CONST' and stmt_contains_opcode(frame.f_code, frame.f_lineno, ...
[ "Return", "True", "if", "we", "are", "looking", "at", "a", "def", "statement" ]
rocky/python3-trepan
python
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/lib/bytecode.py#L90-L95
[ "def", "is_def_stmt", "(", "line", ",", "frame", ")", ":", "# Should really also check that operand of 'LOAD_CONST' is a code object", "return", "(", "line", "and", "_re_def", ".", "match", "(", "line", ")", "and", "op_at_frame", "(", "frame", ")", "==", "'LOAD_CONS...
14e91bc0acce090d67be145b1ac040cab92ac5f3