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 371bf2d5 authored by scmalte's avatar scmalte
Browse files

cluster.py: started working on clustering script

parent 6a4e6679
import re
# import argparse
import logging
import csv
from dataclasses import dataclass
DEFAULT_RESULTS_CSV_FILE="moss-report.csv"
@dataclass
class MossMatch:
legi1: str
percentage1: int
legi2: str
percentage2: int
avg_percentage: int,
lines: int
def main(results_csv_file=DEFAULT_RESULTS_CSV_FILE):
candidate_percentage_pattern = r"([\d-]+) \((\d+)%\)"
with open(results_csv_file, newline="") as csv_fh:
csv_reader = csv.DictReader(csv_fh, delimiter=",", quotechar='"')
for row in csv_reader:
match1 = re.search(candidate_percentage_pattern, row["File 1"])
match2 = re.search(candidate_percentage_pattern, row["File 2"])
moss_match = MossMatch(
match1.group(1),
match1.group(2),
match2.group(1),
match2.group(2),
row["Avg. %"],
row["Lines Matched"])
print(moss_match)
if __name__ == "__main__":
main()
......@@ -24,7 +24,8 @@ setup(
entry_points = {
"console_scripts": [
'mu-moss = mossutils.moss:main',
'mu-revise = mossutils.revise:main'
'mu-revise = mossutils.revise:main',
'mu-cluster = mossutils.cluster:main'
]
},
zip_safe=False)
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