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


Python rebuild.rebuild函数代码示例

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


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

示例1: privmsg

    def privmsg(self, user, channel, msg):
        """Handles user messages from channels

        This hooks every privmsg sent to the channel and sends the commands off
        to cmds.dispatch to process, then replies to the channel accordingly.

        The @reload command needs to be handled here though, as it allows edits
        to be made to trailbot without disconnecting from IRC. It should get a
        list from cmds.dispatch if it needs to pm someone, otherwise it gets a
        string back and msgs the channel.

        """
        user = user.split('!', 1)[0]

        if msg == '%reload':
            rebuild.rebuild(cmds)
            rebuild.rebuild(voice)
            self.msg(channel, 'reloaded and ready to go')
        else:
            reply = cmds.dispatch(user, msg)

            if type(reply) is types.StringType:
                self.msg(channel, reply)
            else:
                if len(reply):
                    self.msg(channel, reply[0])
                    for trip in reply[1:]:
                        self.msg(user, trip)
开发者ID:nibalizer,项目名称:alphabot,代码行数:28,代码来源:client.py

示例2: loadModule

 def loadModule(self, name):
     for module in getPlugins(IBotModule, heufybot.modules):
         if module.name and module.name.lower() == name.lower():
             rebuild(importlib.import_module(module.__module__))
             self._loadModuleData(module)
             return module.name
     raise ModuleLoaderError(name, "The module could not be found.", ModuleLoadType.LOAD)
开发者ID:Heufneutje,项目名称:PyHeufyBot,代码行数:7,代码来源:modulehandler.py

示例3: testRebuildInteraction

    def testRebuildInteraction(self):
        from twisted.persisted import dirdbm
        from twisted.python import rebuild

        s = dirdbm.Shelf("dirdbm.rebuild.test")
        s["key"] = "value"
        rebuild.rebuild(dirdbm)
开发者ID:ssilverek,项目名称:kodb,代码行数:7,代码来源:test_dirdbm.py

示例4: irc_PRIVMSG

    def irc_PRIVMSG(self, line):
        msg = line.args[1]

        if line.args[0].startswith("#"):
            if msg[1:].startswith(self.nick):
                if msg[1+len(self.nick)+1:].strip() == "pointer":
                    answerURI = self.factory.rootURI + line.args[0][1:].lower() + '/' + line.ztime.rstrip("Z").replace("T", "#")
                    answer = "That line is " + answerURI
                    self.sendLine(Line("NOTICE", [line.args[0], answer]))

        if line.args[0] != self.nick:
            return False # not to us
        if parseprefix(line.prefix)[0] != self.factory.admin:
            return False # not from admin

        if msg == "+rebuild":
            try:
                rebuild(sioclogbot)
                info("rebuilt")
            except:
                print_exc()
        elif msg.startswith("+do "):
            try:
                self.sendLine(Line(linestr=msg[len("+do "):]))
            except:
                print_exc()

        return False # log
开发者ID:tuukka,项目名称:sioclog,代码行数:28,代码来源:sioclogbot.py

示例5: remote_registerClasses

    def remote_registerClasses(self, *args):
        """
        Instructs my broker to register the classes specified by the
        argument(s).

        The classes will be registered for B{all} jobs, and are specified by
        their string representations::
        
            <package(s).module.class>
        
        """
        modules = []
        for stringRep in args:
            # Load the class for the string representation
            cls = reflect.namedObject(stringRep)
            # Register instances of the class, including its type and module
            pb.setUnjellyableForClass(stringRep, cls)
            if cls.__module__ not in modules:
                modules.append(cls.__module__)
        # Try to build the modules for the classes in case they've changed
        # since the last run
        for module in modules:
            try:
                rebuild(reflect.namedModule(module), doLog=False)
            except:
                pass
开发者ID:D3f0,项目名称:txscada,代码行数:26,代码来源:jobs.py

示例6: loadModule

 def loadModule(self, name):
     for module in getPlugins(IBotModule, heufybot.modules):
         if not module.name:
             raise ModuleLoaderError("???", "Module did not provide a name")
         if module.name == name:
             rebuild(importlib.import_module(module.__module__))
             self._loadModuleData(module)
             break
开发者ID:HubbeKing,项目名称:PyHeufyBot,代码行数:8,代码来源:modulehandler.py

示例7: reload

 def reload(self, request):
     request.redirect("..")
     x = []
     write = x.append
     for module in self.modules:
         rebuild.rebuild(module)
         write('<li>reloaded %s<br />' % module.__name__)
     return x
开发者ID:KatiaBorges,项目名称:exeLearning,代码行数:8,代码来源:widgets.py

示例8: bot_rebuild

 def bot_rebuild(self, sender, message, metadata):
     self.loadBotList()
     from twisted.words import botbot
     from twisted.python.rebuild import rebuild
     from twisted.python.reflect import namedModule
     if message:
         rebuild(namedModule(message))
     else:
         rebuild(botbot)
开发者ID:fxia22,项目名称:ASM_xf,代码行数:9,代码来源:botbot.py

示例9: reload

 def reload(self, request):
     request.setHeader("location", "..")
     request.setResponseCode(http.MOVED_PERMANENTLY)
     x = []
     write = x.append
     for module in self.modules:
         rebuild.rebuild(module)
         write('<li>reloaded %s<br>' % module.__name__)
     return x
开发者ID:lhl,项目名称:songclub,代码行数:9,代码来源:widgets.py

示例10: loadModule

    def loadModule(self, name):
        for module in getPlugins(IModule, pymoronbot.modules):
            if module.__class__.__name__ and module.__class__.__name__.lower() == name.lower():
                rebuild(importlib.import_module(module.__module__))
                self._loadModuleData(module)

                print('-- {} loaded'.format(module.__class__.__name__))

                return module.__class__.__name__
开发者ID:MatthewCox,项目名称:PyMoronBot,代码行数:9,代码来源:modulehandler.py

示例11: call_from_console

 def call_from_console(self):
     if len(self.args.split(' ')) < 2:
         return "[Command] Invalid usage. (Usage: reloadplugin <Plugin Name>)"
     modulearg = self.args.split(' ')[1]
     if modulearg not in sys.modules.keys():
         return "That plugin (%s) is not loaded." % modulearg
     output = "[ShipProxy] Reloading plugin: %s..." % modulearg
     rebuild.rebuild(sys.modules[modulearg])
     output += "[ShipProxy] Plugin reloaded!\n"
     return output
开发者ID:Daikui,项目名称:PSO2Proxy,代码行数:10,代码来源:commands.py

示例12: loadModule

    def loadModule(self, name: str, rebuild_: bool=True) -> str:
        for module in getPlugins(IModule, desertbot.modules):
            if module.__class__.__name__ and module.__class__.__name__.lower() == name.lower():
                if rebuild_:
                    rebuild(importlib.import_module(module.__module__))
                self._loadModuleData(module)

                self.logger.info('Module {} loaded'.format(module.__class__.__name__))

                return module.__class__.__name__
开发者ID:DesertBot,项目名称:DesertBot,代码行数:10,代码来源:modulehandler.py

示例13: do_reload

 def do_reload(self, *modules):
     """ try to reload one or more python modules.
         KNOW WHAT YOU ARE DOING!
     """
     self.sendLine("reloading module(s) %s" % ", ".join(modules))
     for m in modules:
         try:
             m_ = import_module(m)
             rebuild.rebuild(m_)
         except Exception, e:
             self.sendLine("reloading module %s threw Exception %s" % (m, e))
开发者ID:serpent-project,项目名称:serpent,代码行数:11,代码来源:console.py

示例14: child_rebuild

 def child_rebuild(self, ctx):
     import pages_base
     rebuild(pages_base)
     import pages_index
     rebuild(pages_index)
     import pages_rooms
     rebuild(pages_rooms)
     import pages_edit
     rebuild(pages_edit)
     import pages_exits
     rebuild(pages_exits)
     self.goback(ctx)
     return self
开发者ID:cryptixman,项目名称:tzmud,代码行数:13,代码来源:pages_base.py

示例15: rebuildPackage

def rebuildPackage(package):
    """Recursively rebuild all loaded modules in the given package"""
    rebuild.rebuild(package)
    # If this is really a package instead of a module, look for children
    try:
        f = package.__file__
    except AttributeError:
        return
    if package.__file__.find("__init__") >= 0:
        for item in package.__dict__.itervalues():
            # Is it a module?
            if type(item) == type(package):
                rebuildPackage(item)
开发者ID:Kays,项目名称:cia-vc,代码行数:13,代码来源:Debug.py


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