Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ppadb/command/transport/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def list_packages(self):

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'):
Expand Down
2 changes: 1 addition & 1 deletion ppadb/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion ppadb/device_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def _get_src_info(src):


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):
Expand Down
2 changes: 1 addition & 1 deletion ppadb/plugins/device/cpustat.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def total(self):

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()
Expand Down
2 changes: 1 addition & 1 deletion ppadb/plugins/device/traffic.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def get_traffic(self, package_name):
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)
Expand Down
20 changes: 10 additions & 10 deletions ppadb/plugins/device/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def get_top_activity(self):
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)

Expand All @@ -45,13 +45,13 @@ def get_top_activities(self):
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)
Expand Down Expand Up @@ -82,7 +82,7 @@ def get_uid(self, package_name):
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)
Expand All @@ -99,7 +99,7 @@ def get_package_version_name(self, package_name):
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)
Expand Down
2 changes: 1 addition & 1 deletion ppadb/plugins/device/wm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down