Lines Matching refs:self

29     def __init__(self, serial):  argument
30 self.serial = serial
31 super(DeviceNotFoundError, self).__init__(
36 def __init__(self): argument
37 super(NoUniqueDeviceError, self).__init__('No unique device')
41 def __init__(self, cmd, stdout, stderr, exit_code): argument
42 super(ShellError, self).__init__(
44 self.cmd = cmd
45 self.stdout = stdout
46 self.stderr = stderr
47 self.exit_code = exit_code
262 def __init__(self, serial, product=None, adb_path='adb'): argument
263 self.serial = serial
264 self.product = product
265 self.adb_path = adb_path
266 self.adb_cmd = [adb_path]
268 if self.serial is not None:
269 self.adb_cmd.extend(['-s', serial])
270 if self.product is not None:
271 self.adb_cmd.extend(['-p', product])
272 self._linesep = None
273 self._features = None
276 def linesep(self): argument
277 if self._linesep is None:
278 self._linesep = subprocess.check_output(
279 self.adb_cmd + ['shell', 'echo']).decode('utf-8')
280 return self._linesep
283 def features(self): argument
284 if self._features is None:
286 self._features = split_lines(self._simple_call(['features']))
288 self._features = []
289 return self._features
291 def has_shell_protocol(self): argument
292 return version(self.adb_cmd) >= 35 and 'shell_v2' in self.features
294 def _make_shell_cmd(self, user_cmd): argument
295 command = self.adb_cmd + ['shell'] + user_cmd
296 if not self.has_shell_protocol():
297 command += self._RETURN_CODE_PROBE
300 def _parse_shell_output(self, out): argument
315 if len(search_text) > self._RETURN_CODE_SEARCH_LENGTH:
318 search_text = search_text[-self._RETURN_CODE_SEARCH_LENGTH:]
319 partition = search_text.rpartition(self._RETURN_CODE_DELIMITER)
328 def _simple_call(self, cmd): argument
329 logging.info(' '.join(self.adb_cmd + cmd))
331 self.adb_cmd + cmd, stderr=subprocess.STDOUT).decode('utf-8')
333 def shell(self, cmd): argument
346 exit_code, stdout, stderr = self.shell_nocheck(cmd)
351 def shell_nocheck(self, cmd): argument
361 cmd = self._make_shell_cmd(cmd)
368 if self.has_shell_protocol():
371 exit_code, stdout = self._parse_shell_output(stdout)
374 def shell_popen(self, cmd, kill_atexit=True, preexec_fn=None, argument
393 command = self.adb_cmd + ['shell'] + cmd
416 def install(self, filename, replace=False): argument
421 return self._simple_call(cmd)
423 def push(self, local, remote, sync=False): argument
439 return self._simple_call(cmd)
441 def pull(self, remote, local): argument
442 return self._simple_call(['pull', remote, local])
444 def sync(self, directory=None): argument
448 return self._simple_call(cmd)
450 def tcpip(self, port): argument
451 return self._simple_call(['tcpip', port])
453 def usb(self): argument
454 return self._simple_call(['usb'])
456 def reboot(self): argument
457 return self._simple_call(['reboot'])
459 def remount(self): argument
460 return self._simple_call(['remount'])
462 def root(self): argument
463 return self._simple_call(['root'])
465 def unroot(self): argument
466 return self._simple_call(['unroot'])
468 def connect(self, host): argument
469 return self._simple_call(['connect', host])
471 def disconnect(self, host): argument
472 return self._simple_call(['disconnect', host])
474 def forward(self, local, remote): argument
475 return self._simple_call(['forward', local, remote])
477 def forward_list(self): argument
478 return self._simple_call(['forward', '--list'])
480 def forward_no_rebind(self, local, remote): argument
481 return self._simple_call(['forward', '--no-rebind', local, remote])
483 def forward_remove(self, local): argument
484 return self._simple_call(['forward', '--remove', local])
486 def forward_remove_all(self): argument
487 return self._simple_call(['forward', '--remove-all'])
489 def reverse(self, remote, local): argument
490 return self._simple_call(['reverse', remote, local])
492 def reverse_list(self): argument
493 return self._simple_call(['reverse', '--list'])
495 def reverse_no_rebind(self, local, remote): argument
496 return self._simple_call(['reverse', '--no-rebind', local, remote])
498 def reverse_remove_all(self): argument
499 return self._simple_call(['reverse', '--remove-all'])
501 def reverse_remove(self, remote): argument
502 return self._simple_call(['reverse', '--remove', remote])
504 def wait(self): argument
505 return self._simple_call(['wait-for-device'])
507 def get_prop(self, prop_name): argument
508 output = split_lines(self.shell(['getprop', prop_name])[0])
517 def set_prop(self, prop_name, value): argument
518 self.shell(['setprop', prop_name, value])