To receive notifications about scheduled maintenance, please subscribe to the mailing-list gitlab-operations@sympa.ethz.ch. You can subscribe to the mailing-list at https://sympa.ethz.ch

Commit ca0d87fd authored by scmalte's avatar scmalte
Browse files

cluster.py: renamed two functions

parent 8758dce7
...@@ -29,10 +29,10 @@ class MossResult: ...@@ -29,10 +29,10 @@ class MossResult:
lines: int lines: int
match_file: str match_file: str
def flat_headers(self): def fields_flattened(self):
return [f.name for f in dataclasses.fields(self)] return [f.name for f in dataclasses.fields(self)]
def flat_data(self): def values_flattened(self):
return dataclasses.astuple(self) return dataclasses.astuple(self)
@dataclasses.dataclass @dataclasses.dataclass
...@@ -42,15 +42,15 @@ class ClusterEntry: ...@@ -42,15 +42,15 @@ class ClusterEntry:
dot_file: str dot_file: str
svg_file: str svg_file: str
def flat_headers(self): def fields_flattened(self):
field_names = [f.name for f in dataclasses.fields(self)] field_names = [f.name for f in dataclasses.fields(self)]
result_headers = self.result.flat_headers() result_headers = self.result.fields_flattened()
return field_names[:1] + result_headers + field_names[2:] return field_names[:1] + result_headers + field_names[2:]
def flat_data(self): def values_flattened(self):
field_data = dataclasses.astuple(self) field_data = dataclasses.astuple(self)
result_data = self.result.flat_data() result_data = self.result.values_flattened()
return field_data[:1] + result_data + field_data[2:] return field_data[:1] + result_data + field_data[2:]
...@@ -174,10 +174,10 @@ def create_summary_csv_file(cluster_entries, summary_csv_file): ...@@ -174,10 +174,10 @@ def create_summary_csv_file(cluster_entries, summary_csv_file):
with open(summary_csv_file, "w", newline="") as csv_fh: with open(summary_csv_file, "w", newline="") as csv_fh:
csv_writer = csv.writer(csv_fh) csv_writer = csv.writer(csv_fh)
csv_writer.writerow(cluster_entries[0].flat_headers()) csv_writer.writerow(cluster_entries[0].fields_flattened())
for entry in cluster_entries: for entry in cluster_entries:
csv_writer.writerow(entry.flat_data()) csv_writer.writerow(entry.values_flattened())
def main( def main(
results_csv_file=DEFAULT_RESULTS_CSV_FILE, results_csv_file=DEFAULT_RESULTS_CSV_FILE,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment