當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。