@@ -88,16 +88,17 @@ def search_argument_context(row_num, lines):
8888 cmds = []
8989 while row_num > 0 :
9090 row_num -= 1
91- # Match `with self.argument_context('' ) as c:`
92- sub_pattern0 = r'with self.argument_context\(\' (.*?)\' [\),]'
91+ # Match `with self.argument_context(['"]['"] ) as c:`
92+ sub_pattern0 = r'with self.argument_context\([\'\"] (.*?)[\'\"] [\),]'
9393 # Match `with self.argument_context(scope) as c:`
9494 sub_pattern1 = r'with self.argument_context\(scope[\),]'
95- # Match `with self.argument_context(\'{} stop\'.format(scope)) as c:',
96- sub_pattern2 = r'with self.argument_context\(\'(.*)\'.format\(scope\)\)'
95+ # Match `with self.argument_context(['"]{} stop['"].format(scope)) as c:',
96+ sub_pattern2 = r'with self.argument_context\([\'\"](.*)[\'\"].format\(scope\)\)'
97+ # There are many matching patterns, but their proportion is very small. Ignore these commands.
9798 ref0 = re .findall (sub_pattern0 , lines [row_num ])
9899 ref1 = re .findall (sub_pattern1 , lines [row_num ])
99100 ref2 = re .findall (sub_pattern2 , lines [row_num ])
100- # Match `with self.argument_context('' ) as c:`
101+ # Match `with self.argument_context(['"]['"] ) as c:`
101102 if ref0 :
102103 cmds = ref0
103104 break
@@ -107,7 +108,7 @@ def search_argument_context(row_num, lines):
107108 cmds = json .loads (
108109 re .findall (sub_pattern , lines [row_num - 1 ])[0 ].replace ('\' ' , '"' ))
109110 break
110- # Match `with self.argument_context(\' {} stop\' .format(scope)) as c:',
111+ # Match `with self.argument_context(['"] {} stop['"] .format(scope)) as c:',
111112 if ref2 :
112113 sub_pattern = r'for scope in (.*):'
113114 format_strings = json .loads (
0 commit comments