Add text and comment to the output with line terminator. Args: text: string, Text to output. comment: string, Python comment.
(self, text, comment)
| 216 | self.value.extend([" " * self.dent, text]) |
| 217 | |
| 218 | def emitEnd(self, text, comment): |
| 219 | """Add text and comment to the output with line terminator. |
| 220 | |
| 221 | Args: |
| 222 | text: string, Text to output. |
| 223 | comment: string, Python comment. |
| 224 | """ |
| 225 | if comment: |
| 226 | divider = "\n" + " " * (self.dent + 2) + "# " |
| 227 | lines = comment.splitlines() |
| 228 | lines = [x.rstrip() for x in lines] |
| 229 | comment = divider.join(lines) |
| 230 | self.value.extend([text, " # ", comment, "\n"]) |
| 231 | else: |
| 232 | self.value.extend([text, "\n"]) |
| 233 | |
| 234 | def indent(self): |
| 235 | """Increase indentation level.""" |