Skip to content

Commit

Permalink
'DEFAULT_TOTAL_TIMEOUT_S' -> 'DEFAULT_READ_TIMEOUT_S'
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffLIrion committed Jun 15, 2020
1 parent 45252f9 commit c8ac0eb
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 22 deletions.
20 changes: 10 additions & 10 deletions adb_shell/adb_device.py
Expand Up @@ -148,7 +148,7 @@ def close(self):
self._available = False
self._transport.close()

def connect(self, rsa_keys=None, transport_timeout_s=None, auth_timeout_s=constants.DEFAULT_AUTH_TIMEOUT_S, read_timeout_s=constants.DEFAULT_TOTAL_TIMEOUT_S, auth_callback=None):
def connect(self, rsa_keys=None, transport_timeout_s=None, auth_timeout_s=constants.DEFAULT_AUTH_TIMEOUT_S, read_timeout_s=constants.DEFAULT_READ_TIMEOUT_S, auth_callback=None):
"""Establish an ADB connection to the device.
1. Use the transport to establish a connection
Expand Down Expand Up @@ -257,7 +257,7 @@ def connect(self, rsa_keys=None, transport_timeout_s=None, auth_timeout_s=consta
# Services #
# #
# ======================================================================= #
def _service(self, service, command, transport_timeout_s=None, read_timeout_s=constants.DEFAULT_TOTAL_TIMEOUT_S, decode=True):
def _service(self, service, command, transport_timeout_s=None, read_timeout_s=constants.DEFAULT_READ_TIMEOUT_S, decode=True):
"""Send an ADB command to the device.
Parameters
Expand Down Expand Up @@ -285,7 +285,7 @@ def _service(self, service, command, transport_timeout_s=None, read_timeout_s=co
return b''.join(self._streaming_command(service, command, adb_info)).decode('utf8')
return b''.join(self._streaming_command(service, command, adb_info))

def _streaming_service(self, service, command, transport_timeout_s=None, read_timeout_s=constants.DEFAULT_TOTAL_TIMEOUT_S, decode=True):
def _streaming_service(self, service, command, transport_timeout_s=None, read_timeout_s=constants.DEFAULT_READ_TIMEOUT_S, decode=True):
"""Send an ADB command to the device, yielding each line of output.
Parameters
Expand Down Expand Up @@ -317,7 +317,7 @@ def _streaming_service(self, service, command, transport_timeout_s=None, read_ti
for line in stream:
yield line

def root(self, transport_timeout_s=None, read_timeout_s=constants.DEFAULT_TOTAL_TIMEOUT_S):
def root(self, transport_timeout_s=None, read_timeout_s=constants.DEFAULT_READ_TIMEOUT_S):
"""Gain root access.
The device must be rooted in order for this to work.
Expand All @@ -336,7 +336,7 @@ def root(self, transport_timeout_s=None, read_timeout_s=constants.DEFAULT_TOTAL_

self._service(b'root', b'', transport_timeout_s, read_timeout_s, False)

def shell(self, command, transport_timeout_s=None, read_timeout_s=constants.DEFAULT_TOTAL_TIMEOUT_S, decode=True):
def shell(self, command, transport_timeout_s=None, read_timeout_s=constants.DEFAULT_READ_TIMEOUT_S, decode=True):
"""Send an ADB shell command to the device.
Parameters
Expand All @@ -362,7 +362,7 @@ def shell(self, command, transport_timeout_s=None, read_timeout_s=constants.DEFA

return self._service(b'shell', command.encode('utf8'), transport_timeout_s, read_timeout_s, decode)

def streaming_shell(self, command, transport_timeout_s=None, read_timeout_s=constants.DEFAULT_TOTAL_TIMEOUT_S, decode=True):
def streaming_shell(self, command, transport_timeout_s=None, read_timeout_s=constants.DEFAULT_READ_TIMEOUT_S, decode=True):
"""Send an ADB shell command to the device, yielding each line of output.
Parameters
Expand Down Expand Up @@ -394,7 +394,7 @@ def streaming_shell(self, command, transport_timeout_s=None, read_timeout_s=cons
# FileSync #
# #
# ======================================================================= #
def list(self, device_path, transport_timeout_s=None, read_timeout_s=constants.DEFAULT_TOTAL_TIMEOUT_S):
def list(self, device_path, transport_timeout_s=None, read_timeout_s=constants.DEFAULT_READ_TIMEOUT_S):
"""Return a directory listing of the given path.
Parameters
Expand Down Expand Up @@ -433,7 +433,7 @@ def list(self, device_path, transport_timeout_s=None, read_timeout_s=constants.D

return files

def pull(self, device_filename, dest_file=None, progress_callback=None, transport_timeout_s=None, read_timeout_s=constants.DEFAULT_TOTAL_TIMEOUT_S):
def pull(self, device_filename, dest_file=None, progress_callback=None, transport_timeout_s=None, read_timeout_s=constants.DEFAULT_READ_TIMEOUT_S):
"""Pull a file from the device.
Parameters
Expand Down Expand Up @@ -518,7 +518,7 @@ def _pull(self, filename, dest, progress_callback, adb_info, filesync_info):
if progress_callback:
progress.send(len(data))

def push(self, source_file, device_filename, st_mode=constants.DEFAULT_PUSH_MODE, mtime=0, progress_callback=None, transport_timeout_s=None, read_timeout_s=constants.DEFAULT_TOTAL_TIMEOUT_S):
def push(self, source_file, device_filename, st_mode=constants.DEFAULT_PUSH_MODE, mtime=0, progress_callback=None, transport_timeout_s=None, read_timeout_s=constants.DEFAULT_READ_TIMEOUT_S):
"""Push a file or directory to the device.
Parameters
Expand Down Expand Up @@ -613,7 +613,7 @@ def _push(self, datafile, filename, st_mode, mtime, progress_callback, adb_info,

raise exceptions.PushFailedError(data)

def stat(self, device_filename, transport_timeout_s=None, read_timeout_s=constants.DEFAULT_TOTAL_TIMEOUT_S):
def stat(self, device_filename, transport_timeout_s=None, read_timeout_s=constants.DEFAULT_READ_TIMEOUT_S):
"""Get a file's ``stat()`` information.
Parameters
Expand Down
20 changes: 10 additions & 10 deletions adb_shell/adb_device_async.py
Expand Up @@ -141,7 +141,7 @@ async def close(self):
self._available = False
await self._transport.close()

async def connect(self, rsa_keys=None, transport_timeout_s=None, auth_timeout_s=constants.DEFAULT_AUTH_TIMEOUT_S, read_timeout_s=constants.DEFAULT_TOTAL_TIMEOUT_S, auth_callback=None):
async def connect(self, rsa_keys=None, transport_timeout_s=None, auth_timeout_s=constants.DEFAULT_AUTH_TIMEOUT_S, read_timeout_s=constants.DEFAULT_READ_TIMEOUT_S, auth_callback=None):
"""Establish an ADB connection to the device.
1. Use the transport to establish a connection
Expand Down Expand Up @@ -250,7 +250,7 @@ async def connect(self, rsa_keys=None, transport_timeout_s=None, auth_timeout_s=
# Services #
# #
# ======================================================================= #
async def _service(self, service, command, transport_timeout_s=None, read_timeout_s=constants.DEFAULT_TOTAL_TIMEOUT_S, decode=True):
async def _service(self, service, command, transport_timeout_s=None, read_timeout_s=constants.DEFAULT_READ_TIMEOUT_S, decode=True):
"""Send an ADB command to the device.
Parameters
Expand Down Expand Up @@ -278,7 +278,7 @@ async def _service(self, service, command, transport_timeout_s=None, read_timeou
return b''.join([x async for x in self._streaming_command(service, command, adb_info)]).decode('utf8')
return b''.join([x async for x in self._streaming_command(service, command, adb_info)])

async def _streaming_service(self, service, command, transport_timeout_s=None, read_timeout_s=constants.DEFAULT_TOTAL_TIMEOUT_S, decode=True):
async def _streaming_service(self, service, command, transport_timeout_s=None, read_timeout_s=constants.DEFAULT_READ_TIMEOUT_S, decode=True):
"""Send an ADB command to the device, yielding each line of output.
Parameters
Expand Down Expand Up @@ -310,7 +310,7 @@ async def _streaming_service(self, service, command, transport_timeout_s=None, r
async for line in stream:
yield line

async def root(self, transport_timeout_s=None, read_timeout_s=constants.DEFAULT_TOTAL_TIMEOUT_S):
async def root(self, transport_timeout_s=None, read_timeout_s=constants.DEFAULT_READ_TIMEOUT_S):
"""Gain root access.
The device must be rooted in order for this to work.
Expand All @@ -329,7 +329,7 @@ async def root(self, transport_timeout_s=None, read_timeout_s=constants.DEFAULT_

await self._service(b'root', b'', transport_timeout_s, read_timeout_s, False)

async def shell(self, command, transport_timeout_s=None, read_timeout_s=constants.DEFAULT_TOTAL_TIMEOUT_S, decode=True):
async def shell(self, command, transport_timeout_s=None, read_timeout_s=constants.DEFAULT_READ_TIMEOUT_S, decode=True):
"""Send an ADB shell command to the device.
Parameters
Expand All @@ -355,7 +355,7 @@ async def shell(self, command, transport_timeout_s=None, read_timeout_s=constant

return await self._service(b'shell', command.encode('utf8'), transport_timeout_s, read_timeout_s, decode)

async def streaming_shell(self, command, transport_timeout_s=None, read_timeout_s=constants.DEFAULT_TOTAL_TIMEOUT_S, decode=True):
async def streaming_shell(self, command, transport_timeout_s=None, read_timeout_s=constants.DEFAULT_READ_TIMEOUT_S, decode=True):
"""Send an ADB shell command to the device, yielding each line of output.
Parameters
Expand Down Expand Up @@ -387,7 +387,7 @@ async def streaming_shell(self, command, transport_timeout_s=None, read_timeout_
# FileSync #
# #
# ======================================================================= #
async def list(self, device_path, transport_timeout_s=None, read_timeout_s=constants.DEFAULT_TOTAL_TIMEOUT_S):
async def list(self, device_path, transport_timeout_s=None, read_timeout_s=constants.DEFAULT_READ_TIMEOUT_S):
"""Return a directory listing of the given path.
Parameters
Expand Down Expand Up @@ -426,7 +426,7 @@ async def list(self, device_path, transport_timeout_s=None, read_timeout_s=const

return files

async def pull(self, device_filename, dest_file=None, progress_callback=None, transport_timeout_s=None, read_timeout_s=constants.DEFAULT_TOTAL_TIMEOUT_S):
async def pull(self, device_filename, dest_file=None, progress_callback=None, transport_timeout_s=None, read_timeout_s=constants.DEFAULT_READ_TIMEOUT_S):
"""Pull a file from the device.
Parameters
Expand Down Expand Up @@ -511,7 +511,7 @@ async def _pull(self, filename, dest, progress_callback, adb_info, filesync_info
if progress_callback:
progress.send(len(data))

async def push(self, source_file, device_filename, st_mode=constants.DEFAULT_PUSH_MODE, mtime=0, progress_callback=None, transport_timeout_s=None, read_timeout_s=constants.DEFAULT_TOTAL_TIMEOUT_S):
async def push(self, source_file, device_filename, st_mode=constants.DEFAULT_PUSH_MODE, mtime=0, progress_callback=None, transport_timeout_s=None, read_timeout_s=constants.DEFAULT_READ_TIMEOUT_S):
"""Push a file or directory to the device.
Parameters
Expand Down Expand Up @@ -606,7 +606,7 @@ async def _push(self, datafile, filename, st_mode, mtime, progress_callback, adb

raise exceptions.PushFailedError(data)

async def stat(self, device_filename, transport_timeout_s=None, read_timeout_s=constants.DEFAULT_TOTAL_TIMEOUT_S):
async def stat(self, device_filename, transport_timeout_s=None, read_timeout_s=constants.DEFAULT_READ_TIMEOUT_S):
"""Get a file's ``stat()`` information.
Parameters
Expand Down
2 changes: 1 addition & 1 deletion adb_shell/constants.py
Expand Up @@ -115,4 +115,4 @@
DEFAULT_AUTH_TIMEOUT_S = 10.

#: Default total timeout (in s) for :meth:`adb_shell.adb_device.AdbDevice._read`
DEFAULT_TOTAL_TIMEOUT_S = 10.
DEFAULT_READ_TIMEOUT_S = 10.
2 changes: 1 addition & 1 deletion adb_shell/hidden_helpers.py
Expand Up @@ -110,7 +110,7 @@ class _AdbTransactionInfo(object): # pylint: disable=too-few-public-methods
:meth:`BaseTransportAsync.bulk_write() <adb_shell.transport.base_transport_async.BaseTransportAsync.bulk_write>`
"""
def __init__(self, local_id, remote_id, transport_timeout_s=None, read_timeout_s=constants.DEFAULT_TOTAL_TIMEOUT_S):
def __init__(self, local_id, remote_id, transport_timeout_s=None, read_timeout_s=constants.DEFAULT_READ_TIMEOUT_S):
self.local_id = local_id
self.remote_id = remote_id
self.transport_timeout_s = transport_timeout_s
Expand Down

0 comments on commit c8ac0eb

Please sign in to comment.