print complex using the specified indent (n) and newline (nl).
(self, d, h, n, nl=False)
| 328 | return ''.join(s) |
| 329 | |
| 330 | def print_dictionary(self, d, h, n, nl=False): |
| 331 | """ print complex using the specified indent (n) and newline (nl). """ |
| 332 | if d in h: |
| 333 | return '{}...' |
| 334 | h.append(d) |
| 335 | s = [] |
| 336 | if nl: |
| 337 | s.append('\n') |
| 338 | s.append(self.indent(n)) |
| 339 | s.append('{') |
| 340 | for item in d.items(): |
| 341 | s.append('\n') |
| 342 | s.append(self.indent(n+1)) |
| 343 | if isinstance(item[1], (list, tuple)): |
| 344 | s.append(tostr(item[0])) |
| 345 | s.append('[]') |
| 346 | else: |
| 347 | s.append(tostr(item[0])) |
| 348 | s.append(' = ') |
| 349 | s.append(self.process(item[1], h, n, True)) |
| 350 | s.append('\n') |
| 351 | s.append(self.indent(n)) |
| 352 | s.append('}') |
| 353 | h.pop() |
| 354 | return ''.join(s) |
| 355 | |
| 356 | def print_collection(self, c, h, n): |
| 357 | """print collection using the specified indent (n) and newline (nl).""" |