improve: detailer wildcard - random seed support [SEP:R]

This commit is contained in:
Dr.Lt.Data
2024-01-13 13:44:26 +09:00
parent 3f89d6efb5
commit c5c5e5c22d
2 changed files with 9 additions and 3 deletions
+1 -1
View File
@@ -2,7 +2,7 @@ import configparser
import os
version_code = [4, 65]
version_code = [4, 65, 1]
version = f"V{version_code[0]}.{version_code[1]}" + (f'.{version_code[2]}' if len(version_code) > 2 else '')
dependency_version = 20
+8 -2
View File
@@ -401,7 +401,7 @@ class WildcardChooserDict:
def split_string_with_sep(input_string):
sep_pattern = r'\[SEP(?:\:\d+)?\]'
sep_pattern = r'\[SEP(?:\:\w+)?\]'
substrings = re.split(sep_pattern, input_string)
@@ -412,8 +412,14 @@ def split_string_with_sep(input_string):
if i < len(matches):
if matches[i] == '[SEP]':
result_list.append(None)
elif matches[i] == '[SEP:R]':
result_list.append(random.randint(0, 1125899906842624))
else:
result_list.append(int(matches[i][5:-1]))
try:
seed = int(matches[i][5:-1])
except:
seed = None
result_list.append(seed)
iterable = iter(result_list)
return list(zip(iterable, iterable))