Exemplo n.º 1
0
 def send_to_all(self, data):
     # Send
     self.log.debug("Sending '{}' to all output ports".format(data))
     packets = {
         p: IP.InformationPacket(data, owner=self)
         for p, v in self.outputs.items()
     }
     futures = self.outputs.send_packets(packets)
     return futures
Exemplo n.º 2
0
 async def __call__(self):
     pattern = await self.inputs.pattern.receive()
     while True:
         p = await self.inputs.IN.receive_packet()
         p1 = IP.InformationPacket(p.path.replace(*self.pattern),
                                   owner=self)
         p.drop()
         await self.outputs.OUT.send_packet(p1)
         await asyncio.sleep(0)
Exemplo n.º 3
0
 async def __call__(self):
     pattern = await self.inputs.pattern.receive()
     files = _glob.glob(pattern)
     start_message = "using glob pattern {} will emit {} files: {}".format(
         pattern, len(files), files)
     self.log.info(start_message)
     for file in files:
         p = IP.InformationPacket(_path.Path(file), owner=self)
         await self.outputs.OUT.send_packet(p)
         await asyncio.sleep(0)
     stop_message = "exahusted list of files"
     self._log.info(stop_message)
     await self.close_downstream()
Exemplo n.º 4
0
 async def __call__(self):
     for file in self.files:
         p = IP.InformationPacket(file, owner=self)
         await self.outputs.OUT.send_packet(p)
         await asyncio.sleep(0)
     await self.close_downstream()
Exemplo n.º 5
0
 def testRepr(self):
     a = IP.InformationPacket('a')
     print(str(a))