File size: 766 Bytes
d26f22a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
"""Read one ``comp.log`` body.

M001 and M002 pass the text they already have, from disk or from a git blob.
The UVS summary-line format is not known yet, so the counts stay unset.
"""

from __future__ import annotations

from dataclasses import dataclass


@dataclass(frozen=True)
class CompLogSummary:
    """Error and warning totals from one compile log.

    ``None`` means the summary line could not be read. It is not zero.
    """

    error_count: int | None
    warning_count: int | None


def read_comp_log(text: str) -> CompLogSummary:
    """Return the summary-line error and warning counts in ``text``."""
    if not isinstance(text, str):
        raise TypeError("text must be a string")
    return CompLogSummary(error_count=None, warning_count=None)