DeepDanbooru / checkIgnore.py
MonkeyJuice's picture
check ignore
c410097
raw history blame
No virus
620 Bytes
#!/usr/bin/env python
from __future__ import annotations
def load_ignore(file_path):
result_dict = {}
with open(file_path, 'r') as file:
for line in file:
line = line.strip()
if line:
line_without_trailing_comma = line.rstrip(',')
result_dict[line_without_trailing_comma] = True
return result_dict
ignore1 = load_ignore('ignoreTag.txt')
ignore2 = load_ignore('ignoreTag2.txt')
def is_ignore(tag, ignore_type):
if ignore_type == 1:
return tag in ignore1 or tag in ignore2
elif ignore_type == 2:
return tag in ignore1