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


Python dispatcher.send函数代码示例

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


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

示例1: __protoPop

 def __protoPop(self, popFunc):
     was_not_empty = self.__len__() != 0
     return_value = popFunc()
     is_empty_now = self.__len__() == 0
     if was_not_empty and is_empty_now:
         dispatcher.send(signal=self.EmptySignal, sender=self)
     return return_value
开发者ID:smartboyathome,项目名称:SmartTE,代码行数:7,代码来源:CustomCollections.py

示例2: node_changed

def node_changed(node):
    """Fire a node changed."""
    dispatcher.send(
        MockNetwork.SIGNAL_NODE,
        node=node,
        network=node._network
    )
开发者ID:azogue,项目名称:home-assistant,代码行数:7,代码来源:zwave.py

示例3: main

def main():
    logger = Logger('dwgetds', 2000, '', True)
    slaveMgr = slaveManager()
    logger.addStuff(slaveMgr)
    tThread = talkerThread(slaveMgr, '') 
    tThread.start() 
    dispatcher.send('DEBUG', 'dwgetds', 'Started dwget slave daemon.')
开发者ID:PHPPlay,项目名称:dwget,代码行数:7,代码来源:dwgetds.py

示例4: poll_for_changes

    def poll_for_changes(self):
        while not self._stop.isSet():

            errors = {}
            responses = {}
            for ci_server in self.ci_servers:
                name = ci_server['name']
                url = ci_server['url']
                username = ci_server.get('username')
                token = ci_server.get('token')
                auth = None
                if username is not None and token is not None:
                    auth = requests.auth.HTTPBasicAuth(username, token)
                try:
                    response = requests.get('{}/cc.xml'.format(url), auth=auth)
                    if response.status_code == 200:
                        responses[name] = response
                    else:
                        raise Exception('ci server {} returned {}: {}'.format(url, response, response.text))
                except Exception as ex:
                    logger.warning(ex)
                    errors[name] = ex

            dispatcher.send(signal="CI_UPDATE", sender=self, responses=responses, errors=errors)
            time.sleep(self._poll_rate)
开发者ID:garyjohnson,项目名称:ci_screen_2,代码行数:25,代码来源:ci_server_poller.py

示例5: shutdown_listener

    def shutdown_listener(self, listenerId):
        """
        Shut down the server associated with a listenerId/name, but DON'T 
        delete it from the database.

        If the listener is a pivot, task the associated agent to kill the redirector.
        """
        
        try:
            # get the listener information
            [ID,name,host,port,cert_path,staging_key,default_delay,default_jitter,default_profile,kill_date,working_hours,listener_type,redirect_target,default_lost_limit] = self.get_listener(listenerId)

            listenerId = int(ID)

            if listenerId in self.listeners:
                # can't shut down hop, foreign, or meter listeners
                if listener_type == "hop" or listener_type == "foreign" or listener_type == "meter":
                    pass
                # if this listener is a pivot, task the associated agent to shut it down
                elif listener_type == "pivot":
                    print helpers.color("[*] Tasking pivot listener to shut down on agent " + name)
                    killCmd = "netsh interface portproxy reset"
                    self.agents.add_agent_task(name, "TASK_SHELL", killCmd)
                else:
                    # otherwise get the server object associated with this listener and shut it down
                    self.listeners[listenerId].shutdown()

                # remove the listener object from the internal cache
                del self.listeners[listenerId]

        except Exception as e:
            dispatcher.send("[!] Error shutting down listener " + str(listenerId), sender="Listeners")
开发者ID:JacobJacob,项目名称:Empire,代码行数:32,代码来源:listeners.py

示例6: newSlave

 def newSlave(self, ip, signal, sender):
     
     if not self.__driver.addSlave(ip):
         self.replyMsg = 'Slave: %s added' % (ip)
     else:
         self.replyMsg = 'Slave: %s already exists' % (ip)
         dispatcher.send('ERROR', 'dwgetd', 'Slave: %s already exists' % (ip))
开发者ID:PHPPlay,项目名称:dwget,代码行数:7,代码来源:dwgetd.py

示例7: BufferConfigDialog

 def BufferConfigDialog(self):
  """Displays a dialog in which you can set buffer speciffic properties."""

  if not hasattr(self.session, 'buffers') or len(self.session.buffers)==0:
   return output.speak(_("No buffers in this session."), 1)
  frame = self.session.frame
  #FIXME!
  try:
   if self.session.kind == "twitter":
    new = gui.configuration.twitter.BufferConfigDialog(self.session, frame, wx.ID_ANY, title=_("%s Buffer Configuration") % self.session.name)
   elif self.session.kind == "solona":
    new = core.gui.solona.buffers.BufferConfigDialog(self.session, frame, wx.ID_ANY, title=_("%s Buffer Configuration") % self.session.name)
   elif self.session.kind == "facebook":
    new = core.gui.facebook.buffers.BufferConfigDialog(self.session, frame, wx.ID_ANY, title=_("%s Buffer Configuration") % self.session.name)
   elif self.session.kind == "bing":
    new = core.gui.bing.buffers.BufferConfigDialog(self.session, frame, wx.ID_ANY, title=_("%s Buffer Configuration") % self.session.name)
   elif self.session.kind == "rss":
    new = core.gui.rss.buffers.BufferConfigDialog(self.session, frame, wx.ID_ANY, title=_("%s Buffer Configuration") % self.session.name)
   else:
    new = ThrowException
  except:
   return logging.exception("%s: Failure in buffer configuration in session" % self.session.name)
  new.SetDefaultValues()
  if new.ShowModal() == wx.ID_OK:
   new.SetNewConfigValues()
   output.speak(_("Configuration saved."), 1)
   dispatcher.send(sender=self.session, signal=signals.config_saved)
  else:
   output.speak(_("Configuration canceled."), True)
  self.session.frame.Show(False)
  new.Destroy()
开发者ID:Piciok,项目名称:TheQube,代码行数:31,代码来源:interface.py

示例8: removeObject

 def removeObject(self, networkObject):
     """
     Remove the indicated object and any dependent objects from the network and any displays.
     
     >>> network.removeObject(network.findNeuron('AVAL'))
     """
     
     if networkObject in self.objects:
         # Determine all of the objects that will need to be removed
         objectsToRemove = set([networkObject])
         objectsToInspect = [networkObject]
         while any(objectsToInspect):
             objectToInspect = objectsToInspect.pop(0)
             dependentObjects = set(objectToInspect.dependentObjects())
             objectsToInspect += list(dependentObjects.difference(objectsToRemove))
             objectsToRemove = objectsToRemove.union(dependentObjects)
         
         # Remove all of the objects.
         for objectToRemove in objectsToRemove:
             objectToRemove.disconnectFromNetwork()
             self.objects.remove(objectToRemove)
             del self.idDict[objectToRemove.networkId]
         
             # Keep the NetworkX graph in sync.
             if objectToRemove.networkId in self.graph:
                 self.graph.remove_node(objectToRemove.networkId)
         
         # Let anyone who cares know that the network was changed.
         dispatcher.send('deletion', self, affectedObjects = objectsToRemove)
开发者ID:mthunemann,项目名称:Neuroptikon,代码行数:29,代码来源:network.py

示例9: __init__

    def __init__(self, name, style, pipe=None, node=None):

        super().__init__(name, style, pipe, node)

        self._branch = node

        dispatcher.send(self._CONNECTOR_CREATED, sender=self, node=node)
开发者ID:ChrisCuts,项目名称:fnode,代码行数:7,代码来源:Pipe.py

示例10: create

    def create(self, properties, expand=None, **params):
        resource_attrs = self.resource_class.get_resource_attributes()
        data = {}

        for k, v in properties.items():
            if isinstance(v, dict) and k in resource_attrs:
                v = self._wrap_resource_attr(resource_attrs[k], v)

            if k in self.resource_class.writable_attrs:
                data[self.to_camel_case(k)] = self._sanitize_property(v)

        params = {self.to_camel_case(k): v for k, v in params.items()}
        if expand:
            params.update({'expand': expand.get_params()})

        created = self.resource_class(
            self._client,
            properties=self._store.create_resource(
                self._get_create_path(),
                data,
                params=params
            )
        )

        dispatcher.send(
            signal=SIGNAL_RESOURCE_CREATED, sender=self.resource_class,
            data=data, params=params)

        return created
开发者ID:lusis,项目名称:stormpath-sdk-python,代码行数:29,代码来源:base.py

示例11: setup_folders

        def setup_folders():
            if not (test_token(token['access_token'])):
                raise ValueError("Could not set up folders, access token invalid")

            base_object = s.get("%s/drive/root:/%s" % (base_url, base_folder))
            if not (base_object.status_code == 200):
                print helpers.color("[*] Creating %s folder" % base_folder)
                params = {'@microsoft.graph.conflictBehavior': 'rename', 'folder': {}, 'name': base_folder}
                base_object = s.post("%s/drive/items/root/children" % base_url, json=params)
            else:
                message = "[*] {} folder already exists".format(base_folder)
                signal = json.dumps({
                    'print' : True,
                    'message': message
                })
                dispatcher.send(signal, sender="listeners/onedrive/{}".format(listener_name))

            for item in [staging_folder, taskings_folder, results_folder]:
                item_object = s.get("%s/drive/root:/%s/%s" % (base_url, base_folder, item))
                if not (item_object.status_code == 200):
                    print helpers.color("[*] Creating %s/%s folder" % (base_folder, item))
                    params = {'@microsoft.graph.conflictBehavior': 'rename', 'folder': {}, 'name': item}
                    item_object = s.post("%s/drive/items/%s/children" % (base_url, base_object.json()['id']), json=params)
                else:
                    message = "[*] {}/{} already exists".format(base_folder, item)
                    signal = json.dumps({
                        'print' : True,
                        'message': message
                    })
                    dispatcher.send(signal, sender="listeners/onedrive/{}".format(listener_name))
开发者ID:0xe7,项目名称:Empire,代码行数:30,代码来源:onedrive.py

示例12: send_command

    def send_command(self, job):

        obj = job[1]
        command_sent = job[3]
        self.set_status(obj, "Connecting")

        try:
            telnet_session = self.establish_telnet(obj.ip_address)

            telnet_session.read_until('>', int(job[2]))
            #self.get_connection(obj, telnet_session, int(job[2]))

            command = command_sent  + " \r"
            #print command
            telnet_session.write(str(command))
            telnet_session.read_until('Sending', int(job[2]))
            result_raw = telnet_session.read_until('>', int(job[2]))
            #print result_raw.split()
            if result_raw.split()[0] != 'command:':
                raise Exception('Command not sent')
            else:
                dispatcher.send(signal="send_command result", 
                                sender=(('Sending ' + str(result_raw)[:-1])))

            telnet_session.close()

            self.set_status(obj, "Success")
            self.notify_send_command_window(obj)

        except Exception as error:
            self.error_processing(obj, error)
开发者ID:AMXAUNZ,项目名称:Magic-DXLink-Configurator,代码行数:31,代码来源:telnet_class.py

示例13: __changeWrapper

 def __changeWrapper(self, function, *args, **kwargs):
     before_length = self.__len__()
     return_value = function(*args, **kwargs)
     after_length = self.__len__()
     if before_length != after_length:
         dispatcher.send(signal=self.ChangedSignal, sender=self)
     return return_value
开发者ID:smartboyathome,项目名称:SmartTE,代码行数:7,代码来源:CustomCollections.py

示例14: __protoAppend

 def __protoAppend(self, x, appendFunc, popfunc):
     was_empty = self.__len__() == 0
     appendFunc(x)
     not_empty_now = self.__len__() != 0
     if was_empty and not_empty_now:
         dispatcher.send(signal=self.NoLongerEmptySignal, sender=self)
     self.__shrinkIfTooBig(popfunc)
开发者ID:smartboyathome,项目名称:SmartTE,代码行数:7,代码来源:CustomCollections.py

示例15: on_ok

    def on_ok(self, sender):
        """
        This callback is called when one task reaches status S_OK.
        It executes on_all_ok when all task in self have reached S_OK.
        """
        logger.debug("in on_ok with sender %s" % sender)

        if self.all_ok: 
            if self.finalized:
                return AttrDict(returncode=0, message="Workflow has been already finalized")

            else:
                # Set finalized here, because on_all_ok might change it (e.g. Relax + EOS in a single workflow)
                self._finalized = True
                try:
                    results = AttrDict(**self.on_all_ok())
                except:
                    self._finalized = False
                    raise

                # Signal to possible observers that the `Workflow` reached S_OK
                logger.info("Workflow %s is finalized and broadcasts signal S_OK" % str(self))
                logger.info("Workflow %s status = %s" % (str(self), self.status))

                if self._finalized:
                    dispatcher.send(signal=self.S_OK, sender=self)

                return results

        return AttrDict(returncode=1, message="Not all tasks are OK!")
开发者ID:petousis,项目名称:pymatgen,代码行数:30,代码来源:workflows.py


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