Failed Conditions
Pull Request — master (#1127)
by Mischa
01:56
created

coalib.output.printers.ConfWriter   A

Complexity

Total Complexity 25

Size/Duplication

Total Lines 85
Duplicated Lines 0 %
Metric Value
dl 0
loc 85
rs 10
wmc 25

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __write_section_name() 0 9 3
A write_sections() 0 6 3
B __write_key_val() 0 14 5
F write_section() 0 27 11
A is_comment() 0 3 1
A _close() 0 2 1
A __init__() 0 17 1
1
from pyprint.Printer import Printer
2
3
4
class StringPrinter(Printer):
5
    """
6
    This is a simple printer that prints everything to a string.
7
    """
8
9
    def __init__(self):
10
        """
11
        Creates a new StringPrinter with an empty print string.
12
        """
13
        Printer.__init__(self)
14
15
        self._string = ""
16
17
    def _print(self, output, **kwargs):
18
        self._string += output
19
20
    def clear(self):
21
        """
22
        Clears the print string.
23
        """
24
        self._string = ""
25
26
    @property
27
    def string(self):
28
        """
29
        Gets the print string.
30
        """
31
        return self._string
32