def _format(self, payloads): chunks = [] for payload in payloads: cmd, arg = payload chunks.append( DL_ARGS_SEP.join([cmd, str(arg)]) if arg is not None else cmd) return DL_CMD_SEP.join(chunks)
def _send_payloads(self, prefix, payloads, address=None): data = DL_CMD_SEP.join( [prefix, self._format(payloads), ]) self.transport.write(data, address or self.address)