

def ReadUntilClose(self):
    'Yield packets until a Close packet is received.'
    while True:
        (cmd, data) = self.ReadUntil('CLSE', 'WRTE')
        if (cmd == 'CLSE'):
            self._Send('CLSE', arg0=self.local_id, arg1=self.remote_id)
            break
        if (cmd != 'WRTE'):
            if (self == 'FAIL'):
                raise usb_exceptions.AdbCommandFailureException('Command failed.', data)
            raise InvalidCommandError('Expected a WRITE or a CLOSE, got %s (%s)', cmd, data)
        (yield data)

dataset/ETHPy150Open google/python-adb/adb/adb_protocol.py _AdbConnection.ReadUntilClose/VarMisuse@74/118 `cmd`->`self`