|
1 | 1 | #!/usr/bin/env python3 |
2 | 2 |
|
| 3 | +import os |
| 4 | +import random |
3 | 5 | import re |
4 | 6 | import signal |
5 | 7 | import subprocess |
6 | 8 | import sys |
7 | 9 | import tempfile |
8 | 10 | import threading |
9 | 11 | import time |
10 | | -import os |
11 | | -import random |
12 | 12 | import typing |
13 | | -from functools import wraps, partial |
14 | | -from urllib.parse import urlparse |
15 | 13 | from enum import Enum |
16 | | -import psutil |
| 14 | +from functools import partial, wraps |
| 15 | +from urllib.parse import urlparse |
17 | 16 |
|
| 17 | +import psutil |
18 | 18 |
|
19 | 19 | try: |
20 | 20 | # This fails when the code is executed directly and not as a part of python package installation, |
21 | 21 | # I definitely need a better way to handle this. |
22 | | - from adbe.adb_helper import (get_adb_shell_property, execute_adb_command2, |
23 | | - execute_adb_shell_command, execute_adb_shell_command2, |
24 | | - execute_file_related_adb_shell_command, get_package, |
25 | | - root_required_to_access_file, |
26 | | - get_device_android_api_version, toggle_screen) |
27 | | - from adbe.output_helper import (print_message, print_error, print_error_and_exit, |
28 | | - print_verbose) |
29 | 22 | # asyncio was introduced in version 3.5 |
30 | 23 | from adbe import asyncio_helper |
| 24 | + from adbe.adb_helper import (execute_adb_command2, execute_adb_shell_command, |
| 25 | + execute_adb_shell_command2, |
| 26 | + execute_file_related_adb_shell_command, |
| 27 | + get_adb_shell_property, get_device_android_api_version, |
| 28 | + get_package, root_required_to_access_file, |
| 29 | + toggle_screen) |
| 30 | + from adbe.output_helper import (print_error, print_error_and_exit, print_message, |
| 31 | + print_verbose) |
31 | 32 | # Python 3.6 onwards, this throws ModuleNotFoundError |
32 | 33 | except ModuleNotFoundError: |
33 | 34 | # This works when the code is executed directly. |
34 | 35 | # noinspection PyUnresolvedReferences |
35 | | - from adb_helper import (get_adb_shell_property, execute_adb_command2, |
36 | | - execute_adb_shell_command, execute_adb_shell_command2, |
37 | | - execute_file_related_adb_shell_command, get_package, |
38 | | - root_required_to_access_file, |
39 | | - get_device_android_api_version, toggle_screen) |
40 | | - |
| 36 | + import asyncio_helper |
| 37 | + from adb_helper import (execute_adb_command2, execute_adb_shell_command, |
| 38 | + execute_adb_shell_command2, |
| 39 | + execute_file_related_adb_shell_command, |
| 40 | + get_adb_shell_property, get_device_android_api_version, |
| 41 | + get_package, root_required_to_access_file, toggle_screen) |
41 | 42 | # noinspection PyUnresolvedReferences |
42 | | - from output_helper import (print_message, print_error, print_error_and_exit, |
| 43 | + from output_helper import (print_error, print_error_and_exit, print_message, |
43 | 44 | print_verbose) |
44 | | - import asyncio_helper |
45 | 45 |
|
46 | 46 |
|
47 | 47 | _KEYCODE_BACK = 4 |
|
0 commit comments