with codecs.open(args.label_flags, "r", encoding="utf-8") as f:
args.label_flags = [l.strip() for l in f if l.strip()]
else:
args.label_flags = [l for l in args.label_flags.split(",") if l]
if hasattr(args, "labels"):
if os.path.isfile(args.labels):
with codecs.open(args.labels, "r", encoding="utf-8") as f:
After Change
if hasattr(args, "labels"):
if os.path.isfile(args.labels):
with codecs.open(args.labels, "r", encoding="utf-8") as f:
args.labels = [l.strip() for l in f if l.strip()]
else:
args.labels = [l for l in args.labels.split(",") if l]
if hasattr(args, "label_flags"):
if os.path.isfile(args.label_flags):
with codecs.open(args.label_flags, "r", encoding="utf-8") as f:
args.label_flags = yaml.load(f)
else:
args.label_flags = yaml.load(args.label_flags)
// Add not overlapping labels from label flags
if not hasattr(args, "labels"):
args.labels = []
for label in args.label_flags.keys():
if label != "__all__" and label not in args.labels:
args.labels.append(label)