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

__write_key_val()   B

Complexity

Conditions 5

Size

Total Lines 14

Duplication

Lines 0
Ratio 0 %
Metric Value
cc 5
dl 0
loc 14
rs 8.5455
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