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


Python failure.startDebugMode方法代码示例

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


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

示例1: setUp

# 需要导入模块: from twisted.python import failure [as 别名]
# 或者: from twisted.python.failure import startDebugMode [as 别名]
def setUp(self):
        """
        Override pdb.post_mortem so we can make sure it's called.
        """
        # Make sure any changes we make are reversed:
        post_mortem = pdb.post_mortem
        if _shouldEnableNewStyle:
            origInit = failure.Failure.__init__
        else:
            origInit = failure.Failure.__dict__['__init__']
        def restore():
            pdb.post_mortem = post_mortem
            if _shouldEnableNewStyle:
                failure.Failure.__init__ = origInit
            else:
                failure.Failure.__dict__['__init__'] = origInit
        self.addCleanup(restore)

        self.result = []
        pdb.post_mortem = self.result.append
        failure.startDebugMode() 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:23,代码来源:test_failure.py

示例2: process_options

# 需要导入模块: from twisted.python import failure [as 别名]
# 或者: from twisted.python.failure import startDebugMode [as 别名]
def process_options(self, args, opts):
        try:
            self.settings.setdict(arglist_to_dict(opts.set),
                                  priority='cmdline')
        except ValueError:
            raise UsageError("Invalid -s value, use -s NAME=VALUE", print_help=False)

        if opts.logfile:
            self.settings.set('LOG_ENABLED', True, priority='cmdline')
            self.settings.set('LOG_FILE', opts.logfile, priority='cmdline')

        if opts.loglevel:
            self.settings.set('LOG_ENABLED', True, priority='cmdline')
            self.settings.set('LOG_LEVEL', opts.loglevel, priority='cmdline')

        if opts.nolog:
            self.settings.set('LOG_ENABLED', False, priority='cmdline')

        if opts.pidfile:
            with open(opts.pidfile, "w") as f:
                f.write(str(os.getpid()) + os.linesep)

        if opts.pdb:
            failure.startDebugMode() 
开发者ID:wistbean,项目名称:learn_python3_spider,代码行数:26,代码来源:__init__.py

示例3: opt_debug

# 需要导入模块: from twisted.python import failure [as 别名]
# 或者: from twisted.python.failure import startDebugMode [as 别名]
def opt_debug(self):
        """
        Run the application in the Python Debugger (implies nodaemon),
        sending SIGUSR2 will drop into debugger
        """
        defer.setDebugging(True)
        failure.startDebugMode()
        self['debug'] = True 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:10,代码来源:app.py

示例4: test_regularFailure

# 需要导入模块: from twisted.python import failure [as 别名]
# 或者: from twisted.python.failure import startDebugMode [as 别名]
def test_regularFailure(self):
        """
        If startDebugMode() is called, calling Failure() will first call
        pdb.post_mortem with the traceback.
        """
        try:
            1/0
        except:
            typ, exc, tb = sys.exc_info()
            f = failure.Failure()
        self.assertEqual(self.result, [tb])
        self.assertFalse(f.captureVars) 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:14,代码来源:test_failure.py

示例5: test_captureVars

# 需要导入模块: from twisted.python import failure [as 别名]
# 或者: from twisted.python.failure import startDebugMode [as 别名]
def test_captureVars(self):
        """
        If startDebugMode() is called, passing captureVars to Failure() will
        not blow up.
        """
        try:
            1/0
        except:
            typ, exc, tb = sys.exc_info()
            f = failure.Failure(captureVars=True)
        self.assertEqual(self.result, [tb])
        self.assertTrue(f.captureVars) 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:14,代码来源:test_failure.py

示例6: _initialDebugSetup

# 需要导入模块: from twisted.python import failure [as 别名]
# 或者: from twisted.python.failure import startDebugMode [as 别名]
def _initialDebugSetup(config):
    # do this part of debug setup first for easy debugging of import failures
    if config['debug']:
        failure.startDebugMode()
    if config['debug'] or config['debug-stacktraces']:
        defer.setDebugging(True) 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:8,代码来源:trial.py

示例7: setUp

# 需要导入模块: from twisted.python import failure [as 别名]
# 或者: from twisted.python.failure import startDebugMode [as 别名]
def setUp(self):
        """
        Override pdb.post_mortem so we can make sure it's called.
        """
        # Make sure any changes we make are reversed:
        post_mortem = pdb.post_mortem
        origInit = failure.Failure.__init__
        def restore():
            pdb.post_mortem = post_mortem
            failure.Failure.__init__ = origInit
        self.addCleanup(restore)

        self.result = []
        pdb.post_mortem = self.result.append
        failure.startDebugMode() 
开发者ID:wistbean,项目名称:learn_python3_spider,代码行数:17,代码来源:test_failure.py

示例8: opt_debug

# 需要导入模块: from twisted.python import failure [as 别名]
# 或者: from twisted.python.failure import startDebugMode [as 别名]
def opt_debug(self):
        """
        run the application in the Python Debugger (implies nodaemon),
        sending SIGUSR2 will drop into debugger
        """
        defer.setDebugging(True)
        failure.startDebugMode()
        self['debug'] = True 
开发者ID:kuri65536,项目名称:python-for-android,代码行数:10,代码来源:app.py

示例9: cli

# 需要导入模块: from twisted.python import failure [as 别名]
# 或者: from twisted.python.failure import startDebugMode [as 别名]
def cli(ctx, loglevel, config, pdb):
    """
    feeds creates feeds for pages that don't have feeds.
    """
    if pdb:
        failure.startDebugMode()

    # A pip-installed Feeds does not have a scrapy.cfg in its project root.
    os.environ["SCRAPY_SETTINGS_MODULE"] = "feeds.default_settings"

    settings = load_feeds_settings(config)
    settings.set("LOG_LEVEL", loglevel.upper())
    ctx.obj["settings"] = settings 
开发者ID:PyFeeds,项目名称:PyFeeds,代码行数:15,代码来源:cli.py


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