当前位置: 首页>>代码示例>>Python>>正文


Python pdb.pm方法代码示例

本文整理汇总了Python中pdb.pm方法的典型用法代码示例。如果您正苦于以下问题:Python pdb.pm方法的具体用法?Python pdb.pm怎么用?Python pdb.pm使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pdb的用法示例。


在下文中一共展示了pdb.pm方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: cli

# 需要导入模块: import pdb [as 别名]
# 或者: from pdb import pm [as 别名]
def cli(verbose, debug):
    """
    Type -h or --help after any subcommand for more information.

    """
    if verbose:
        pass
        # logger.setLevel(logging.DEBUG)

    if debug:
        import traceback

        try:
            import ipdb as pdb
        except ImportError:
            import pdb

        def _excepthook(exc_type, value, tb):
            traceback.print_exception(exc_type, value, tb)
            print()
            pdb.pm()

        sys.excepthook = _excepthook 
开发者ID:mirnylab,项目名称:cooltools,代码行数:25,代码来源:__init__.py

示例2: start

# 需要导入模块: import pdb [as 别名]
# 或者: from pdb import pm [as 别名]
def start():
    def info(type, value, tb):
        if hasattr(sys, "ps1") or not sys.stderr.isatty():
            # we are in interactive mode or we don't have a tty-like
            # device, so we call the default hook
            sys.__excepthook__(type, value, tb)
        else:
            import traceback
            import pdb

            # we are NOT in interactive mode, print the exception...
            traceback.print_exception(type, value, tb)
            print
            # ...then start the debugger in post-mortem mode.
            # pdb.pm() # deprecated
            pdb.post_mortem(tb)  # more "modern"

    sys.excepthook = info 
开发者ID:facebookresearch,项目名称:ReAgent,代码行数:20,代码来源:debug_on_error.py

示例3: debug_hook

# 需要导入模块: import pdb [as 别名]
# 或者: from pdb import pm [as 别名]
def debug_hook(type_, value, tb):
    if hasattr(sys, 'ps1') or not sys.stderr.isatty():
        sys.__excepthook__(type_, value, tb)
    else:
        import traceback
        import pdb
        traceback.print_exception(type_, value, tb)
        print(u"\n")
        pdb.pm() 
开发者ID:jwplayer,项目名称:jwalk,代码行数:11,代码来源:__main__.py

示例4: debug

# 需要导入模块: import pdb [as 别名]
# 或者: from pdb import pm [as 别名]
def debug(type_, value, tb):
  if hasattr(sys, 'ps1') or not sys.stderr.isatty():
    sys.__excepthook__(type_, value, tb)
  else:
    import traceback
    import pdb
    traceback.print_exception(type_, value, tb)
    print(u"\n")
    pdb.pm() 
开发者ID:cambridgeltl,项目名称:link-prediction_with_deep-learning,代码行数:11,代码来源:__main__.py

示例5: intercept

# 需要导入模块: import pdb [as 别名]
# 或者: from pdb import pm [as 别名]
def intercept (type, value, trace):
	interactive = os.environ.get('PDB',None)

	if interactive in ['0','']:
		# PDB was set to 0 or '' which is undocumented, and we do nothing
		pass
	else:
		bug_report(type, value, trace)
		if interactive == 'true':
			import pdb
			pdb.pm() 
开发者ID:Exa-Networks,项目名称:exaddos,代码行数:13,代码来源:debug.py

示例6: debug_on_error

# 需要导入模块: import pdb [as 别名]
# 或者: from pdb import pm [as 别名]
def debug_on_error(type, value, tb):
    """Code due to Thomas Heller - published in Python Cookbook (O'Reilley)"""
    traceback.print_exc(type, value, tb)
    print()
    pdb.pm()  # jdh uncomment 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:7,代码来源:backend_wx.py

示例7: debug_on_error

# 需要导入模块: import pdb [as 别名]
# 或者: from pdb import pm [as 别名]
def debug_on_error(type, value, tb):
    """Code due to Thomas Heller - published in Python Cookbook (O'Reilly)"""
    import pdb
    import traceback
    traceback.print_exception(type, value, tb)
    print()
    pdb.pm() 
开发者ID:PacktPublishing,项目名称:Mastering-Elasticsearch-7.0,代码行数:9,代码来源:backend_wx.py

示例8: debug_on_error

# 需要导入模块: import pdb [as 别名]
# 或者: from pdb import pm [as 别名]
def debug_on_error(type, value, tb):
    """Code due to Thomas Heller - published in Python Cookbook (O'Reilley)"""
    traceback.print_exception(type, value, tb)
    print()
    pdb.pm()  # jdh uncomment 
开发者ID:Relph1119,项目名称:GraphicDesignPatternByPython,代码行数:7,代码来源:backend_wx.py

示例9: pm

# 需要导入模块: import pdb [as 别名]
# 或者: from pdb import pm [as 别名]
def pm():
    post_mortem(sys.last_traceback)


# Main program for testing 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:7,代码来源:pdb.py

示例10: on_message

# 需要导入模块: import pdb [as 别名]
# 或者: from pdb import pm [as 别名]
def on_message(self, message):
        try:
            message = json.loads(message)
            f = getattr(self, 'on_message_%s' % message['type'], None)
            if f is None:
                raise TypeError('Invalid message type: %r' % message)
            self.application.ioloop.add_callback(f, message['value'])
        except:
            traceback.print_exc()
            pdb.pm() 
开发者ID:jbms,项目名称:beancount-import,代码行数:12,代码来源:webserver.py

示例11: cli

# 需要导入模块: import pdb [as 别名]
# 或者: from pdb import pm [as 别名]
def cli(post_mortem, output_profile):
    '''Flexible tools for Hi-C data processing.

    All pairtools have a few common options, which should be typed _before_ 
    the command name.

    '''
    if post_mortem:
        import traceback
        try:
            import ipdb as pdb
        except ImportError:
            import pdb
        def _excepthook(exc_type, value, tb):
            traceback.print_exception(exc_type, value, tb)
            print()
            pdb.pm()
        sys.excepthook = _excepthook

    if output_profile:
        import cProfile 
        import atexit
        
        pr = cProfile.Profile()
        pr.enable()

        def _atexit_profile_hook():
            pr.disable()
            pr.dump_stats(output_profile)

        atexit.register(_atexit_profile_hook) 
开发者ID:mirnylab,项目名称:pairtools,代码行数:33,代码来源:__init__.py

示例12: ExceptionHookPDB

# 需要导入模块: import pdb [as 别名]
# 或者: from pdb import pm [as 别名]
def ExceptionHookPDB(exctype, value, tb):
    '''
    A custom exception handler, with :py:obj:`pdb` post-mortem for debugging.

    '''

    for line in traceback.format_exception_only(exctype, value):
        log.error(line.replace('\n', ''))
    for line in traceback.format_tb(tb):
        log.error(line.replace('\n', ''))
    sys.__excepthook__(exctype, value, tb)
    pdb.pm() 
开发者ID:rodluger,项目名称:everest,代码行数:14,代码来源:utils.py

示例13: _DebugHandler

# 需要导入模块: import pdb [as 别名]
# 或者: from pdb import pm [as 别名]
def _DebugHandler(exc_class, value, tb):
  if not flags.FLAGS.pdb or hasattr(sys, 'ps1') or not sys.stderr.isatty():
    # we aren't in interactive mode or we don't have a tty-like
    # device, so we call the default hook
    old_excepthook(exc_class, value, tb)
  else:
    # Don't impose import overhead on apps that never raise an exception.
    import traceback
    import pdb
    # we are in interactive mode, print the exception...
    traceback.print_exception(exc_class, value, tb)
    sys.stdout.write('\n')
    # ...then start the debugger in post-mortem mode.
    pdb.pm() 
开发者ID:google,项目名称:google-apputils,代码行数:16,代码来源:debug.py

示例14: info

# 需要导入模块: import pdb [as 别名]
# 或者: from pdb import pm [as 别名]
def info(type, value, tb):
    if hasattr(sys, 'ps1') or not sys.stderr.isatty():
    # we are in interactive mode or we don't have a tty-like
    # device, so we call the default hook
        sys.__excepthook__(type, value, tb)
    else:
        import traceback, pdb
        # we are NOT in interactive mode, print the exceptionceback.print_exception(type, value, tb)
        print
        #tart the debugger in post-mortem mode.
        # pdb.pm() # deprecated
        pdb.post_mortem(tb) # more "modern" 
开发者ID:ksanislo,项目名称:TitleDB,代码行数:14,代码来源:debug.py

示例15: debug

# 需要导入模块: import pdb [as 别名]
# 或者: from pdb import pm [as 别名]
def debug(type_, value, tb):
    if hasattr(sys, 'ps1') or not sys.stderr.isatty():
        # we are in interactive mode or we don't have a tty-like
        # device, so we call the default hook
        sys.__excepthook__(type_, value, tb)
    else:
        import traceback
        import pdb
        # we are NOT in interactive mode, print the exception...
        traceback.print_exception(type_, value, tb)
        print("\n")
        # ...then start the debugger in post-mortem mode.
        pdb.pm() 
开发者ID:viveksck,项目名称:langchangetrack,代码行数:15,代码来源:dummy_regressor.py


注:本文中的pdb.pm方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。