Created
August 16, 2015 21:13
-
-
Save rocky/0c3bac4c37484702af3e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| __docformat__ = 'restructuredtext' | |
| __all__ ['api'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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_ignore : how many line events to ignore after the | |
| debug() call. 0 means don't even wait for the debug() call to finish. | |
| param dbg_opts : is an optional "options" dictionary that gets fed | |
| trepan.Debugger(); `start_opts' are the optional "options" | |
| dictionary that gets fed to trepan.Debugger.core.start(). | |
| Use like this:: | |
| ... # Possibly some Python code | |
| import trepan.api # Needed only once | |
| ... # Possibly some more Python code | |
| trepan.api.debug() # You can wrap inside conditional logic too | |
| pass # Stop will be here. | |
| # Below is code you want to use the debugger to do things. | |
| .... # more Python code | |
| # If you get to a place in the program where you aren't going | |
| # want to debug any more, but want to remove debugger trace overhead: | |
| trepan.api.stop() | |
| In situations where you want an immediate stop in the "debug" call | |
| rather than the statement following it ("pass" above), add parameter | |
| step_ignore=0 to debug() like this:: | |
| import trepan.api # Needed only once | |
| # ... as before | |
| trepan.api.debug(step_ignore=0) | |
| # ... as before | |
| Module variable _debugger_obj_ from module trepan.debugger is used as | |
| the debugger instance variable; it can be subsequently used to change | |
| settings or alter behavior. It should be of type Debugger (found in | |
| module trepan). If not, it will get changed to that type:: | |
| $ python | |
| >>> from trepan.debugger import debugger_obj | |
| >>> type(debugger_obj) | |
| <type 'NoneType'> | |
| >>> import trepan.api | |
| >>> trepan.api.debug() | |
| ... | |
| (Trepan) c | |
| >>> from trepan.debugger import debugger_obj | |
| >>> debugger_obj | |
| <trepan.debugger.Debugger instance at 0x7fbcacd514d0> | |
| >>> | |
| If however you want your own separate debugger instance, you can | |
| create it from the debugger _class Debugger()_ from module | |
| trepan.debugger:: | |
| $ python | |
| >>> from trepan.debugger import Debugger | |
| >>> dbgr = Debugger() # Add options as desired | |
| >>> dbgr | |
| <trepan.debugger.Debugger instance at 0x2e25320> | |
| """ | |
| return |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| import sys, os, shlex, sphinx_rtd_theme | |
| extensions = ['sphinx.ext.autodoc', 'numpydoc'] | |
| templates_path = ['_templates'] | |
| source_suffix = '.rst' | |
| master_doc = 'index' | |
| project = u'sphinxtest' | |
| version = '1.0' | |
| release = '1.0' | |
| language = None | |
| pygments_style = 'sphinx' | |
| html_theme = 'sphinx_rtd_theme' | |
| html_static_path = ['_static'] | |
| htmlhelp_basename = 'trepandoc' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| sphinx-apidoc -o modules api.py |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment