• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python demandimport.disable函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中mercurial.demandimport.disable函数的典型用法代码示例。如果您正苦于以下问题:Python disable函数的具体用法?Python disable怎么用?Python disable使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: shell

def shell(ui, repo, **opts):
    import mercurial
    from mercurial import demandimport
    demandimport.disable()

    objs = {
        'mercurial': mercurial,
        'repo': repo,
        'ui': ui,
    }
    banner = 'repo: %s\nsource: %s' % (repo.root, mercurial.__path__[0])
    try:
        from IPython.config.loader import Config
        from IPython.frontend.terminal.embed import InteractiveShellEmbed as Sh
    except:
        import code, traceback
        traceback.print_exc()
        return code.interact(banner=banner, local=objs)
    else:
        cfg = Config()
        cfg.TerminalInteractiveShell.confirm_exit = False
        pc = cfg.PromptManager
        pc.in_template = '[\#]> '
        pc.in2_template = '.\D.  '
        pc.out_template = '[\#]= '
        return Sh(user_ns=objs, config=cfg, banner1=banner)()
开发者ID:avdd,项目名称:config,代码行数:26,代码来源:hgavdd.py


示例2: critique

def critique(ui, repo, entire=False, node=None, **kwargs):
    """Perform a critique of a changeset."""
    demandimport.disable()

    from flake8.engine import get_style_guide
    from pep8 import DiffReport, parse_udiff

    style = get_style_guide(parse_argv=False, ignore='E128')

    ctx = repo[node]

    if not entire:
        diff = ''.join(ctx.diff())
        style.options.selected_lines = {}
        for k, v in parse_udiff(diff).items():
            if k.startswith('./'):
                k = k[2:]

            style.options.selected_lines[k] = v

        style.options.report = DiffReport(style.options)

    deleted = repo.status(ctx.p1().node(), ctx.node())[2]
    files = [f for f in ctx.files() if f.endswith('.py') and f not in deleted]
    style.check_files(files)

    demandimport.enable()
开发者ID:armenzg,项目名称:version-control-tools,代码行数:27,代码来源:__init__.py


示例3: launch_browser

def launch_browser(ui, request_url):
    # not all python installations have the webbrowser module
    from mercurial import demandimport
    demandimport.disable()
    try:
        import webbrowser
        webbrowser.open(request_url)
    except:
        ui.status('unable to launch browser - webbrowser module not available.')

    demandimport.enable()
开发者ID:Elsvent,项目名称:Shell-Config,代码行数:11,代码来源:__init__.py


示例4: hook

#                                        # inrepo:  branch = mercurial branch
#
#   branch = branchname                  # if set, branch is always branchname

import os

from mercurial.i18n import gettext as _
from mercurial.node import bin, hex, nullid
from mercurial.context import workingctx

# mercurial's on-demand-importing hacks interfere with the:
#from zope.interface import Interface
# that Twisted needs to do, so disable it.
try:
    from mercurial import demandimport
    demandimport.disable()
except ImportError:
    pass

from buildbot.clients import sendchange
from twisted.internet import defer, reactor


def hook(ui, repo, hooktype, node=None, source=None, **kwargs):
    # read config parameters
    master = ui.config('hgbuildbot', 'master')
    if master:
        branchtype = ui.config('hgbuildbot', 'branchtype')
        branch = ui.config('hgbuildbot', 'branch')
    else:
        ui.write("* You must add a [hgbuildbot] section to .hg/hgrc in "
开发者ID:LawrenceChan,项目名称:buildbot,代码行数:31,代码来源:hgbuildbot.py


示例5: patch_pyflakes

# -*- coding: utf-8 -*-
try:
    # The 'demandimport' breaks pyflakes and flake8._pyflakes
    from mercurial import demandimport
except ImportError:
    pass
else:
    demandimport.disable()
import os
import pycodestyle as pep8
import pyflakes
import pyflakes.checker

def patch_pyflakes():
    """Add error codes to Pyflakes messages."""
    codes = dict([line.split()[::-1] for line in (
        'F401 UnusedImport',
        'F402 ImportShadowedByLoopVar',
        'F403 ImportStarUsed',
        'F404 LateFutureImport',
        'F405 ImportStarUsage',
        'F810 Redefined',               # XXX Obsolete?
        'F811 RedefinedWhileUnused',
        'F812 RedefinedInListComp',
        'F821 UndefinedName',
        'F822 UndefinedExport',
        'F823 UndefinedLocal',
        'F831 DuplicateArgument',
        'F841 UnusedVariable',
    )])
开发者ID:letouriste001,项目名称:SmartForest_2.0,代码行数:30,代码来源:_pyflakes.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python demandimport.enable函数代码示例发布时间:2022-05-27
下一篇:
Python context.memfilectx函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap