1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124
|
Description: Fix SyntaxWarning during build
Patch to fix SyntaxWarning during build.
Author: Emmanuel Arias <eamanu@debian.org>
Bug-Debian: https://bugs.debian.org/1086921
Forwarded: https://github.com/Swind/pure-python-adb/pull/115
Last-Update: 2024-12-18
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/ppadb/plugins/device/utils.py
+++ b/ppadb/plugins/device/utils.py
@@ -32,7 +32,7 @@
return None
def get_top_activities(self):
- pattern = "ACTIVITY\s([\w\.]+)/([\w\.]+)\s[\w\d]+\spid=([\d]+)"
+ pattern = r"ACTIVITY\s([\w\.]+)/([\w\.]+)\s[\w\d]+\spid=([\d]+)"
cmd = "dumpsys activity top | grep ACTIVITY"
result = self.shell(cmd)
@@ -45,13 +45,13 @@
return activities
def get_meminfo(self, package_name):
- total_meminfo_re = re.compile('\s*TOTAL\s*(?P<pss>\d+)'
- '\s*(?P<private_dirty>\d+)'
- '\s*(?P<private_clean>\d+)'
- '\s*(?P<swapped_dirty>\d+)'
- '\s*(?P<heap_size>\d+)'
- '\s*(?P<heap_alloc>\d+)'
- '\s*(?P<heap_free>\d+)')
+ total_meminfo_re = re.compile(r'\s*TOTAL\s*(?P<pss>\d+)'
+ r'\s*(?P<private_dirty>\d+)'
+ r'\s*(?P<private_clean>\d+)'
+ r'\s*(?P<swapped_dirty>\d+)'
+ r'\s*(?P<heap_size>\d+)'
+ r'\s*(?P<heap_alloc>\d+)'
+ r'\s*(?P<heap_free>\d+)')
cmd = 'dumpsys meminfo {}'.format(package_name)
result = self.shell(cmd)
@@ -82,7 +82,7 @@
cmd = 'dumpsys package {} | grep userId'.format(package_name)
result = self.shell(cmd).strip()
- pattern = "userId=([\d]+)"
+ pattern = r"userId=([\d]+)"
if result:
match = re.search(pattern, result)
@@ -99,7 +99,7 @@
cmd = 'dumpsys package {} | grep versionName'.format(package_name)
result = self.shell(cmd).strip()
- pattern = "versionName=([\d\.]+)"
+ pattern = r"versionName=([\d\.]+)"
if result:
match = re.search(pattern, result)
--- a/ppadb/plugins/device/wm.py
+++ b/ppadb/plugins/device/wm.py
@@ -9,7 +9,7 @@
])
class WM(Plugin):
- SIZE_RE = 'Physical size:\s([\d]+)x([\d]+)'
+ SIZE_RE = r'Physical size:\s([\d]+)x([\d]+)'
def wm_size(self):
result = self.shell("wm size")
match = re.search(self.SIZE_RE, result)
--- a/ppadb/plugins/device/traffic.py
+++ b/ppadb/plugins/device/traffic.py
@@ -33,7 +33,7 @@
cmd = 'dumpsys package {} | grep userId'.format(package_name)
result = self.shell(cmd).strip()
- pattern = "userId=([\d]+)"
+ pattern = r"userId=([\d]+)"
if result:
match = re.search(pattern, result)
--- a/ppadb/plugins/device/cpustat.py
+++ b/ppadb/plugins/device/cpustat.py
@@ -87,7 +87,7 @@
class CPUStat(Plugin):
total_cpu_pattern = re.compile(
- "cpu\s+([\d]+)\s([\d]+)\s([\d]+)\s([\d]+)\s([\d]+)\s([\d]+)\s([\d]+)\s([\d]+)\s([\d]+)\s([\d]+)\s")
+ r"cpu\s+([\d]+)\s([\d]+)\s([\d]+)\s([\d]+)\s([\d]+)\s([\d]+)\s([\d]+)\s([\d]+)\s([\d]+)\s([\d]+)\s")
def cpu_times(self):
return self.get_total_cpu()
--- a/ppadb/device_async.py
+++ b/ppadb/device_async.py
@@ -21,7 +21,7 @@
class DeviceAsync(TransportAsync):
- INSTALL_RESULT_PATTERN = "(Success|Failure|Error)\s?(.*)"
+ INSTALL_RESULT_PATTERN = r"(Success|Failure|Error)\s?(.*)"
UNINSTALL_RESULT_PATTERN = "(Success|Failure.*|.*Unknown package:.*)"
def __init__(self, client, serial):
--- a/ppadb/command/transport/__init__.py
+++ b/ppadb/command/transport/__init__.py
@@ -92,7 +92,7 @@
def get_properties(self):
result = self.shell("getprop")
- result_pattern = "^\[([\s\S]*?)\]: \[([\s\S]*?)\]\r?$"
+ result_pattern = r"^\[([\s\S]*?)\]: \[([\s\S]*?)\]\r?$"
properties = {}
for line in result.split('\n'):
--- a/ppadb/device.py
+++ b/ppadb/device.py
@@ -31,7 +31,7 @@
class Device(Transport, Serial, Input, Utils, WM, Traffic, CPUStat, BatteryStats):
- INSTALL_RESULT_PATTERN = "(Success|Failure|Error)\s?(.*)"
+ INSTALL_RESULT_PATTERN = r"(Success|Failure|Error)\s?(.*)"
UNINSTALL_RESULT_PATTERN = "(Success|Failure.*|.*Unknown package:.*)"
def __init__(self, client, serial):
|