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


Python Message.register方法代码示例

本文整理汇总了Python中message.Message.register方法的典型用法代码示例。如果您正苦于以下问题:Python Message.register方法的具体用法?Python Message.register怎么用?Python Message.register使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在message.Message的用法示例。


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

示例1: broadcast

# 需要导入模块: from message import Message [as 别名]
# 或者: from message.Message import register [as 别名]
    def broadcast(self):
        network = NetworkScanner.scan_network()
        repeated_devices = Message.addrs(self.msg.id)
        blacklist = NetworkScanner.device_blacklist
        devices = network - repeated_devices - blacklist

        for addr in devices:
            self.emit(self.msg, addr)
            Message.register(self.msg.id, {addr})
开发者ID:flarecast,项目名称:bluetooth,代码行数:11,代码来源:network_scanner.py

示例2: run

# 需要导入模块: from message import Message [as 别名]
# 或者: from message.Message import register [as 别名]
 def run(self):
     try:
         self.sock.connect((self.addr, Listener.DEFAULT_PORT))
         print("SENDING TO " + self.addr)
         self.sock.send(pickle.dumps(self.msg))
         self.sock.close()
         Message.register(self.msg.id, {self.msg.sender})
     except Exception as e:
         self.sock.close()
         if(str(e) == "52"):
             NetworkScanner.device_blacklist.add(self.addr)
         print(self.addr + " :: " + str(e))
         print("IGNORED DEVICE: " + self.addr)
开发者ID:flarecast,项目名称:bluetooth,代码行数:15,代码来源:network_scanner.py

示例3: callback

# 需要导入模块: from message import Message [as 别名]
# 或者: from message.Message import register [as 别名]
    def callback(*args):
        from event_processor import EventProcessor
        handler = MessageHandler._singleton
        msg = f(*args)

        if(handler._valid_message(msg)):
            print("RECEIVED A VALID MESSAGE")
            EventProcessor.handle_message(msg.event)
            handler.emit_event(msg.event, msg.sender, msg.id)
        else:
            # Register the sender of the message
            # in case multiple people are sending us the same message
            # that way we won't send to them
            print("RECEIVED AN INVALID MESSAGE")
            Message.register(msg.id, {msg.sender})
开发者ID:flarecast,项目名称:core,代码行数:17,代码来源:message_handler.py

示例4: broadcast

# 需要导入模块: from message import Message [as 别名]
# 或者: from message.Message import register [as 别名]
 def broadcast(self, msg):
     Message.register(msg.id, {msg.event_creator(), msg.sender})
     self.plugin.broadcast(msg)
开发者ID:flarecast,项目名称:core,代码行数:5,代码来源:message_handler.py


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