n_elements = 0
n_rows = 0
for line in file:
items = set(mo.group(1).strip()
for mo in self.re_name.finditer(line))
names.update(items)
n_elements += len(items)
n_rows += 1
After Change
classes = file.readline().strip()
header = classes.lower().startswith("classes:")
if header:
classes = set(x.strip() for x in classes[8:].split(","))
names = set(classes)
else:
names = set()