Here are the examples of the python api twisted.newplugin.getPlugins taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
3 Examples
3
View Complete Implementation : mktap.py
Copyright MIT License
Author : adde88
Copyright MIT License
Author : adde88
def loadPlugins(debug = None, progress = None):
tapLookup = {}
plugins = oldplugin._getPlugIns("tap", debug, progress)
for plug in plugins:
if hasattr(plug, 'tapname'):
shortTapName = plug.tapname
else:
shortTapName = plug.module.split('.')[-1]
tapLookup[shortTapName] = plug
plugins = newplugin.getPlugins(IServiceMaker)
for plug in plugins:
tapLookup[plug.tapname] = plug
return tapLookup
0
View Complete Implementation : lore.py
Copyright MIT License
Author : adde88
Copyright MIT License
Author : adde88
def getProcessor(input, output, config):
plugins = oldplugin._getPlugIns("lore")
for plug in plugins:
if plug.tapname == input:
module = plug.load()
break
else:
plugins = newplugin.getPlugins(IProcessor)
for plug in plugins:
if plug.name == input:
module = reflect.namedModule(plug.moduleName)
break
else:
# try treating it as a module name
try:
module = reflect.namedModule(input)
except ImportError:
print '%s: no such input: %s' % (sys.argv[0], input)
return
try:
return process.getProcessor(module, output, config)
except process.NoProcessorError, e:
print "%s: %s" % (sys.argv[0], e)
0
View Complete Implementation : zshcomp.py
Copyright MIT License
Author : adde88
Copyright MIT License
Author : adde88
def write(self):
"""
Write the completion function to the file given to __init__
@return: C{None}
"""
self.file.write('#compdef %s\n' % (self.cmd_name,))
self.file.write('local _zsh_subcmds_array\n_zsh_subcmds_array=(\n')
from twisted import plugin as newplugin
plugins = newplugin.getPlugins(self.interface)
for p in plugins:
self.file.write('"%s:%s"\n' % (p.tapname, p.description))
self.file.write(")\n\n")
self.options.__clast__.zsh_extras = ['*::subcmd:->subcmd']
gen = ArgumentsGenerator(self.cmd_name, self.options, self.file)
gen.write()
self.file.write("""if (( CURRENT == 1 )); then
_describe "%s" _zsh_subcmds_array && ret=0
fi
(( ret )) || return 0
service="$words[1]"
case $service in\n""" % (self.subcmdLabel,))
plugins = newplugin.getPlugins(self.interface)
for p in plugins:
self.file.write(p.tapname + ")\n")
gen = ArgumentsGenerator(p.tapname, p.options(), self.file)
gen.write()
self.file.write(";;\n")
self.file.write("*) _message \"don't know how to" \
" complete $service\";;\nesac")