@@ -1078,7 +1078,7 @@ def get_list_all_apps():
10781078 """
10791079 # https://developer.android.com/studio/command-line/dumpsys
10801080 cmd = 'dumpsys package'
1081- pattern_packages = re .compile (' Package \\ [(.*?)\\ ]' )
1081+ pattern_packages = re .compile (" Package \[(.*?)]" )
10821082 return_code , result , err = execute_adb_shell_command2 (cmd )
10831083 if return_code != 0 :
10841084 err_msg = 'Command "%s" failed, something is wrong' % cmd
@@ -1491,7 +1491,7 @@ def print_app_info(app_name):
14911491
14921492# API < 23 have no runtime permissions
14931493def _get_permissions_info_below_api_23 (app_info_dump ):
1494- install_time_permissions_regex = re .search ('grantedPermissions:(.*)' , app_info_dump ,
1494+ install_time_permissions_regex = re .search (r 'grantedPermissions:(.*)' , app_info_dump ,
14951495 re .IGNORECASE | re .DOTALL )
14961496 if install_time_permissions_regex is None :
14971497 install_time_permissions_string = []
@@ -1574,11 +1574,11 @@ def _get_install_time_granted_denied_permissions(
15741574
15751575def _extract_requested_permissions_above_api_23 (app_info_dump : str ) -> typing .Optional [typing .List [str ]]:
15761576 requested_permissions_regex = \
1577- re .search ('requested permissions:(.*?)install permissions:' , app_info_dump , re .IGNORECASE | re .DOTALL )
1577+ re .search (r 'requested permissions:(.*?)install permissions:' , app_info_dump , re .IGNORECASE | re .DOTALL )
15781578 # Fallback
15791579 if requested_permissions_regex is None :
15801580 requested_permissions_regex = re .search (
1581- 'requested permissions:(.*?)runtime permissions:' , app_info_dump , re .IGNORECASE | re .DOTALL )
1581+ r 'requested permissions:(.*?)runtime permissions:' , app_info_dump , re .IGNORECASE | re .DOTALL )
15821582
15831583 if requested_permissions_regex is None :
15841584 # No permissions requested by the app
@@ -1591,7 +1591,7 @@ def _extract_requested_permissions_above_api_23(app_info_dump: str) -> typing.Op
15911591
15921592def _extract_install_time_permissions_above_api_23 (app_info_dump : str ) -> typing .Optional [typing .List [str ]]:
15931593 install_time_permissions_regex = re .search (
1594- 'install permissions:(.*?)runtime permissions:' , app_info_dump , re .IGNORECASE | re .DOTALL )
1594+ r 'install permissions:(.*?)runtime permissions:' , app_info_dump , re .IGNORECASE | re .DOTALL )
15951595 if install_time_permissions_regex is None :
15961596 return []
15971597 else :
@@ -1737,7 +1737,7 @@ def _get_window_size():
17371737 if result is None :
17381738 return - 1 , - 1
17391739
1740- regex_data = re .search ('size: ([0-9]+)x([0-9]+)' , result )
1740+ regex_data = re .search (r 'size: ([0-9]+)x([0-9]+)' , result )
17411741 if regex_data is None :
17421742 return - 1 , - 1
17431743
@@ -1922,12 +1922,12 @@ def print_notifications():
19221922 if i + 1 < len (notification_records ):
19231923 output_for_this_notification = output_for_this_notification .split (notification_records [i + 1 ])[0 ]
19241924 notification_package = re .findall (r"pkg=(\S*)" , notification_record )[0 ]
1925- titles = re .findall ("android.title=(.*)" , output_for_this_notification )
1925+ titles = re .findall (r "android.title=(.*)" , output_for_this_notification )
19261926 if len (titles ) > 0 :
19271927 notification_title = titles [0 ]
19281928 else :
19291929 notification_title = None
1930- texts = re .findall ("android.text=(.*)" , output_for_this_notification )
1930+ texts = re .findall (r "android.text=(.*)" , output_for_this_notification )
19311931 if len (texts ) > 0 :
19321932 notification_text = texts [0 ]
19331933 else :
@@ -2040,8 +2040,7 @@ def print_pending_alarms(output_dump_alarm, padding):
20402040 # TO-DO: translate the flags
20412041 print_verbose ("%sflag: %s" % (padding * 2 , info [4 ].split ("=" )[1 ]))
20422042
2043- if line .startswith ("RTC" ) or line .startswith ("RTC_WAKEUP" ) or \
2044- line .startswith ("ELAPSED" ) or line .startswith ("ELAPSED_WAKEUP" ):
2043+ if line .startswith (("RTC" , "RTC_WAKEUP" , "ELAPSED" , "ELAPSED_WAKEUP" )):
20452044 pattern_between_brackets = re .compile (r'(?<=\{).*?(?=\})' ,
20462045 re .DOTALL )
20472046 info = re .search (pattern_between_brackets , line ).group (0 ).split (" " )
0 commit comments