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

Python demandimport.enable函数代码示例

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

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



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

示例1: 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


示例2: 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


示例3: hgweb_handler

def hgweb_handler(environ, start_response):
    from mercurial import demandimport; demandimport.enable()
    #from mercurial.hgweb.hgwebdir_mod import hgwebdir
    #from mercurial.hgweb.request import wsgiapplication
    from mercurial.hgweb import hgweb
     
    hgweb_conf = '/etc/mercurial/hgweb.conf'
    #make_web_app = hgwebdir(hgweb_conf)
    hg_webapp = hgweb(hgweb_conf)
     
    #hg_webapp = wsgiapplication(make_web_app)
    return hg_webapp(environ, start_response)
开发者ID:FomkaV,项目名称:wifi-arsenal,代码行数:12,代码来源:wpp_server.py


示例4: addcommand

import sys, os.path, re
from datetime import datetime
import time
from math import ceil

sys.path.append(os.path.dirname(__file__))

demandimport.disable()
from parsedatetime import parsedatetime as pdt

try:
    import sqlite3 as sqlite
except ImportError:
    from pysqlite2 import dbapi2 as sqlite
demandimport.enable()

testedwith = '3.6'

cal = pdt.Calendar()
PUSHES_PER_PAGE = 10

def addcommand(f, name):
    setattr(hgwebprotocol, name, f)
    hgwebprotocol.__all__.append(name)

def addwebcommand(f, name):
    setattr(hgwebcommands, name, f)
    hgwebcommands.__all__.append(name)

ATOM_MIMETYPE = 'application/atom+xml'
开发者ID:kilikkuo,项目名称:version-control-tools,代码行数:30,代码来源:pushlog-feed.py


示例5: getattr

import sys

# Adjust python path if this is not a system-wide install
#sys.path.insert(0, r'c:\path\to\python\lib')

# Enable tracing. Run 'python -m win32traceutil' to debug
if getattr(sys, 'isapidllhandle', None) is not None:
    import win32traceutil

# To serve pages in local charset instead of UTF-8, remove the two lines below
import os
os.environ['HGENCODING'] = 'UTF-8'


import isapi_wsgi
from mercurial import demandimport; demandimport.enable()
from mercurial.hgweb.hgwebdir_mod import hgwebdir

# Example tweak: Replace isapi_wsgi's handler to provide better error message
# Other stuff could also be done here, like logging errors etc.
class WsgiHandler(isapi_wsgi.IsapiWsgiHandler):
    error_status = '500 Internal Server Error' # less silly error message

isapi_wsgi.IsapiWsgiHandler = WsgiHandler

# Only create the hgwebdir instance once
application = hgwebdir(hgweb_config)

def handler(environ, start_response):

    # Translate IIS's weird URLs
开发者ID:yonas,项目名称:HgWeb-Syntax-Highlighter,代码行数:31,代码来源:hgwebdir_wsgi.py


示例6: add_domain

    def add_domain(a,b): 
        pass

hg_import_error = []
try:
    # The new `demandimport` mechanism doesn't play well with code relying
    # on the `ImportError` exception being caught.
    # OTOH, we can't disable `demandimport` because mercurial relies on it
    # (circular reference issue). So for now, we activate `demandimport`
    # before loading mercurial modules, and desactivate it afterwards.
    #
    # See http://www.selenic.com/mercurial/bts/issue605
    
    try:
        from mercurial import demandimport
        demandimport.enable();
    except ImportError, hg_import_error:
        demandimport = None

    from mercurial import hg
    from mercurial.context import filectx
    from mercurial.ui import ui
    from mercurial.node import hex, short, nullid
    from mercurial.util import pathto, cachefunc
    from mercurial import cmdutil
    from mercurial import extensions
    from mercurial.extensions import loadall

    # Note: due to the nature of demandimport, there will be no actual 
    # import error until those symbols get accessed, so here we go:
    for sym in ("filectx ui hex short nullid pathto "
开发者ID:dokipen,项目名称:trac-hg-plugin,代码行数:31,代码来源:backend.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python encoding.fromlocal函数代码示例发布时间:2022-05-27
下一篇:
Python demandimport.disable函数代码示例发布时间: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