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

Python questions.output函数代码示例

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

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



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

示例1: configure

def configure(advanced):
    from supybot.questions import expect, something, yn, output

    def anything(prompt, default=None):
        """Because supybot is pure fail"""
        from supybot.questions import expect
        return expect(prompt, [], default=default)

    Mess = conf.registerPlugin('Mess', True)

    def getDelay():
        output("What should be the minimum number of seconds between mess output?")
        delay = something("Enter an integer greater or equal to 0", default=Mess.delay._default)

        try:
            delay = int(delay)
            if delay < 0:
                raise TypeError
        except TypeError:
            output("%r is not a valid value, it must be an interger greater or equal to 0" % delay)
            return getDelay()
        else:
            return delay

    output("WARNING: This plugin is unmaintained, may have bugs and is potentially offensive to users")
    Mess.enabled.setValue(yn("Enable this plugin for all channels?", default=Mess.enabled._default))
    Mess.offensive.setValue(yn("Enable possibly offensive content?", default=Mess.offensive._default))
    Mess.delay.setValue(getDelay())
开发者ID:bnrubin,项目名称:ubuntu-bots,代码行数:28,代码来源:config.py


示例2: configure

def configure(advanced):
    from supybot.questions import output, expect, anything, something, yn
    conf.registerPlugin('Dict', True)
    output('The default dictd server is dict.org.')
    if yn('Would you like to specify a different dictd server?'):
        server = something('What server?')
        conf.supybot.plugins.Dict.server.set(server)
开发者ID:Chalks,项目名称:Supybot,代码行数:7,代码来源:config.py


示例3: configurePlugin

 def configurePlugin(module, advanced):
     if hasattr(module, 'configure'):
         output("""Beginning configuration for %s...""" %
                module.Class.__name__)
         module.configure(advanced)
         print # Blank line :)
         output("""Done!""")
     else:
         conf.registerPlugin(module.__name__, currentValue=True)
开发者ID:ephemey,项目名称:ephesite,代码行数:9,代码来源:supybot-wizard.py


示例4: configure

def configure(advanced):
    from supybot.questions import output, yn
    conf.registerPlugin('Google', True)
    output("""The Google plugin has the functionality to watch for URLs
              that match a specific pattern. (We call this a snarfer)
              When supybot sees such a URL, it will parse the web page
              for information and reply with the results.""")
    if yn('Do you want the Google search snarfer enabled by default?'):
        conf.supybot.plugins.Google.searchSnarfer.setValue(True)
开发者ID:nanotube,项目名称:supybot_fixes,代码行数:9,代码来源:config.py


示例5: configure

def configure(advanced):
    # This will be called by supybot to configure this module.  advanced is
    # a bool that specifies whether the user identified himself as an advanced
    # user or not.  You should effect your configuration by manipulating the
    # registry as appropriate.
    from supybot.questions import output, expect, anything, something, yn
    conf.registerPlugin('NACO', True)
    if advanced:
        output('The NACO plugin normalizes text for comparison purposes according to the rules of http://www.loc.gov/catdir/pcc/naco/normrule.html')
开发者ID:D0MF,项目名称:supybot-plugins,代码行数:9,代码来源:config.py


示例6: configure

def configure(advanced):
    from supybot.questions import output, expect, anything, something, yn
    conf.registerPlugin('Relay', True)
    if yn(_('Would you like to relay between any channels?')):
        channels = anything(_('What channels?  Separate them by spaces.'))
        conf.supybot.plugins.Relay.channels.set(channels)
    if yn(_('Would you like to use color to distinguish between nicks?')):
        conf.supybot.plugins.Relay.color.setValue(True)
    output("""Right now there's no way to configure the actual connection to
    the server.  What you'll need to do when the bot finishes starting up is
    use the 'start' command followed by the 'connect' command.  Use the 'help'
    command to see how these two commands should be used.""")
开发者ID:ElectroCode,项目名称:Limnoria,代码行数:12,代码来源:config.py


示例7: configure

def configure(advanced):
    # This will be called by supybot to configure this module.  advanced is
    # a bool that specifies whether the user identified himself as an advanced
    # user or not.  You should effect your configuration by manipulating the
    # registry as appropriate.
    from supybot.questions import output, expect, anything, something, yn
    conf.registerPlugin('Geekquote', True)
    output("""The Geekquote plugin has the ability to watch for geekquote
              (bash.org / qdb.us) URLs and respond to them as though the user
              had asked for the geekquote by ID""")
    if yn('Do you want the Geekquote snarfer enabled by default?'):
        conf.supybot.plugins.Geekquote.geekSnarfer.setValue(True)
开发者ID:D0MF,项目名称:supybot-plugins-1,代码行数:12,代码来源:config.py


示例8: getRepeatdelay

    def getRepeatdelay():
        output("How many seconds should the bot wait before repeating bug information?")
        repeatdelay = something("Enter a number greater or equal to 0.", default=Bugtracker.repeatdelay._default)

        try:
            repeatdelay = int(repeatdelay)
            if repeatdelay < 0:
                raise TypeError
        except TypeError:
            output("Invalid value '%s', it must be an integer greater or equal to 0." % repeatdelay)
            return getRepeatdelay()
        else:
            return repeatdelay
开发者ID:mapreri,项目名称:MPR-supybot,代码行数:13,代码来源:config.py


示例9: getReviewTime

    def getReviewTime():
        output("How many days should the bot wait before requesting a ban/quiet review?")
        review = something("Can be an integer or decimal value. Zero disables reviews.", default=str(Bantracker.request.review._default))

        try:
            review = float(review)
            if review < 0:
                raise TypeError
        except TypeError:
            output("%r is an invalid value, it must be an integer or float greater or equal to 0" % review)
            return getReviewTime()
        else:
            return review
开发者ID:Affix,项目名称:Fedbot,代码行数:13,代码来源:config.py


示例10: getDelay

    def getDelay():
        output("What should be the minimum number of seconds between mess output?")
        delay = something("Enter an integer greater or equal to 0", default=Mess.delay._default)

        try:
            delay = int(delay)
            if delay < 0:
                raise TypeError
        except TypeError:
            output("%r is not a valid value, it must be an interger greater or equal to 0" % delay)
            return getDelay()
        else:
            return delay
开发者ID:bnrubin,项目名称:ubuntu-bots,代码行数:13,代码来源:config.py


示例11: configure

def configure(advanced):
    from supybot.questions import expect, something, yn, output

    def anything(prompt, default=None):
        """Because supybot is pure fail"""
        from supybot.questions import expect
        return expect(prompt, [], default=default)

    Bugtracker = conf.registerPlugin('Bugtracker', True)

    def getRepeatdelay():
        output("How many seconds should the bot wait before repeating bug information?")
        repeatdelay = something("Enter a number greater or equal to 0.", default=Bugtracker.repeatdelay._default)

        try:
            repeatdelay = int(repeatdelay)
            if repeatdelay < 0:
                raise TypeError
        except TypeError:
            output("Invalid value '%s', it must be an integer greater or equal to 0." % repeatdelay)
            return getRepeatdelay()
        else:
            return repeatdelay

    output("Each of the next 3 questions can be set per-channel with the '@config channel' command.")
    bugSnarfer = yn("Enable detecting bugs numbers and URL in all channels?", default=Bugtracker.bugSnarfer._default)
    cveSnarfer = yn("Enable detecting CVE numbers and URL in all channels?", default=Bugtracker.cveSnarfer._default)
    oopsSnarfer = yn("Enable detecting Launchpad OOPS IDs in all channels?", default=Bugtracker.oopsSnarfer._default)
    if advanced:
        replyNoBugtracker = something("What should the bot reply with when a user requests information from an unknown bug tracker?", default=Bugtracker.replyNoBugtracker._default)
        snarfTarget = something("What should be the default bug tracker used when none is specified?", default=Bugtracker.snarfTarget._default)
        replyWhenNotFound = yn("Should the bot report when a bug is not found?", default=Bugtracker.replyWhenNotFound._default)
        repeatdelay = getRepeatdelay()
    else:
        replyNoBugtracker = Bugtracker.replyNoBugtracker._default
        snarfTarget = Bugtracker.snarfTarget._default
        replyWhenNotFound = Bugtracker.replyWhenNotFound._default
        repeatdelay = Bugtracker.repeatdelay._default

    showassignee = yn("Show the assignee of a bug in the reply?", default=Bugtracker.showassignee._default)
    extended = yn("Show tracker-specific extended infomation?", default=Bugtracker.extended._default)

    Bugtracker.bugSnarfer.setValue(bugSnarfer)
    Bugtracker.cveSnarfer.setValue(cveSnarfer)
    Bugtracker.oopsSnarfer.setValue(oopsSnarfer)
    Bugtracker.replyNoBugtracker.setValue(replyNoBugtracker)
    Bugtracker.snarfTarget.setValue(snarfTarget)
    Bugtracker.replyWhenNotFound.setValue(replyWhenNotFound)
    Bugtracker.repeatdelay.setValue(repeatdelay)
    Bugtracker.showassignee.setValue(showassignee)
    Bugtracker.extended.setValue(extended)
开发者ID:mapreri,项目名称:MPR-supybot,代码行数:51,代码来源:config.py


示例12: configure

def configure(advanced):
    # This will be called by supybot to configure this module.  advanced is
    # a bool that specifies whether the user identified himself as an advanced
    # user or not.  You should effect your configuration by manipulating the
    # registry as appropriate.
    from supybot.questions import output, expect, anything, something, yn
    conf.registerPlugin('Insult', True)
    if advanced:
        output("""The Insult plugin constructs an insult in the form of \"You
        are nothing but a(n) {adjective} {amount} of {adjective} {noun}.\"
        """)
        if yn("""Include foul language in pools of randomly chosen adjective,
            amount and noun words?""", default=True):
            conf.supybot.plugins.Insult.allowFoul.setValue(True)
开发者ID:bshum,项目名称:supybot-plugins,代码行数:14,代码来源:config.py


示例13: configure

def configure(advanced):
    # This will be called by supybot to configure this module.  advanced is
    # a bool that specifies whether the user identified themself as an advanced
    # user or not.  You should effect your configuration by manipulating the
    # registry as appropriate.
    from supybot.questions import output, expect, anything, something, yn
    conf.registerPlugin('Unix', True)
    output(_("""The "progstats" command can reveal potentially sensitive
              information about your machine. Here's an example of its output:

              %s\n""") % progstats())
    if yn(_('Would you like to disable this command for non-owner users?'),
          default=True):
        conf.supybot.commands.disabled().add('Unix.progstats')
开发者ID:Hoaas,项目名称:Limnoria,代码行数:14,代码来源:config.py


示例14: loadPlugin

def loadPlugin(name):
    import supybot.plugin as plugin
    try:
        module = plugin.loadPluginModule(name)
        if hasattr(module, 'Class'):
            return module
        else:
            output("""That plugin loaded fine, but didn't seem to be a real
            Supybot plugin; there was no Class variable to tell us what class
            to load when we load the plugin.  We'll skip over it for now, but
            you can always add it later.""")
            return None
    except Exception, e:
        output("""We encountered a bit of trouble trying to load plugin %r.
        Python told us %r.  We'll skip over it for now, you can always add it
        later.""" % (name, utils.gen.exnToString(e)))
        return None
开发者ID:ephemey,项目名称:ephesite,代码行数:17,代码来源:supybot-wizard.py


示例15: configure

def configure(advanced):
    # This will be called by supybot to configure this module.  advanced is
    # a bool that specifies whether the user identified himself as an advanced
    # user or not.  You should effect your configuration by manipulating the
    # registry as appropriate.
    from supybot.questions import output, expect, anything, something, yn

    output("To use the Acronym Finder, you must have obtained a license key.")
    if yn("Do you have a license key?"):
        key = something("What is it?")
        while len(key) != 36:
            output("That is not a valid Acronym Finder license key.")
            if yn("Are you sure you have a valid Acronym Finder license key?"):
                key = something("What is it?")
            else:
                key = ""
                break
        if key:
            conf.registerPlugin("AcronymFinder", True)
            conf.supybot.plugins.AcronymFinder.licenseKey.setValue(key)
    else:
        output(
            """You'll need to get a key before you can use this plugin.
                  You can apply for a key at http://www.acronymfinder.com/dontknowyet/"""
        )
开发者ID:stepnem,项目名称:supybot-plugins,代码行数:25,代码来源:config.py


示例16: configure

def configure(advanced):
    # This will be called by supybot to configure this module.  advanced is
    # a bool that specifies whether the user identified himself as an advanced
    # user or not.  You should effect your configuration by manipulating the
    # registry as appropriate.
    from supybot.questions import output, expect, anything, something, yn

    conf.registerPlugin("Debian", True)
    if not utils.findBinaryInPath("zgrep"):
        if not advanced:
            output(
                """I can't find zgrep in your path.  This is necessary
                      to run the file command.  I'll disable this command
                      now.  When you get zgrep in your path, use the command
                      'enable Debian.file' to re-enable the command."""
            )
            capabilities = conf.supybot.capabilities()
            capabilities.add("-Debian.file")
            conf.supybot.capabilities.set(capabilities)
        else:
            output(
                """I can't find zgrep in your path.  If you want to run
                      the file command with any sort of expediency, you'll
                      need it.  You can use a python equivalent, but it's
                      about two orders of magnitude slower.  THIS MEANS IT
                      WILL TAKE AGES TO RUN THIS COMMAND.  Don't do this."""
            )
            if yn("Do you want to use a Python equivalent of zgrep?"):
                conf.supybot.plugins.Debian.pythonZgrep.setValue(True)
            else:
                output("I'll disable file now.")
                capabilities = conf.supybot.capabilities()
                capabilities.add("-Debian.file")
                conf.supybot.capabilities.set(capabilities)
开发者ID:jtgorman,项目名称:supybot-plugins,代码行数:34,代码来源:config.py


示例17: describePlugin

def describePlugin(module, showUsage):
    if module.__doc__:
        output(module.__doc__, unformatted=False)
    elif hasattr(module.Class, '__doc__'):
        output(module.Class.__doc__, unformatted=False)
    else:
        output("""Unfortunately, this plugin doesn't seem to have any
        documentation.  Sorry about that.""")
    if showUsage:
        if hasattr(module, 'example'):
            if yn('This plugin has a usage example.  '
                  'Would you like to see it?', default=False):
                pydoc.pager(module.example)
        else:
            output("""This plugin has no usage example.""")
开发者ID:ephemey,项目名称:ephesite,代码行数:15,代码来源:supybot-wizard.py


示例18: getDirectoryName

def getDirectoryName(default, basedir=os.curdir, prompt=True):
    done = False
    while not done:
        if prompt:
            dir = something('What directory do you want to use?',
                           default=os.path.join(basedir, default))
        else:
            dir = os.path.join(basedir, default)
        orig_dir = dir
        dir = os.path.expanduser(dir)
        dir = _windowsVarRe.sub(r'$\1', dir)
        dir = os.path.expandvars(dir)
        dir = os.path.abspath(dir)
        try:
            os.makedirs(dir)
            done = True
        except OSError, e:
            if e.args[0] != 17: # File exists.
                output("""Sorry, I couldn't make that directory for some
                reason.  The Operating System told me %s.  You're going to
                have to pick someplace else.""" % e)
                prompt = True
            else:
                done = True
开发者ID:ephemey,项目名称:ephesite,代码行数:24,代码来源:supybot-wizard.py


示例19: configure

def configure(advanced):
    from supybot.questions import yn, something, output
    from supybot.utils.str import format
    import os
    import sqlite
    import re

    def anything(prompt, default=None):
        """Because supybot is pure fail"""
        from supybot.questions import expect
        return expect(prompt, [], default=default)

    Encyclopedia = conf.registerPlugin('Encyclopedia', True)

    enabled = yn("Enable Encyclopedia for all channels?", default=Encyclopedia.enabled._default)
    if advanced:
        datadir = something("Which directory should the factoids database be in?", default=Encyclopedia.datadir._default)
        database = something("What should be the name of the default database (without the .db extension)?", default=Encyclopedia.database._default)
        prefixchar = something("What prefix character should the bot respond to factoid requests with?", default=Encyclopedia.prefixchar._default)
        ignores = set([])
        output("This plugin can be configured to always ignore certain factoid requests, this is useful when you want another plugin to handle them")
        output("For instance, the PackageInfo plugin responds to !info and !find, so those should be ignored in Encyclopedia to allow this to work")
        ignores_i = anything("Which factoid requets should the bot always ignore?", default=', '.join(Encyclopedia.ignores._default))
        for name in re.split(r',?\s', ignores_i):
            ignores.add(name.lower())

        curStable = something("What is short name of the current stable release?", default=Encyclopedia.curStable._default)
        curStableLong = something("What is long name of the current stable release?", default=Encyclopedia.curStableLong._default)
        curStableNum = something("What is version number of the current stable release?", default=Encyclopedia.curStableNum._default)

        curDevel = something("What is short name of the current development release?", default=Encyclopedia.curDevel._default)
        curDevelLong = something("What is long name of the current development release?", default=Encyclopedia.curDevelLong._default)
        curDevelNum = something("What is version number of the current development release?", default=Encyclopedia.curDevelNum._default)

        curLTS = something("What is short name of the current LTS release?", default=Encyclopedia.curLTS._default)
        curLTSLong = something("What is long name of the current LTS release?", default=Encyclopedia.curLTSLong._default)
        curLTSNum = something("What is version number of the current LTS release?", default=Encyclopedia.curLTSNum._default)
    else:
        datadir = Encyclopedia.datadir._default
        database = Encyclopedia.database._default
        prefixchar = Encyclopedia.prefixchar._default
        ignores = Encyclopedia.ignores._default
        curStable = Encyclopedia.curStable._default
        curStableLong = Encyclopedia.curStableLong._default
        curStableNum = Encyclopedia.curStableNum._default
        curDevel = Encyclopedia.curDevel._default
        curDevelLong = Encyclopedia.curDevelLong._default
        curDevelNum = Encyclopedia.curDevelNum._default
        curLTS = Encyclopedia.curLTS._default
        curLTSLong = Encyclopedia.curLTSLong._default
        curLTSNum = Encyclopedia.curLTSNum._default

    relaychannel = anything("What channel/nick should the bot forward alter messages to?", default=Encyclopedia.relaychannel._default)
    output("What message should the bot reply with when a factoid can not be found?")
    notfoundmsg = something("If you include a '%s' in the message, it will be replaced with the requested factoid", default=Encyclopedia.notfoundmsg._default)
    output("When certain factoids are called an alert can be forwarded to a channel/nick")
    output("Which factoids should the bot forward alert calls for?")
    alert = set([])
    alert_i = anything("Separate types by spaces or commas:", default=', '.join(Encyclopedia.alert._default))
    for name in re.split(r',?\s+', alert_i):
        alert.add(name.lower())
    remotedb = anything("Location of a remote database to sync with (used with @sync)", default=Encyclopedia.remotedb._default)
    privateNotFound = yn("Should the bot reply in private when a factoid is not found, as opposed to in the channel?", default=Encyclopedia.privateNotFound._default)
    ignorePrefix = yn('Should the bot respond to factoids whether or not its nick or the prefix character is mentioned?', default=Encyclopedia.ignorePrefix._default)

    Encyclopedia.enabled.setValue(enabled)
    Encyclopedia.datadir.setValue(datadir)
    Encyclopedia.database.setValue(database)
    Encyclopedia.prefixchar.setValue(prefixchar)
    Encyclopedia.ignores.setValue(ignores)
    Encyclopedia.curStable.setValue(curStable)
    Encyclopedia.curStableLong.setValue(curStableLong)
    Encyclopedia.curStableNum.setValue(curStableNum)
    Encyclopedia.curDevel.setValue(curDevel)
    Encyclopedia.curDevelLong.setValue(curDevelLong)
    Encyclopedia.curDevelNum.setValue(curDevelNum)
    Encyclopedia.curLTS.setValue(curLTS)
    Encyclopedia.curLTSLong.setValue(curLTSLong)
    Encyclopedia.curLTSNum.setValue(curLTSNum)
    Encyclopedia.relaychannel.setValue(relaychannel)
    Encyclopedia.notfoundmsg.setValue(notfoundmsg)
    Encyclopedia.alert.setValue(alert)
    Encyclopedia.privateNotFound.setValue(privateNotFound)
    Encyclopedia.ignorePrefix.setValue(ignorePrefix)

    # Create the initial database
    db_dir = Encyclopedia.datadir()
    db_file = Encyclopedia.database()

    if not db_dir:
        db_dir = conf.supybot.directories.data()
        output("supybot.plugins.Encyclopedia.datadir will be set to %r" % db_dir)
        Encyclopedia.datadir.setValue(db_dir)

    if not db_file:
        db_file = 'ubuntu'
        output("supybot.plugins.Encyclopedia.database will be set to %r" % db_file)
        Encyclopedia.database.setValue(db_dir)

    if os.path.exists(os.path.join(db_dir, db_file + '.db')):
#.........这里部分代码省略.........
开发者ID:chibuisimaduka,项目名称:Encyclopedia-2,代码行数:101,代码来源:config.py


示例20: getPlugins

            conf.registerPlugin(module.__name__, currentValue=True)

    plugins = getPlugins(pluginDirs + [plugin._pluginsDir])
    for s in ('Admin', 'User', 'Channel', 'Misc', 'Config'):
        m = loadPlugin(s)
        if m is not None:
            configurePlugin(m, advanced)
        else:
            error('There was an error loading one of the core plugins that '
                  'under almost all circumstances are loaded.  Go ahead and '
                  'fix that error and run this script again.')
    clearLoadedPlugins(plugins, conf.supybot.plugins)

    output("""Now we're going to run you through plugin configuration. There's
           a variety of plugins in supybot by default, but you can create and
           add your own, of course. We'll allow you to take a look at the known
           plugins' descriptions and configure them
           if you like what you see.""")

    # bulk
    addedBulk = False
    if advanced and yn('Would you like to add plugins en masse first?'):
        addedBulk = True
        output(format("""The available plugins are: %L.""", plugins))
        output("""What plugins would you like to add?  If you've changed your
        mind and would rather not add plugins in bulk like this, just press
        enter and we'll move on to the individual plugin configuration.""")
        massPlugins = anything('Separate plugin names by spaces or commas:')
        for name in re.split(r',?\s+', massPlugins):
            module = loadPlugin(name)
            if module is not None:
开发者ID:ephemey,项目名称:ephesite,代码行数:31,代码来源:supybot-wizard.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python questions.yn函数代码示例发布时间:2022-05-27
下一篇:
Python plugins.makeChannelFilename函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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