Public Member Functions | |
def | __init__ |
def | split_ |
def | __str__ |
def | __repr__ |
def | check |
Public Attributes | |
meta | |
divs | |
children | |
Static Public Attributes | |
tuple | nchild = property(_nchild) |
tuple | smry = property(_smry) |
tuple | rejoin = property(lambda self:"\n".join([str(c) for c in self.children])) |
Private Member Functions | |
def | _nchild |
def | _smry |
Base class that holds lines of text as a list and provides facility for splitting the text and verifying can recreate the unsplit from the pieces
Definition at line 131 of file svndiff.py.
def DybPython::svndiff::Text::__init__ | ( | self, | ||
args, | ||||
kwargs | ||||
) |
Reimplemented in DybPython::svndiff::Hunk, DybPython::svndiff::Block, DybPython::svndiff::Delta, and DybPython::svndiff::Diff.
Definition at line 133 of file svndiff.py.
def DybPython::svndiff::Text::split_ | ( | self, | ||
cls, | ||||
predicate = lambda line:True , |
||||
offset = 0 | ||||
) |
Definition at line 140 of file svndiff.py.
00144 :True, offset=0 ): 00145 divs = [] 00146 for n,line in enumerate(self): 00147 if predicate(line): 00148 divs.append(n+offset) 00149 self.divs = divs 00150 children = [] 00151 for i, n in enumerate(divs): 00152 if i + 1 < len(divs): 00153 m = divs[i+1] 00154 else: 00155 m = len(self)
def DybPython::svndiff::Text::_nchild | ( | self | ) | [private] |
Definition at line 156 of file svndiff.py.
00156 :m], index=i, begin=n+1, end=m) ## 1-based begin/end numbering for direct vi "set nu" comparison 00157 children.append(child)
def DybPython::svndiff::Text::_smry | ( | self | ) | [private] |
Reimplemented in DybPython::svndiff::Hunk.
Definition at line 160 of file svndiff.py.
00160 : 00161 return len(filter(lambda _:len(_)>0, [c.smry for c in self.children])) nchild = property(_nchild)
def DybPython::svndiff::Text::__str__ | ( | self | ) |
def DybPython::svndiff::Text::__repr__ | ( | self | ) |
Reimplemented in DybPython::svndiff::Delta.
Definition at line 166 of file svndiff.py.
00168 : 00169 return "\n".join(self) 00170 def __repr__(self): 00171 try: 00172 label = "%(index)s[%(begin)s:%(end)s]" % self.meta except KeyError:
def DybPython::svndiff::Text::check | ( | self, | ||
verbose = False , |
||||
hdr = None | ||||
) |
Check can put together the split text
Definition at line 175 of file svndiff.py.
00177 :"\n".join([str(c) for c in self.children])) 00178 00179 def check(self, verbose=False, hdr=None ): 00180 """Check can put together the split text """ 00181 rejo = self.rejoin 00182 if hdr: 00183 rejo = "\n".join([ hdr, rejo]) 00184 00185 agree = str(self) == rejo 00186 00187 if verbose or not(agree): 00188 print "." * 50 + " original " + "." * 50 00189 print str(self) 00190 print "." * 50 + " recombined " + "." * 50 00191 print rejo
tuple DybPython::svndiff::Text::nchild = property(_nchild) [static] |
Definition at line 158 of file svndiff.py.
tuple DybPython::svndiff::Text::smry = property(_smry) [static] |
tuple DybPython::svndiff::Text::rejoin = property(lambda self:"\n".join([str(c) for c in self.children])) [static] |
Definition at line 173 of file svndiff.py.
Definition at line 135 of file svndiff.py.
Definition at line 137 of file svndiff.py.
Reimplemented in DybPython::svndiff::Block, DybPython::svndiff::Delta, and DybPython::svndiff::Diff.
Definition at line 138 of file svndiff.py.