Skip to content

Commit

Permalink
Remove unnecessary 'else:' block
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffLIrion committed Nov 26, 2020
1 parent dad00e8 commit 1f97135
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
6 changes: 2 additions & 4 deletions adb_shell/adb_device.py
Expand Up @@ -771,8 +771,9 @@ def _read(self, expected_cmds, adb_info):
if time.time() - start > adb_info.read_timeout_s:
raise exceptions.InvalidCommandError("Never got one of the expected responses: %s (transport_timeout_s = %f, read_timeout_s = %f)" % (expected_cmds, adb_info.transport_timeout_s, adb_info.read_timeout_s))

data = bytearray()

if data_length > 0:
data = bytearray()
while data_length > 0:
temp = self._transport.bulk_read(data_length, adb_info.transport_timeout_s)
_LOGGER.debug("bulk_read(%d): %.1000s", data_length, repr(temp))
Expand All @@ -784,9 +785,6 @@ def _read(self, expected_cmds, adb_info):
if actual_checksum != data_checksum:
raise exceptions.InvalidChecksumError('Received checksum {0} != {1}'.format(actual_checksum, data_checksum))

else:
data = bytearray()

return command, arg0, arg1, bytes(data)

def _read_until(self, expected_cmds, adb_info):
Expand Down
6 changes: 2 additions & 4 deletions adb_shell/adb_device_async.py
Expand Up @@ -766,8 +766,9 @@ async def _read(self, expected_cmds, adb_info):
if time.time() - start > adb_info.read_timeout_s:
raise exceptions.InvalidCommandError("Never got one of the expected responses: %s (transport_timeout_s = %f, read_timeout_s = %f)" % (expected_cmds, adb_info.transport_timeout_s, adb_info.read_timeout_s))

data = bytearray()

if data_length > 0:
data = bytearray()
while data_length > 0:
temp = await self._transport.bulk_read(data_length, adb_info.transport_timeout_s)
_LOGGER.debug("bulk_read(%d): %.1000s", data_length, repr(temp))
Expand All @@ -779,9 +780,6 @@ async def _read(self, expected_cmds, adb_info):
if actual_checksum != data_checksum:
raise exceptions.InvalidChecksumError('Received checksum {0} != {1}'.format(actual_checksum, data_checksum))

else:
data = bytearray()

return command, arg0, arg1, bytes(data)

async def _read_until(self, expected_cmds, adb_info):
Expand Down

0 comments on commit 1f97135

Please sign in to comment.