@@ -23,11 +23,12 @@ ___________________/ /__/ /__/ /__/ /________________________________
2323from __future__ import print_function
2424
2525import textwrap
26+ from typing import Pattern
2627
2728import culebratester_client
2829from culebratester_client import WindowHierarchy , Selector
2930
30- __version__ = '22.7.1 '
31+ __version__ = '22.7.2 '
3132
3233import calendar
3334import codecs
@@ -76,20 +77,17 @@ class Descriptor:
7677 return Descriptor .ID
7778
7879
79- def fillAutoRegexpsRes ():
80- are = {'clock' : re .compile (r'[012]?\d:[0-5]\d( [AP]M)*' )}
81- d = "("
82- for i in range (7 ):
83- d += calendar .day_abbr [i ]
84- if i != 6 :
85- d += '|'
86- d += '), ('
87- for i in range (1 , 13 ):
88- d += calendar .month_name [i ]
89- if i != 12 :
90- d += '|'
91- d += r') [0123]\d'
92- are ['date' ] = re .compile (d , re .IGNORECASE )
80+ def fillAutoRegexpsRes () -> dict [str , Pattern [str ]]:
81+ """
82+ Fills a map with the pre-configured auto regexps.
83+ :return: the dictionary
84+ :rtype: dict
85+ """
86+ are = {'clock' : re .compile (r'[012]?\d:[0-5]\d([ \u200a][AP]M)*' )}
87+ d = fr"({ '|' .join (calendar .day_abbr )} ), ({ '|' .join (calendar .month_abbr [1 :])} ) [0123]?\d"
88+ are ["date_abbr" ] = re .compile (d , re .IGNORECASE )
89+ d = fr"({ '|' .join (calendar .day_name )} ), ({ '|' .join (calendar .month_name [1 :])} ) [0123]?\d"
90+ are ["date" ] = re .compile (d , re .IGNORECASE )
9391 are ['battery' ] = re .compile (r'Charging, \d\d%' )
9492 are ['temp' ] = re .compile (r'\d+°' )
9593 return are
@@ -917,7 +915,7 @@ def searchAndReplaceByRegexIfMatches(_s: str) -> str:
917915 :rtype: str
918916 """
919917 for _are in [CulebraOptions .AUTO_REGEXPS_RES [k ] for k in options [CulebraOptions .AUTO_REGEXPS ]]:
920- if _are .match (escapeRegexpSpecialChars ( _s ) ):
918+ if _are .match (_s ):
921919 return f"Pattern:{ _are .pattern } "
922920 return _s
923921
@@ -1642,6 +1640,8 @@ vc = ViewClient(device, serialno, **kwargs2)
16421640
16431641 if kwargs2 [ViewClientOptions .USE_UIAUTOMATOR_HELPER ]:
16441642 print ('''helper = vc.uiAutomatorHelper''' )
1643+ print ('''# set enabled to False if you don't want kato to find the closet selectors if one is not found''' )
1644+ print ('''helper.kato.enabled = True''' )
16451645 if options [CulebraOptions .USE_DICTIONARY ]:
16461646 print ('''views = dict()''' )
16471647 if options [CulebraOptions .SAVE_SCREENSHOT ]:
0 commit comments