• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

d120 / pyfeedback / 14319914219

07 Apr 2025 09:32PM UTC coverage: 89.039% (-0.008%) from 89.047%
14319914219

push

github

4-dash
tan parser modification

9 of 10 new or added lines in 1 file covered. (90.0%)

2640 of 2965 relevant lines covered (89.04%)

0.89 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

96.15
/src/feedback/parser/tan.py
1
from csv import reader, Sniffer
1✔
2
from typing import Dict, List
1✔
3
import re
1✔
4

5
def parse(csv: bytes) -> Dict[str, List[str]]:
1✔
6
    data: Dict[str, List[str]] = {}
1✔
7
    csvfile = csv.read().decode('utf-8')
1✔
8
    dialect = Sniffer().sniff(csvfile[0:1024])
1✔
9
    csvreader = reader(csvfile.split("\n")[1:], dialect)
1✔
10
    data: Dict[str, List[str]] = {}
1✔
11
    for row in csvreader:
1✔
12
        if row == []:
1✔
13
            break
1✔
14
        tan = ''
1✔
15
        # is this a TAN lecture?
16
        if row[2] != '':
1✔
17
            # short tan is in the third field
18
            tan = row[2]
1✔
19
        else:
20
            # codewords are saved in the second field
21
            tan = row[1]
1✔
22
        
23
        pattern = r"\(\d{2}-\d{2}-.*\)"
1✔
24

25
        dic = {
1✔
26
            "&" : "&",
27
            "ä" : "ä",
28
            "Ä" : "Ä",
29
            "ö" : "ö",
30
            "Ö" : "Ö",
31
            "ü" : "ü",
32
            "Ü" : "Ü",
33
            "ß" : "ß",
34
        }
35

36
        # remove suffix with modul number
37
        row_0 = re.sub(pattern, "", row[0]).strip()
1✔
38

39
        # replace html characters
40
        for ch in dic.keys() :
1✔
41
            if ch in row_0 :
1✔
NEW
42
                row_0 = row_0.replace(ch, dic.get(ch))
×
43

44
        if row_0 not in data:
1✔
45
            data[row_0] = [tan]
1✔
46
        else:
47
            data[row_0].append(tan)
1✔
48

49
    return data
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc