File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -60,21 +60,21 @@ def generate_random_uid() -> str:
6060
6161
6262def find_last_reset (string : str ) -> tuple [int , int , str ]:
63- for match in re .finditer (ansi_reset , string ):
64- pass
65- try :
66- return match .start (), match .end (), match .group (0 )
67- except UnboundLocalError :
63+ last = None
64+ for m in re .finditer (ansi_reset , string ):
65+ last = m
66+ if last is None :
6867 return - 2 , - 1 , ''
68+ return last .start (), last .end (), last .group (0 )
6969
7070
7171def find_last_sgr (string : str ) -> tuple [int , int , str ]:
72- for match in re .finditer (ansi_sgr , string ):
73- pass
74- try :
75- return match .start (), match .end (), match .group (0 )
76- except UnboundLocalError :
72+ last = None
73+ for m in re .finditer (ansi_sgr , string ):
74+ last = m
75+ if last is None :
7776 return - 2 , - 1 , ''
77+ return last .start (), last .end (), last .group (0 )
7878
7979
8080def find_unmatched_sgr (string : str ) -> Optional [str ]:
You can’t perform that action at this time.
0 commit comments