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


Python reflect.prefixedMethodNames方法代码示例

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


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

示例1: prefixedMethodClassDict

# 需要导入模块: from twisted.python import reflect [as 别名]
# 或者: from twisted.python.reflect import prefixedMethodNames [as 别名]
def prefixedMethodClassDict(clazz, prefix):
    return dict([(name, getattr(clazz, prefix + name)) for name in prefixedMethodNames(clazz, prefix)]) 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:4,代码来源:sux.py

示例2: prefixedMethodObjDict

# 需要导入模块: from twisted.python import reflect [as 别名]
# 或者: from twisted.python.reflect import prefixedMethodNames [as 别名]
def prefixedMethodObjDict(obj, prefix):
    return dict([(name, getattr(obj, prefix + name)) for name in prefixedMethodNames(obj.__class__, prefix)]) 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:4,代码来源:sux.py

示例3: listProcedures

# 需要导入模块: from twisted.python import reflect [as 别名]
# 或者: from twisted.python.reflect import prefixedMethodNames [as 别名]
def listProcedures(self):
        """
        Return a list of the names of all xmlrpc procedures.

        @since: 11.1
        """
        return reflect.prefixedMethodNames(self.__class__, 'xmlrpc_') 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:9,代码来源:xmlrpc.py

示例4: _computeAllowedMethods

# 需要导入模块: from twisted.python import reflect [as 别名]
# 或者: from twisted.python.reflect import prefixedMethodNames [as 别名]
def _computeAllowedMethods(resource):
    """
    Compute the allowed methods on a C{Resource} based on defined render_FOO
    methods. Used when raising C{UnsupportedMethod} but C{Resource} does
    not define C{allowedMethods} attribute.
    """
    allowedMethods = []
    for name in prefixedMethodNames(resource.__class__, "render_"):
        # Potentially there should be an API for encode('ascii') in this
        # situation - an API for taking a Python native string (bytes on Python
        # 2, text on Python 3) and returning a socket-compatible string type.
        allowedMethods.append(name.encode('ascii'))
    return allowedMethods 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:15,代码来源:resource.py

示例5: ctcpQuery_CLIENTINFO

# 需要导入模块: from twisted.python import reflect [as 别名]
# 或者: from twisted.python.reflect import prefixedMethodNames [as 别名]
def ctcpQuery_CLIENTINFO(self, user, channel, data):
        """
        A master index of what CTCP tags this client knows.

        If no arguments are provided, respond with a list of known tags, sorted
        in alphabetical order.
        If an argument is provided, provide human-readable help on
        the usage of that tag.
        """
        nick = user.split('!')[0]
        if not data:
            # XXX: prefixedMethodNames gets methods from my *class*,
            # but it's entirely possible that this *instance* has more
            # methods.
            names = sorted(reflect.prefixedMethodNames(self.__class__,
                                                       'ctcpQuery_'))

            self.ctcpMakeReply(nick, [('CLIENTINFO', ' '.join(names))])
        else:
            args = data.split()
            method = getattr(self, 'ctcpQuery_%s' % (args[0],), None)
            if not method:
                self.ctcpMakeReply(nick, [('ERRMSG',
                                           "CLIENTINFO %s :"
                                           "Unknown query '%s'"
                                           % (data, args[0]))])
                return
            doc = getattr(method, '__doc__', '')
            self.ctcpMakeReply(nick, [('CLIENTINFO', doc)]) 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:31,代码来源:irc.py

示例6: _get_provider_names

# 需要导入模块: from twisted.python import reflect [as 别名]
# 或者: from twisted.python.reflect import prefixedMethodNames [as 别名]
def _get_provider_names(self):
        """
        Find the names of all supported "providers" (eg Vagrant, Rackspace).

        :return: A ``list`` of ``str`` giving all such names.
        """
        return prefixedMethodNames(self.__class__, "_runner_") 
开发者ID:ClusterHQ,项目名称:flocker,代码行数:9,代码来源:acceptance.py

示例7: get_method_obj_dict

# 需要导入模块: from twisted.python import reflect [as 别名]
# 或者: from twisted.python.reflect import prefixedMethodNames [as 别名]
def get_method_obj_dict(obj, prefix):
    names = find_method_names(obj.__class__, prefix)
    return {name: getattr(obj, prefix + name) for name in names} 
开发者ID:nerevu,项目名称:riko,代码行数:5,代码来源:sux.py

示例8: _listFunctions

# 需要导入模块: from twisted.python import reflect [as 别名]
# 或者: from twisted.python.reflect import prefixedMethodNames [as 别名]
def _listFunctions(self):
        """
        Return a list of the names of all xmlrpc methods.
        """
        return reflect.prefixedMethodNames(self.__class__, 'xmlrpc_') 
开发者ID:kuri65536,项目名称:python-for-android,代码行数:7,代码来源:xmlrpc.py

示例9: ctcpQuery_CLIENTINFO

# 需要导入模块: from twisted.python import reflect [as 别名]
# 或者: from twisted.python.reflect import prefixedMethodNames [as 别名]
def ctcpQuery_CLIENTINFO(self, user, channel, data):
        """A master index of what CTCP tags this client knows.

        If no arguments are provided, respond with a list of known tags.
        If an argument is provided, provide human-readable help on
        the usage of that tag.
        """

        nick = string.split(user,"!")[0]
        if not data:
            # XXX: prefixedMethodNames gets methods from my *class*,
            # but it's entirely possible that this *instance* has more
            # methods.
            names = reflect.prefixedMethodNames(self.__class__,
                                                'ctcpQuery_')

            self.ctcpMakeReply(nick, [('CLIENTINFO',
                                       string.join(names, ' '))])
        else:
            args = string.split(data)
            method = getattr(self, 'ctcpQuery_%s' % (args[0],), None)
            if not method:
                self.ctcpMakeReply(nick, [('ERRMSG',
                                           "CLIENTINFO %s :"
                                           "Unknown query '%s'"
                                           % (data, args[0]))])
                return
            doc = getattr(method, '__doc__', '')
            self.ctcpMakeReply(nick, [('CLIENTINFO', doc)]) 
开发者ID:kuri65536,项目名称:python-for-android,代码行数:31,代码来源:irc.py

示例10: getTestCaseNames

# 需要导入模块: from twisted.python import reflect [as 别名]
# 或者: from twisted.python.reflect import prefixedMethodNames [as 别名]
def getTestCaseNames(self, klass):
        """
        Given a class that contains C{TestCase}s, return a list of names of
        methods that probably contain tests.
        """
        return reflect.prefixedMethodNames(klass, self.methodPrefix) 
开发者ID:kuri65536,项目名称:python-for-android,代码行数:8,代码来源:runner.py

示例11: test_reverseKeymap

# 需要导入模块: from twisted.python import reflect [as 别名]
# 或者: from twisted.python.reflect import prefixedMethodNames [as 别名]
def test_reverseKeymap(self):
        """
        Verify that a L{ConsoleInput} has a reverse mapping of the keysym names
        it needs for event handling to their corresponding keysym.
        """
        ci = ConsoleInput(None)
        for eventName in prefixedMethodNames(ConsoleInput, 'key_'):
            keysymName = eventName.split("_")[-1]
            keysymValue = getattr(gtk.keysyms, keysymName)
            self.assertEqual(ci.rkeymap[keysymValue], keysymName) 
开发者ID:kuri65536,项目名称:python-for-android,代码行数:12,代码来源:test_gtk2manhole.py

示例12: connectionMade

# 需要导入模块: from twisted.python import reflect [as 别名]
# 或者: from twisted.python.reflect import prefixedMethodNames [as 别名]
def connectionMade(self):
        self.resultHarvester = ResultHarvester()
        for fn in reflect.prefixedMethodNames(self.__class__, 'decode_'):
            setattr(self, 'handle_' + fn, self.resultHarvester) 
开发者ID:kuri65536,项目名称:python-for-android,代码行数:6,代码来源:test_nmea.py

示例13: _listFunctions

# 需要导入模块: from twisted.python import reflect [as 别名]
# 或者: from twisted.python.reflect import prefixedMethodNames [as 别名]
def _listFunctions(self):
        """Return a list of the names of all ebrpc methods."""
        return reflect.prefixedMethodNames(self.__class__, 'ebrpc_') 
开发者ID:kenorb-contrib,项目名称:BitTorrent,代码行数:5,代码来源:twisted_ebrpc.py

示例14: _listFunctions

# 需要导入模块: from twisted.python import reflect [as 别名]
# 或者: from twisted.python.reflect import prefixedMethodNames [as 别名]
def _listFunctions(self):
        """Return a list of the names of all brpc methods."""
        return reflect.prefixedMethodNames(self.__class__, 'brpc_') 
开发者ID:kenorb-contrib,项目名称:BitTorrent,代码行数:5,代码来源:twisted_brpc.py

示例15: _listFunctions

# 需要导入模块: from twisted.python import reflect [as 别名]
# 或者: from twisted.python.reflect import prefixedMethodNames [as 别名]
def _listFunctions(self):
        """Return a list of the names of all xmlrpc methods."""
        return reflect.prefixedMethodNames(self.__class__, 'xmlrpc_') 
开发者ID:kenorb-contrib,项目名称:BitTorrent,代码行数:5,代码来源:xmlrpc.py


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