print complex using the specified indent (n) and newline (nl).
(self, d, h, n, nl=False)
| 286 | return '%s' % tostr(object) |
| 287 | |
| 288 | def print_object(self, d, h, n, nl=False): |
| 289 | """ print complex using the specified indent (n) and newline (nl). """ |
| 290 | s = [] |
| 291 | cls = d.__class__ |
| 292 | md = d.__metadata__ |
| 293 | if d in h: |
| 294 | s.append('(') |
| 295 | s.append(cls.__name__) |
| 296 | s.append(')') |
| 297 | s.append('...') |
| 298 | return ''.join(s) |
| 299 | h.append(d) |
| 300 | if nl: |
| 301 | s.append('\n') |
| 302 | s.append(self.indent(n)) |
| 303 | if cls != Object: |
| 304 | s.append('(') |
| 305 | if isinstance(d, Facade): |
| 306 | s.append(md.facade) |
| 307 | else: |
| 308 | s.append(cls.__name__) |
| 309 | s.append(')') |
| 310 | s.append('{') |
| 311 | for item in d: |
| 312 | if self.exclude(d, item): |
| 313 | continue |
| 314 | item = self.unwrap(d, item) |
| 315 | s.append('\n') |
| 316 | s.append(self.indent(n+1)) |
| 317 | if isinstance(item[1], (list, tuple)): |
| 318 | s.append(item[0]) |
| 319 | s.append('[]') |
| 320 | else: |
| 321 | s.append(item[0]) |
| 322 | s.append(' = ') |
| 323 | s.append(self.process(item[1], h, n, True)) |
| 324 | s.append('\n') |
| 325 | s.append(self.indent(n)) |
| 326 | s.append('}') |
| 327 | h.pop() |
| 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). """ |