Total Complexity | 9 |
Total Lines | 32 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | from .report import ValidationReport |
||
2 | |||
3 | class OcrdGdsCollector(ValidationReport): |
||
4 | |||
5 | def __init__(self, filename=None, messages=None): |
||
6 | super().__init__() |
||
7 | self.filename = filename |
||
8 | if messages is None: |
||
9 | self.warnings = [] |
||
10 | else: |
||
11 | self.warnings = messages |
||
12 | |||
13 | def add_message(self, msg): |
||
14 | self.add_warning(msg) |
||
15 | |||
16 | def get_messages(self): |
||
17 | return self.warnings |
||
18 | |||
19 | def clear_messages(self): |
||
20 | self.warnings = [] |
||
21 | |||
22 | def print_messages(self): |
||
23 | for msg in self.warnings: |
||
24 | print("Warning: {}".format(msg)) |
||
25 | |||
26 | def write_messages(self, outstream): |
||
27 | for msg in self.warnings: |
||
28 | outstream.write("Warning: {}\n".format(msg)) |
||
29 | |||
30 | class GdsCollector(OcrdGdsCollector): |
||
31 | pass |
||
32 |