/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Public Member Functions | Public Attributes | Properties | Private Member Functions
DybPython::svndiff::Text Class Reference
Inheritance diagram for DybPython::svndiff::Text:
Inheritance graph
[legend]

List of all members.

Public Member Functions

def __init__
def split_
def __str__
def __repr__
def check

Public Attributes

 meta
 divs
 children
 parent

Properties

 nchild = property(_nchild)
 smry = property(_smry)
 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 173 of file svndiff.py.


Constructor & Destructor 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 179 of file svndiff.py.

00180                                        :
00181         list.__init__(self, args[0] )
00182         self.meta = {}
00183         self.meta.update(kwargs)
00184         self.divs = []
00185         self.children = []
00186         self.parent = None  


Member Function Documentation

def DybPython::svndiff::Text::split_ (   self,
  cls,
  predicate = lambda line:True,
  offset = 0 
)

Definition at line 187 of file svndiff.py.

00187                                                :True, offset=0 ):
00188         divs = []
00189         for n,line in enumerate(self):
00190             if predicate(line):
00191                 divs.append(n+offset)
00192         self.divs = divs
00193         children = []
00194         for i, n in enumerate(divs):
00195             if i + 1 < len(divs):
00196                 m = divs[i+1]
00197             else:
00198                 m = len(self) 
00199             child = cls(self[n:m], index=i, begin=n+1, end=m)   ## 1-based begin/end numbering for direct vi "set nu" comparison 
00200             child.parent = self  
00201             children.append(child) 
00202         return children
00203 
def DybPython::svndiff::Text::_nchild (   self) [private]

Definition at line 204 of file svndiff.py.

00205                      :
        return len(filter(lambda _:len(_)>0, [c.smry for c in self.children]))
def DybPython::svndiff::Text::_smry (   self) [private]

Reimplemented in DybPython::svndiff::Hunk.

Definition at line 208 of file svndiff.py.

00209                    :
        return "".join([c.smry for c in self.children])
def DybPython::svndiff::Text::__str__ (   self)

Definition at line 212 of file svndiff.py.

00213                      :
        return "\n".join(self)
def DybPython::svndiff::Text::__repr__ (   self)

Reimplemented in DybPython::svndiff::Delta.

Definition at line 214 of file svndiff.py.

00215                       :
00216         try:
00217             label = "%(index)s[%(begin)s:%(end)s]" % self.meta
00218         except KeyError:
00219             label = "%r" % self.meta     
00220         return "%s %s (%d) %d [%s] " % ( self.__class__.__name__, label, len(self), self.nchild, self.smry  ) 

def DybPython::svndiff::Text::check (   self,
  verbose = False,
  hdr = None 
)
Check can put together the split text 

Definition at line 223 of file svndiff.py.

00224                                              :
00225         """Check can put together the split text """ 
00226         rejo = self.rejoin 
00227         if hdr:
00228             rejo = "\n".join([ hdr, rejo])
00229 
00230         agree = str(self) == rejo
00231 
00232         if verbose or not(agree):
00233             print "." * 50 + " original " + "." * 50 
00234             print str(self)
00235             print "." * 50 + " recombined " + "." * 50 
00236             print rejo
00237             print "." * 100
00238         assert agree , ("mismatch for %s %r " % ( self.__class__.__name__, self) ) 


Member Data Documentation

Definition at line 179 of file svndiff.py.

Definition at line 179 of file svndiff.py.

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

Definition at line 179 of file svndiff.py.

Definition at line 179 of file svndiff.py.


Property Documentation

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

Definition at line 206 of file svndiff.py.

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

Reimplemented in DybPython::svndiff::Hunk.

Definition at line 210 of file svndiff.py.

DybPython::svndiff::Text::rejoin = property(lambda self:"\n".join([str(c) for c in self.children])) [static]

Definition at line 221 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 Fri May 16 2014 09:55:41 for DybPython by doxygen 1.7.4