| Total Complexity | 25 |
| Total Lines | 85 |
| Duplicated Lines | 0 % |
| 1 | from pyprint.Printer import Printer |
||
| 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 |