當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。