|
14 | 14 | from typing import List, Optional, Union |
15 | 15 |
|
16 | 16 | from PIL import Image, UnidentifiedImageError |
| 17 | +from deprecation import deprecated |
17 | 18 |
|
18 | 19 | from adbutils._deprecated import DeprecatedExtension |
19 | 20 | from adbutils.install import InstallExtension |
@@ -66,9 +67,7 @@ def open_transport( |
66 | 67 | self, command: str = None, timeout: float = _DEFAULT_SOCKET_TIMEOUT |
67 | 68 | ) -> AdbConnection: |
68 | 69 | # connect has it own timeout |
69 | | - c = self._client.make_connection() |
70 | | - if timeout: |
71 | | - c.conn.settimeout(timeout) |
| 70 | + c = self._client.make_connection(timeout=timeout) |
72 | 71 |
|
73 | 72 | if command: |
74 | 73 | if self._transport_id: |
@@ -264,15 +263,8 @@ def forward_port(self, remote: Union[int, str]) -> int: |
264 | 263 | return local_port |
265 | 264 |
|
266 | 265 | def forward_list(self) -> List[ForwardItem]: |
267 | | - c = self.open_transport("list-forward") |
268 | | - content = c.read_string_block() |
269 | | - items = [] |
270 | | - for line in content.splitlines(): |
271 | | - parts = line.split() |
272 | | - if len(parts) != 3: |
273 | | - continue |
274 | | - items.append(ForwardItem(*parts)) |
275 | | - return items |
| 266 | + items = self._client.forward_list() |
| 267 | + return [item for item in items if item.serial == self._serial] |
276 | 268 |
|
277 | 269 | def reverse(self, remote: str, local: str, norebind: bool = False): |
278 | 270 | """ |
@@ -357,8 +349,10 @@ def framebuffer(self) -> Image.Image: |
357 | 349 | image = Image.frombytes(color_format, (width, height), buffer) |
358 | 350 | return image |
359 | 351 |
|
360 | | - def push(self, local: str, remote: str) -> str: |
361 | | - return self.adb_output("push", local, remote) |
| 352 | + @deprecated(deprecated_in="2.6.0", removed_in="3.0.0", current_version=__version__, details="use sync.push instead") |
| 353 | + def push(self, local: str, remote: str): |
| 354 | + """ alias for sync.push """ |
| 355 | + self.sync.push(local, remote) |
362 | 356 |
|
363 | 357 | def create_connection( |
364 | 358 | self, network: Network, address: Union[int, str] |
|
0 commit comments