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
return names, n_elements, n_rows
After Change
Return a list of attributes that appear in the file
n_elements = 0
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()
classes = set()
file.seek(0)
reader = csv.reader(file)
for line in reader:
names.update(mo.split("=")[0] for mo in line)