class documentation

class Stripper: (source)

View In Hierarchy

Given a series of lines, find the common prefix and strip it from them. >>> lines = [ ... 'abcdefg\n', ... 'abc\n', ... 'abcde\n', ... ] >>> res = Stripper.strip_prefix(lines) >>> res.prefix 'abc' >>> list(res.lines) ['defg\n', '\n', 'de\n'] If no prefix is common, nothing should be stripped. >>> lines = [ ... 'abcd\n', ... '1234\n', ... ] >>> res = Stripper.strip_prefix(lines) >>> res.prefix = '' >>> list(res.lines) ['abcd\n', '1234\n']

Class Method strip_prefix Undocumented
Static Method common_prefix Return the common prefix of two lines.
Method __call__ Undocumented
Method __init__ Undocumented
Instance Variable lines Undocumented
Instance Variable prefix Undocumented
@classmethod
def strip_prefix(cls, lines): (source)

Undocumented

@staticmethod
def common_prefix(s1, s2): (source)

Return the common prefix of two lines.

def __call__(self, line): (source)

Undocumented

def __init__(self, prefix, lines): (source)

Undocumented

Undocumented

Undocumented