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


Python demandimport.enable函数代码示例

本文整理汇总了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;未经允许,请勿转载。