MCPcopy Create free account
hub / github.com/ipython/ipython / Breakable

Class Breakable

IPython/lib/pretty.py:442–461  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

440
441
442class Breakable(Printable):
443
444 def __init__(self, seq, width, pretty):
445 self.obj = seq
446 self.width = width
447 self.pretty = pretty
448 self.indentation = pretty.indentation
449 self.group = pretty.group_stack[-1]
450 self.group.breakables.append(self)
451
452 def output(self, stream, output_width):
453 self.group.breakables.popleft()
454 if self.group.want_break:
455 stream.write(self.pretty.newline)
456 stream.write(' ' * self.indentation)
457 return self.indentation
458 if not self.group.breakables:
459 self.pretty.group_queue.remove(self.group)
460 stream.write(self.obj)
461 return output_width + self.width
462
463
464class Group(Printable):

Callers 1

breakableMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected