| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

DybPython::svndiff::Text Class Reference

Inheritance diagram for DybPython::svndiff::Text:
[legend]
List of all members.

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

Detailed Description

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.


Member Function Documentation

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.

00137                                        :
00138         list.__init__(self, args[0] )
00139         self.meta = {}
        self.meta.update(kwargs)

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  ) 

Definition at line 164 of file svndiff.py.

00164                    :
00165         return "".join([c.smry for c in self.children])
    smry = property(_smry)    

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


Member Data Documentation

tuple DybPython::svndiff::Text::nchild = property(_nchild) [static]

Definition at line 158 of file svndiff.py.

tuple DybPython::svndiff::Text::smry = property(_smry) [static]

Reimplemented in DybPython::svndiff::Hunk.

Definition at line 162 of file svndiff.py.

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.

DybPython::svndiff::Text::meta

Definition at line 135 of file svndiff.py.

DybPython::svndiff::Text::divs

Definition at line 137 of file svndiff.py.

DybPython::svndiff::Text::children

Reimplemented in DybPython::svndiff::Block, DybPython::svndiff::Delta, and DybPython::svndiff::Diff.

Definition at line 138 of file svndiff.py.


The documentation for this class was generated from the following file:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 20:13:02 2011 for DybPython by doxygen 1.4.7