1
This commit is contained in:
@@ -17,6 +17,6 @@ class CLIPTextEncodeWildcards:
|
||||
CATEGORY = "conditioning"
|
||||
|
||||
def encode(self, clip, text):
|
||||
r=run(text)
|
||||
r=wildcards.run(text)
|
||||
print(f"encode : {r}")
|
||||
return ([[clip.encode(r), {}]], )
|
||||
|
||||
@@ -4,18 +4,22 @@ from nodes import *
|
||||
import folder_paths
|
||||
import random
|
||||
from .check_name import *
|
||||
|
||||
print(os.getcwd())
|
||||
from .Colors import cprint, Colors as Colors
|
||||
import os
|
||||
py_name=os.path.basename(__file__)
|
||||
cprint(py_name, Colors.BLUE)
|
||||
|
||||
class CheckpointLoaderSimpleText:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
t_checkpoints=folder_paths.get_filename_list("checkpoints")
|
||||
#cprint(f"checkpoints count : {len(t_checkpoints)}", Colors.BGREEN)
|
||||
return {
|
||||
"required": {
|
||||
"ckpt_name": (
|
||||
"STRING", {
|
||||
"multiline": False,
|
||||
"default": random.choice(folder_paths.get_filename_list("checkpoints"))
|
||||
"default": random.choice(t_checkpoints)
|
||||
}
|
||||
),
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
class Colors:
|
||||
BLACK = '\033[30m' #Colors.BLACK
|
||||
RED = '\033[31m' #Colors.BLACK
|
||||
GREEN = '\033[32m' #Colors.BLACK
|
||||
YELLOW = '\033[33m' #Colors.YELLOW
|
||||
BLUE = '\033[34m' #Colors.BLACK
|
||||
MAGENTA = '\033[35m' #Colors.BLACK
|
||||
CYAN = '\033[36m' #Colors.BLACK
|
||||
WHITE = '\033[37m' #Colors.BLACK
|
||||
BBLACK = '\033[90m' #Colors.BLACK
|
||||
BRED = '\033[91m' #Colors.BLACK
|
||||
BGREEN = '\033[92m' #Colors.BLACK
|
||||
BYELLOW = '\033[93m' #Colors.YELLOW
|
||||
BBLUE = '\033[94m' #Colors.BLACK
|
||||
BMAGENTA = '\033[95m' #Colors.BLACK
|
||||
BCYAN = '\033[96m' #Colors.BLACK
|
||||
BWHITE = '\033[97m' #Colors.BLACK
|
||||
UNDERLINE = '\033[4m' #Colors.BLACK
|
||||
RESET = '\033[0m' #Colors.BLACK
|
||||
|
||||
def cprint(text,color=None):
|
||||
if color:
|
||||
print(color + text + Colors.RESET)
|
||||
else:
|
||||
print(text)
|
||||
|
||||
#from .Colors import cprint, Colors as Colors
|
||||
import os
|
||||
py_name=os.path.basename(__file__)
|
||||
cprint(py_name, Colors.BLUE)
|
||||
cprint("BLACK", Colors.BLACK)
|
||||
cprint("RED", Colors.RED)
|
||||
cprint("GREEN", Colors.GREEN)
|
||||
cprint("MAGENTA", Colors.MAGENTA)
|
||||
cprint("CYAN", Colors.CYAN)
|
||||
@@ -0,0 +1,69 @@
|
||||
from PIL import Image
|
||||
from PIL.PngImagePlugin import PngInfo
|
||||
import numpy as np
|
||||
import json
|
||||
|
||||
import time
|
||||
|
||||
from .Colors import cprint, Colors as Colors
|
||||
import os, sys
|
||||
py_name=os.path.basename(__file__)
|
||||
cprint(py_name, Colors.BLUE)
|
||||
|
||||
from .mypath import *
|
||||
|
||||
class SaveImageSimple:
|
||||
def __init__(self):
|
||||
self.type = "output"
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {
|
||||
"required": {
|
||||
"images": ("IMAGE", ),
|
||||
"filename_prefix": ("STRING", {"default": ""})
|
||||
},
|
||||
"hidden": {
|
||||
"prompt": "PROMPT", "extra_pnginfo": "EXTRA_PNGINFO"
|
||||
},
|
||||
}
|
||||
RETURN_TYPES = ()
|
||||
FUNCTION = "save_images"
|
||||
|
||||
OUTPUT_NODE = True
|
||||
|
||||
CATEGORY = "image"
|
||||
|
||||
def save_images(self, images, filename_prefix="", prompt=None, extra_pnginfo=None):
|
||||
|
||||
outputdir=os.path.join(mainfolder, "output")
|
||||
#cprint("outputdir : " + outputdir , Colors.CYAN)
|
||||
|
||||
#cprint("len(images) : " + str(len(images)) , Colors.CYAN)
|
||||
filename_prefix+=time.strftime('_%Y%m%d_%H%M%S')
|
||||
results = list()
|
||||
cnt=1
|
||||
for image in images :
|
||||
i = 255. * image.cpu().numpy()
|
||||
img = Image.fromarray(np.clip(i, 0, 255).astype(np.uint8))
|
||||
metadata = PngInfo()
|
||||
if prompt is not None:
|
||||
metadata.add_text("prompt", json.dumps(prompt))
|
||||
if extra_pnginfo is not None:
|
||||
#cprint("extra_pnginfo : " + json.dumps(extra_pnginfo) , Colors.CYAN)
|
||||
for x in extra_pnginfo:
|
||||
metadata.add_text(x, json.dumps(extra_pnginfo[x]))
|
||||
if not os.path.exists(outputdir):
|
||||
cprint("makedirs : " + outputdir , Colors.CYAN)
|
||||
os.makedirs(outputdir)
|
||||
filename=filename_prefix+f"_{cnt:05}_.png"
|
||||
filename=os.path.join(outputdir, filename)
|
||||
img.save(filename, pnginfo=metadata, optimize=True)
|
||||
results.append({
|
||||
"filename": filename,
|
||||
"subfolder": subfolder,
|
||||
"type": self.type
|
||||
});
|
||||
cnt+=1
|
||||
|
||||
return { "ui": { "images": results } }
|
||||
@@ -0,0 +1,85 @@
|
||||
import comfy.samplers
|
||||
import comfy.sd
|
||||
import comfy.utils
|
||||
|
||||
import comfy_extras.clip_vision
|
||||
|
||||
import model_management
|
||||
import importlib
|
||||
|
||||
import folder_paths
|
||||
import torch
|
||||
|
||||
import os
|
||||
import sys
|
||||
import json
|
||||
import hashlib
|
||||
import copy
|
||||
import traceback
|
||||
|
||||
from PIL import Image
|
||||
from PIL.PngImagePlugin import PngInfo
|
||||
import numpy as np
|
||||
|
||||
|
||||
from .Colors import cprint, Colors as Colors
|
||||
import os
|
||||
py_name=os.path.basename(__file__)
|
||||
cprint(py_name, Colors.BLUE)
|
||||
|
||||
#----------------------------
|
||||
# wildcards support check
|
||||
wildcardsOn=False
|
||||
try:
|
||||
from .wildcards import *
|
||||
wildcardsOn=True
|
||||
#wildcards.card_path=os.path.dirname(__file__)+"\\..\\wildcards\\**\\*.txt"
|
||||
cprint(f"{py_name} : import wildcards succ", Colors.GREEN )
|
||||
except:
|
||||
cprint(f"{py_name} : import wildcards fail", Colors.RED)
|
||||
wildcardsOn=False
|
||||
|
||||
#----------------------------
|
||||
class SimpleSampler:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {"required":
|
||||
{
|
||||
"model": ("MODEL",),
|
||||
#"positive": ("CONDITIONING", ),
|
||||
"positive": ("STRING", {"multiline": True}), "clip": ("CLIP", ),
|
||||
#"negative": ("CONDITIONING", ),
|
||||
"negative": ("STRING", {"multiline": True}), "clip": ("CLIP", ),
|
||||
"width": ("INT", {"default": 512, "min": 64, "max": 4096, "step": 64}),
|
||||
"height": ("INT", {"default": 512, "min": 64, "max": 4096, "step": 64}),
|
||||
"batch_size": ("INT", {"default": 1, "min": 1, "max": 64}),
|
||||
"seed": ("INT", {"default": 0, "min": 0, "max": 0xffffffffffffffff}),
|
||||
"steps": ("INT", {"default": 20, "min": 1, "max": 10000}),
|
||||
"cfg": ("FLOAT", {"default": 8.0, "min": 0.0, "max": 100.0}),
|
||||
"sampler_name": (comfy.samplers.KSampler.SAMPLERS, ),
|
||||
"scheduler": (comfy.samplers.KSampler.SCHEDULERS, ),
|
||||
"latent_image": ("LATENT", ),
|
||||
"denoise": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 1.0, "step": 0.01}),
|
||||
}}
|
||||
|
||||
RETURN_TYPES = ("LATENT",)
|
||||
FUNCTION = "sample"
|
||||
|
||||
CATEGORY = "sampling"
|
||||
|
||||
def encode(self, clip, text):
|
||||
if wildcardsOn:
|
||||
text=wildcards.run(text)
|
||||
return ([[clip.encode(text), {}]], )
|
||||
|
||||
def generate(self, width, height, batch_size=1):
|
||||
latent = torch.zeros([batch_size, 4, height // 8, width // 8])
|
||||
return ({"samples":latent}, )
|
||||
|
||||
def sample(self,
|
||||
model, seed, steps, cfg, sampler_name, scheduler, positive, negative, latent_image,
|
||||
width, height, denoise=1.0, batch_size=1
|
||||
):
|
||||
|
||||
return common_ksampler(model, seed, steps, cfg, sampler_name, scheduler, self.encode(clip, positive), elf.encode(clip, negative), self.generate( width, height, batch_size=1), denoise=denoise)
|
||||
|
||||
+12
-5
@@ -1,4 +1,7 @@
|
||||
print("ComfyUI_node_Lilly.__init__")
|
||||
from .Colors import cprint, Colors as Colors
|
||||
import os
|
||||
py_name=os.path.basename(__file__)
|
||||
cprint(py_name, Colors.BLUE)
|
||||
|
||||
import os
|
||||
import sys
|
||||
@@ -42,13 +45,14 @@ if not md.startswith("custom_nodes."):
|
||||
}
|
||||
|
||||
def add(name):
|
||||
print(f"Load : {name}")
|
||||
#print(f"Load : {name}")
|
||||
try:
|
||||
pkg = importlib.import_module(f"{md}.{name}")
|
||||
NODE_CLASS_MAPPINGS[name]=eval(f"pkg.{name}")
|
||||
print(f"ok : {name}")
|
||||
cprint(f"Load ok : {name}")
|
||||
except Exception as e:
|
||||
print(f"Exception : {e}")
|
||||
cprint(f"Load fail : {name}",Colors.YELLOW)
|
||||
cprint(f"Exception : {e}",Colors.YELLOW)
|
||||
|
||||
add("CheckpointLoaderRandom")
|
||||
add("CheckpointLoaderSimpleText")
|
||||
@@ -56,4 +60,7 @@ if not md.startswith("custom_nodes."):
|
||||
add("LoraLoaderText")
|
||||
add("LoraLoaderTextRandom")
|
||||
add("Random_Sampler")
|
||||
add("VAELoaderDecode")
|
||||
add("VAELoaderDecode")
|
||||
add("SimpleSampler")
|
||||
add("SaveImageSimple")
|
||||
#add("test")
|
||||
@@ -0,0 +1,26 @@
|
||||
from .Colors import cprint, Colors as Colors
|
||||
import os, sys
|
||||
py_name=os.path.basename(__file__)
|
||||
cprint(py_name, Colors.BLUE)
|
||||
|
||||
absFilePath = os.path.abspath(__file__)
|
||||
cprint("abspath : " + absFilePath , Colors.CYAN)
|
||||
|
||||
realFilePath = os.path.realpath(__file__)
|
||||
cprint("realpath : " + realFilePath , Colors.CYAN)
|
||||
|
||||
normpath=os.path.normpath(__file__)
|
||||
cprint("normpath : " + normpath , Colors.CYAN)
|
||||
|
||||
subfolder = os.path.dirname(normpath)
|
||||
cprint("subfolder : " + subfolder , Colors.CYAN)
|
||||
|
||||
filename = os.path.basename(normpath)
|
||||
cprint("filename : " + filename , Colors.CYAN)
|
||||
|
||||
mainFile = os.path.abspath(sys.modules['__main__'].__file__)
|
||||
cprint("mainFile : " + mainFile , Colors.CYAN)
|
||||
|
||||
mainfolder = os.path.dirname(mainFile)
|
||||
cprint("mainfolder : " + mainfolder , Colors.CYAN)
|
||||
|
||||
+160
-155
@@ -1,181 +1,186 @@
|
||||
import os, glob, sys
|
||||
import glob, sys
|
||||
import random
|
||||
import re
|
||||
#import wildcards
|
||||
|
||||
print("wildcards")
|
||||
if __name__ == '__main__' :
|
||||
print("nain")
|
||||
from Colors import cprint, Colors as Colors
|
||||
else:
|
||||
from .Colors import cprint, Colors as Colors
|
||||
import os
|
||||
py_name=os.path.basename(__file__)
|
||||
cprint(py_name, Colors.BLUE)
|
||||
#print(os.getcwd())
|
||||
|
||||
#mn=os.path.abspath(__main__)
|
||||
#print("nm ", mn)
|
||||
#
|
||||
#filePath = __file__
|
||||
#print("This script file path is ", filePath)
|
||||
#
|
||||
#absFilePath = os.path.abspath(__file__)
|
||||
#print("This script absolute path is ", absFilePath)
|
||||
#
|
||||
#realFilePath = os.path.realpath(__file__)
|
||||
#print("This script real path is ", realFilePath)
|
||||
#
|
||||
#path, filename = os.path.split(absFilePath)
|
||||
#print("Script file path is {}, filename is {}".format(path, filename))
|
||||
filePath = __file__
|
||||
print("file path : ", filePath)
|
||||
|
||||
absFilePath = os.path.abspath(__file__)
|
||||
print("absolute path : ", absFilePath)
|
||||
|
||||
realFilePath = os.path.realpath(__file__)
|
||||
print("real path : ", realFilePath)
|
||||
|
||||
path, filename = os.path.split(absFilePath)
|
||||
print("Script file path is {}, filename is {}".format(path, filename))
|
||||
|
||||
|
||||
# ============================================================
|
||||
class wildcards:
|
||||
|
||||
# 가져올 파일 목록
|
||||
card_path=os.path.dirname(__file__)+"\\..\\..\\wildcards\\**\\*.txt"
|
||||
#card_path=f"{os.getcwd()}\\wildcards\\**\\*.txt"
|
||||
print(f"wildcards card_path {card_path}")
|
||||
# 가져올 파일 목록
|
||||
card_path=os.path.dirname(__file__)+"\\..\\..\\wildcards\\**\\*.txt"
|
||||
#card_path=f"{os.getcwd()}\\wildcards\\**\\*.txt"
|
||||
print(f"wildcards card_path {card_path}")
|
||||
|
||||
# 정규식
|
||||
#resub = re.compile(r"(\{)([^\{\}]*)(\})")
|
||||
resub = re.compile(r"(\{)(((\d+)|(\d+)?-(\d+)?)?\$\$)?([^\{\}]*)(\})")
|
||||
recard = re.compile(r"(__)(.*?)(__)")
|
||||
# 정규식
|
||||
#resub = re.compile(r"(\{)([^\{\}]*)(\})")
|
||||
resub = re.compile(r"(\{)(((\d+)|(\d+)?-(\d+)?)?\$\$)?([^\{\}]*)(\})")
|
||||
recard = re.compile(r"(__)(.*?)(__)")
|
||||
|
||||
# 카드 목록
|
||||
cards = {}
|
||||
seperator=", "
|
||||
loop_max=50
|
||||
# 카드 목록
|
||||
cards = {}
|
||||
seperator=", "
|
||||
loop_max=50
|
||||
|
||||
# | 로 입력된것중 하나 가져오기
|
||||
def sub(match):
|
||||
#print(f"sub : {(match.groups())}")
|
||||
try:
|
||||
#m=match.group(2)
|
||||
s=match.group(3)
|
||||
m=match.group(7).split("|")
|
||||
# | 로 입력된것중 하나 가져오기
|
||||
def sub(match):
|
||||
#print(f"sub : {(match.groups())}")
|
||||
try:
|
||||
#m=match.group(2)
|
||||
s=match.group(3)
|
||||
m=match.group(7).split("|")
|
||||
|
||||
#print(f"m : {m}")
|
||||
if s is None:
|
||||
return random.choice(m)
|
||||
c=len(m)
|
||||
n=int(match.group(4)) if match.group(4) else None
|
||||
if n:
|
||||
#print(f"m : {m}")
|
||||
if s is None:
|
||||
return random.choice(m)
|
||||
c=len(m)
|
||||
n=int(match.group(4)) if match.group(4) else None
|
||||
if n:
|
||||
|
||||
r=seperator.join(random.sample(m,min(n,c)))
|
||||
#print(f"n : {n} ; {r}")
|
||||
r=wildcards.seperator.join(random.sample(m,min(n,c)))
|
||||
#print(f"n : {n} ; {r}")
|
||||
return r
|
||||
|
||||
n1=match.group(5)
|
||||
n2=match.group(6)
|
||||
|
||||
if n1 or n2:
|
||||
a=min(int(n1 if n1 else c), int(n2 if n2 else c),c)
|
||||
b=min(max(int(n1 if n1 else 0), int(n2 if n2 else 0)),c)
|
||||
#print(f"ab : {a} ; {b}")
|
||||
r=wildcards.seperator.join(
|
||||
random.sample(
|
||||
m,
|
||||
random.randint(
|
||||
a,b
|
||||
)
|
||||
)
|
||||
)
|
||||
#n1=int(match.group(5)) if not match.group(5) is None
|
||||
#n2=int(match.group(6)) if not match.group(6) is None
|
||||
else:
|
||||
r=wildcards.seperator.join(
|
||||
random.sample(
|
||||
m,
|
||||
random.randint(
|
||||
0,c
|
||||
)
|
||||
)
|
||||
)
|
||||
#print(f"12 : {r}")
|
||||
return r
|
||||
|
||||
n1=match.group(5)
|
||||
n2=match.group(6)
|
||||
|
||||
if n1 or n2:
|
||||
a=min(int(n1 if n1 else c), int(n2 if n2 else c),c)
|
||||
b=min(max(int(n1 if n1 else 0), int(n2 if n2 else 0)),c)
|
||||
#print(f"ab : {a} ; {b}")
|
||||
r=seperator.join(
|
||||
random.sample(
|
||||
m,
|
||||
random.randint(
|
||||
a,b
|
||||
)
|
||||
)
|
||||
)
|
||||
#n1=int(match.group(5)) if not match.group(5) is None
|
||||
#n2=int(match.group(6)) if not match.group(6) is None
|
||||
else:
|
||||
r=seperator.join(
|
||||
random.sample(
|
||||
m,
|
||||
random.randint(
|
||||
0,c
|
||||
)
|
||||
)
|
||||
)
|
||||
#print(f"12 : {r}")
|
||||
return r
|
||||
|
||||
|
||||
except Exception as e:
|
||||
print(f"Error : {match.groups()}")
|
||||
print(f"Exception : {e}")
|
||||
return ""
|
||||
|
||||
|
||||
|
||||
# | 로 입력된것중 하나 가져오기 반복
|
||||
def sub_loop(text):
|
||||
bak=text
|
||||
for i in range(1, loop_max):
|
||||
tmp=resub.sub(sub, bak)
|
||||
#print(f"tmp : {tmp}")
|
||||
if bak==tmp :
|
||||
return tmp
|
||||
bak=tmp
|
||||
return bak
|
||||
|
||||
# 카드 중에서 가져오기
|
||||
def card(match):
|
||||
#print(f"card i : {match.group(2)}")
|
||||
if match.group(2) in cards :
|
||||
r=random.choice(cards[match.group(2)])
|
||||
else :
|
||||
r= match.group(2)
|
||||
#print(f"card r : {r}")
|
||||
return r
|
||||
|
||||
|
||||
# 카드 중에서 가져오기 반복. | 의 것도 처리
|
||||
def card_loop(text):
|
||||
bak=text
|
||||
for i in range(1, loop_max):
|
||||
tmp=recard.sub(card, bak)
|
||||
#print(f"card l : {bak}")
|
||||
if bak==tmp :
|
||||
tmp=sub_loop(tmp)
|
||||
except Exception as e:
|
||||
cprint(f"Error : {match.groups()}" ,Colors.YELLOW)
|
||||
cprint(f"Exception : {e}" ,Colors.YELLOW)
|
||||
return ""
|
||||
|
||||
|
||||
if bak==tmp :
|
||||
#print(f"card le : {bak}")
|
||||
return tmp
|
||||
bak=tmp
|
||||
#print(f"card le : {bak}")
|
||||
return bak
|
||||
|
||||
# 카드 파일 읽기
|
||||
def card_load():
|
||||
global cards , card_path
|
||||
cards = {}
|
||||
#print(f"path : {path}")
|
||||
files=glob.glob(card_path, recursive=True)
|
||||
#print(f"files : {files}")
|
||||
|
||||
for file in files:
|
||||
basename = os.path.basename(file)
|
||||
file_name = os.path.splitext(basename)[0]
|
||||
if not file_name in cards:
|
||||
cards[file_name]=[]
|
||||
#print(f"file_name : {file_name}")
|
||||
f = open(file, 'r', encoding='UTF8')
|
||||
lines = f.readlines()
|
||||
for line in lines:
|
||||
line=line.strip()
|
||||
# 주석 빈줄 제외
|
||||
if line.startswith("#") or len(line)==0:
|
||||
continue
|
||||
cards[file_name]+=[line]
|
||||
#print(f"line : {line}")
|
||||
print(f"cards : {len(cards)}")
|
||||
#print(f"cards : {cards.keys()}")
|
||||
|
||||
# 실행기
|
||||
def run(text):
|
||||
# | 로 입력된것중 하나 가져오기 반복
|
||||
def sub_loop(text):
|
||||
bak=text
|
||||
for i in range(1, wildcards.loop_max):
|
||||
tmp=wildcards.resub.sub(wildcards.sub, bak)
|
||||
#print(f"tmp : {tmp}")
|
||||
if bak==tmp :
|
||||
return tmp
|
||||
bak=tmp
|
||||
return bak
|
||||
|
||||
card_load()
|
||||
# 카드 중에서 가져오기
|
||||
def card(match):
|
||||
#print(f"card i : {match.group(2)}")
|
||||
if match.group(2) in wildcards.cards :
|
||||
r=random.choice(cards[match.group(2)])
|
||||
else :
|
||||
r= match.group(2)
|
||||
#print(f"card r : {r}")
|
||||
return r
|
||||
|
||||
|
||||
#print(f"text : {text}")
|
||||
result=card_loop(text)
|
||||
#print(f"result : {result}")
|
||||
return result
|
||||
|
||||
# ============================================================
|
||||
# 카드 중에서 가져오기 반복. | 의 것도 처리
|
||||
def card_loop(text):
|
||||
bak=text
|
||||
for i in range(1, wildcards.loop_max):
|
||||
tmp=wildcards.recard.sub(wildcards.card, bak)
|
||||
#print(f"card l : {bak}")
|
||||
if bak==tmp :
|
||||
tmp=wildcards.sub_loop(tmp)
|
||||
|
||||
if bak==tmp :
|
||||
#print(f"card le : {bak}")
|
||||
return tmp
|
||||
bak=tmp
|
||||
#print(f"card le : {bak}")
|
||||
return bak
|
||||
|
||||
# 카드 파일 읽기
|
||||
def card_load():
|
||||
cards=wildcards.cards
|
||||
card_path=wildcards.card_path
|
||||
cards = {}
|
||||
#print(f"path : {path}")
|
||||
files=glob.glob(card_path, recursive=True)
|
||||
#print(f"files : {files}")
|
||||
|
||||
for file in files:
|
||||
basename = os.path.basename(file)
|
||||
file_name = os.path.splitext(basename)[0]
|
||||
if not file_name in cards:
|
||||
cards[file_name]=[]
|
||||
#print(f"file_name : {file_name}")
|
||||
f = open(file, 'r', encoding='UTF8')
|
||||
lines = f.readlines()
|
||||
for line in lines:
|
||||
line=line.strip()
|
||||
# 주석 빈줄 제외
|
||||
if line.startswith("#") or len(line)==0:
|
||||
continue
|
||||
cards[file_name]+=[line]
|
||||
#print(f"line : {line}")
|
||||
print(f"cards : {len(cards)}")
|
||||
#print(f"cards : {cards.keys()}")
|
||||
|
||||
# 실행기
|
||||
def run(text):
|
||||
|
||||
wildcards.card_load()
|
||||
|
||||
#print(f"text : {text}")
|
||||
result=wildcards.card_loop(text)
|
||||
#print(f"result : {result}")
|
||||
return result
|
||||
|
||||
# ============================================================
|
||||
|
||||
#m = p.sub(sub, test)
|
||||
#print(m)
|
||||
#print(__name__)
|
||||
if __name__ == '__main__' :
|
||||
#if __name__ == '__main__' :
|
||||
# 테스트용
|
||||
test="{3$$a1|{b2|c3|}|d4|{-$$|f|g}|{-2$$h||i}|{1-$$j|k|}}/{$$l|m|}/{0$$n|}"
|
||||
print(run(test))
|
||||
print(run("{9$$a|b}"))
|
||||
test="{3$$a1|{b2|c3|}|d4|{-$$|f|g}|{-2$$h||i}|{1-$$j|k|}}/{$$l|m|}/{0$$n|}"
|
||||
print(wildcards.run(test))
|
||||
print(wildcards.run("{9$$a|b}"))
|
||||
|
||||
Reference in New Issue
Block a user