AutoFramework/main3.py

119 lines
3.0 KiB
Python
Raw Normal View History

2022-08-09 07:31:05 +08:00
# str0 = '''"it in the ..." in $['content']'''
#
# str1 = '''"it in the ..." in $['content']'''
# str2 = '''$['content'] == "ha in the end."'''
# str3 = '''"it in the ..." in $'''
# str4 = """$w.dasfd[9][0] in 'it in the ...'"""
# str5 = '''$.flag == true'''
#
# import re
#
#
# str41 = """$w.dasfd[9][0] in 'it in the ...'"""
# str42 = '''$w.dasfd[9][0] in "it in the ..."'''
# str43 = """$w.dasfd['a']['vf'] in 'it in the ...'"""
# str44 = """$w.dasfd['a']['vf in '] in true"""
# str45 = """$null in true"""
# str46 = "$w.dasfd['a']['vf in '] in \"true\""
#
#
#
# s1 = """$data['info'] in 'it in the end...'"""
# s2 = """$data[0] in 'it in the end...'"""
# s3 = """$data['info']["name"] in 'it in the end...'"""
# s4 = """'info' in 'it in the end...'"""
# s41 = '''"info" in "it in the end..."'''
# s5 = '''"it in the ..." in $data[0]'''
# s6 = '''true in $data[0]'''
#
#
#
#
#
2022-08-08 18:51:27 +08:00
2022-08-09 07:31:05 +08:00
#
#
#
#
# s = str2
# print(re.findall('([\"].*?[\"].*?[\s]*)( in )([\s]*.*$)', s))
# print(re.findall('([\'].*?[\'].*?[\s]*)( in )([\s]*.*$)', s))
# print(re.findall('[\s]*( in )[\s]*.*?[\"].*?[\"]', s))
# print(re.findall('[\s]*( in )[\s]*.*?[\'].*?[\']', s))
# print(re.findall('(^(?!.*[\'\"]).*[\s]*)( in )([\s]*.*?(?!.*[\'\"]).*$)', s))
#
#
# print(re.findall('(^(?!.*[\'\"]).*[\s]*)( in )([\s]*.*?(?!.*[\'\"]).*$)', '''$data_1['info'] in " t he end.[ c ] "'''))
#
#
# print(re.findall('(^.*[\'\"]*.*[\'\"]*.*[\s]*)( in )([\s]*.*[\'\"]*.*[\'\"]*.*$)', s4))
# ?
# print(re.compile(' in ').sub(' IN ', str1))
string = '"it in the ..." in "..."'
2022-08-08 18:51:27 +08:00
2022-08-09 07:31:05 +08:00
def func(text=' $["data"][0]["name"] in "it in the ..."'):
operator_list = [
' in ',
' == '
]
locals().__setitem__('quota', 0)
none_quota = []
none_quota_range = []
for i in range(len(text)):
this = text[i]
match this:
case '\'':
match locals().get('quota'):
case 0:
locals().__setitem__('quota', 1)
case 1:
locals().__setitem__('quota', 0)
case '\"':
match locals().get('quota'):
case 0:
locals().__setitem__('quota', 2)
case 2:
locals().__setitem__('quota', 0)
case _:
if locals().get('quota') == 0:
if none_quota_range:
if (i-1) != none_quota[-1]:
if (i-none_quota[-1]) > 0:
none_quota_range.append(none_quota[-1])
none_quota_range.append(i)
# if (i-1) == none_quota_range[-1]:
# pass
# none_quota_range.append(none_quota[-1])
else:
none_quota_range.append(i)
none_quota.append(i)
print(locals().__getitem__('quota'))
print(none_quota_range)
print(none_quota)
print(func())
#
# a = 123
# locals().__setitem__('a', 456)
# print(locals().__getitem__('a'))