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

Python pysupport.getPackageModules函数代码示例

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

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



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

示例1: makeSuite

def makeSuite():
    """ Automatically create tests and test suites for all tests.

        For this to work, test modules must reside in MoinMoin._tests
        (i.e. right here) and have names starting with "test_", and
        contain test cases with names ending in "TestCase". Each test case
        may contain multiply testAABBCC methods. Those methods will be run by 
        the test suites. See _test_template.py for an example, and use it to
        create new tests.
    """
    result = unittest.TestSuite()
    test_modules = pysupport.getPackageModules(__file__)
    # Sort test modules names by case insensitive compare to get nicer output
    caseInsensitiveCompare = lambda a, b: cmp(a.lower(), b.lower())
    test_modules.sort(caseInsensitiveCompare)

    for mod_name in test_modules:
        if not mod_name.startswith('test_'): continue

        # Import module
        module = __import__(__name__ + '.' + mod_name, 
        	globals(), locals(), ['__file__'])
        # Collect TestCase and create suite for each one
        test_cases = [unittest.makeSuite(obj, 'test') 
            for name, obj in module.__dict__.items()
            if name.endswith('TestCase')]
        
        # Add tests suites
        if test_cases:
            suite = unittest.TestSuite(test_cases)
            result.addTest(suite)

    return result
开发者ID:mikejamesthompson,项目名称:orgsites,代码行数:33,代码来源:__init__.py


示例2: makeSuite

def makeSuite(request, names=None):
    """ Create test suites from modules in names

    @param request: current request
    @param names: module names to get tests from. If the list is empty,
        all test modules in the _tests package are used.
    @rtype: C{unittest.TestSuite}
    @return: test suite with all test cases in names
    """
    if not names:
        from MoinMoin.util.pysupport import getPackageModules
        names = getPackageModules(__file__)
        names = ['%s.%s' % (__name__, name) for name in names
                 if name.startswith('test_')]
        caseInsensitiveCompare = lambda a, b: cmp(a.lower(), b.lower())
        names.sort(caseInsensitiveCompare)
    loader = MoinTestLoader(request)
    return loader.loadTestsFromNames(names)
开发者ID:moinwiki,项目名称:moin-legacy,代码行数:18,代码来源:__init__.py


示例3: __init__

    Additionally to the usual stuff, we provide an ActionBase class here with
    some of the usual base functionality for an action, like checking
    actions_excluded, making and checking tickets, rendering some form,
    displaying errors and doing stuff after an action.
    
    @copyright: 2006 MoinMoin:ThomasWaldmann
    @license: GNU GPL, see COPYING for details.
"""

from MoinMoin.util import pysupport
from MoinMoin import wikiutil
from MoinMoin.Page import Page

# create a list of extension actions from the subpackage directory
import MoinMoin.request
extension_actions = pysupport.getPackageModules(MoinMoin.request.prefix + "/action/__init__.py")
modules = extension_actions

class ActionBase:
    """ action base class with some generic stuff to inherit

    Note: the action name is the class name of the derived class
    """
    def __init__(self, pagename, request):
        self.request = request
        self.form = request.form
        self.cfg = request.cfg
        self._ = _ = request.getText
        self.pagename = pagename
        self.actionname = self.__class__.__name__
        self.use_ticket = False # set this to True if you want to use a ticket
开发者ID:imosts,项目名称:flume,代码行数:31,代码来源:__init__.py


示例4:

# -*- coding: iso-8859-1 -*-
"""
    MoinMoin - Maintenance Script Package

    @copyright: 2006 by Thomas Waldmann
    @license: GNU GPL, see COPYING for details.
"""

from MoinMoin.util import pysupport

# create a list of extension scripts from the subpackage directory
maint_scripts = pysupport.getPackageModules(__file__)
modules = maint_scripts

开发者ID:imosts,项目名称:flume,代码行数:13,代码来源:__init__.py


示例5:

# -*- coding: iso-8859-1 -*-
"""
    MoinMoin - Extension Script Package

    @copyright: 2006 by Thomas Waldmann
    @license: GNU GPL, see COPYING for details.
"""

from MoinMoin.util import pysupport

# create a list of extension scripts from the subpackage directory
extension_scripts = pysupport.getPackageModules(__file__)
modules = extension_scripts

开发者ID:imosts,项目名称:flume,代码行数:13,代码来源:__init__.py


示例6: Event

    This code abstracts event handling in MoinMoin,
    currently for notifications. It implements the observer pattern.

    @copyright: 2007 by Karol Nowak <[email protected]>
    @license: GNU GPL, see COPYING for details.
"""

from MoinMoin import log
logging = log.getLogger(__name__)

from MoinMoin import wikiutil
from MoinMoin.util import pysupport
from MoinMoin.wikiutil import PluginAttributeError

# Create a list of extension actions from the package directory
modules = pysupport.getPackageModules(__file__)

# Dummy pseudo-getText function used in event descriptions,
# so that they get into .po files
_ = lambda x: x


class Event(object):
    """A class handling information common to all events."""

    # NOTE: each Event subclass must have a unique name attribute
    name = u"Event"

    def __init__(self, request):
        self.request = request
开发者ID:IvanLogvinov,项目名称:soar,代码行数:30,代码来源:__init__.py


示例7:

# -*- coding: iso-8859-1 -*-
"""
    MoinMoin - Processor Package

    DEPRECATED!

    Please use Parsers instead of Processors.

    @copyright: 2002 by Jürgen Hermann <[email protected]>
    @license: GNU GPL, see COPYING for details.
"""

from MoinMoin.util import pysupport

processors = pysupport.getPackageModules(__file__)
modules = processors
开发者ID:mikejamesthompson,项目名称:orgsites,代码行数:16,代码来源:__init__.py


示例8: getPlugins

def getPlugins(request):
    dir = os.path.join(request.cfg.plugin_dir, 'action')
    plugins = []
    if os.path.isdir(dir):
        plugins = pysupport.getPackageModules(os.path.join(dir, 'dummy'))
    return dir, plugins
开发者ID:mikejamesthompson,项目名称:orgsites,代码行数:6,代码来源:wikiaction.py


示例9: Waldmann

# -*- coding: iso-8859-1 -*-
"""
    MoinMoin - LogFile package

    @copyright: 2005 by Thomas Waldmann (MoinMoin:ThomasWaldmann)
    @license: GNU GPL, see COPYING for details.
"""

from MoinMoin.util import pysupport

import MoinMoin.request
logfiles = pysupport.getPackageModules(MoinMoin.request.prefix + "/logfile/__init__.py")

开发者ID:imosts,项目名称:flume,代码行数:12,代码来源:__init__.py


示例10: execute

# -*- coding: iso-8859-1 -*-
"""
    MoinMoin - Macro Package

    The canonical interface to macros is their execute() function,
    which gets passed an instance of the Macro class. Such an instance
    has the four members parser, formatter, form and request.

    Using "form" directly is deprecated and should be replaced
    by "request.form".

    Besides the execute() function, macros can export additional
    functions to offer services to other macros or actions. A few
    actually do that, e.g. AttachFile.

    @copyright: 2000 by Jürgen Hermann <[email protected]>
    @license: GNU GPL, see COPYING for details.
"""

from MoinMoin.util import pysupport

import MoinMoin.request
extension_macros = pysupport.getPackageModules(MoinMoin.request.prefix + "/macro/__init__.py")
modules = extension_macros
开发者ID:imosts,项目名称:flume,代码行数:24,代码来源:__init__.py


示例11: execute

# -*- coding: iso-8859-1 -*-
"""
    MoinMoin - Macro Package

    The canonical interface to macros is their execute() function,
    which gets passed an instance of the Macro class. Such an instance
    has the four members parser, formatter, form and request.

    Using "form" directly is deprecated and should be replaced
    by "request.form".

    Besides the execute() function, macros can export additional
    functions to offer services to other macros or actions. A few
    actually do that, e.g. AttachFile.

    @copyright: 2000 by Jürgen Hermann <[email protected]>
    @license: GNU GPL, see COPYING for details.
"""

from MoinMoin.util import pysupport

extension_macros = pysupport.getPackageModules(__file__)
modules = extension_macros
开发者ID:mikejamesthompson,项目名称:orgsites,代码行数:23,代码来源:__init__.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python tree.moin_page函数代码示例发布时间:2022-05-24
下一篇:
Python themes.render_template函数代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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