本文整理汇总了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)])
示例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)])
示例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_')
示例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
示例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)])
示例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_")
示例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}
示例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_')
示例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)])
示例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)
示例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)
示例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)
示例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_')
示例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_')
示例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_')