Method: difflib.HtmlDiff._line_wrapper
Calls: 3, Exceptions: 0, Paths: 2Back
Path 1: 2 calls (0.67)
_mdiff def (2)
tuple (56)
1def _line_wrapper(self,diffs):
2 """Returns iterator that splits (wraps) mdiff text lines"""
3
4 # pull from/to data and flags from mdiff iterator
5 for fromdata,todata,flag in diffs:
6 # check for context separators and pass them through
7 if flag is None:
8 yield fromdata,todata,flag
9 continue
10 (fromline,fromtext),(toline,totext) = fromdata,todata
11 # for each from/to line split it at the wrap column to form
12 # list of text lines.
13 fromlist,tolist = [],[]
14 self._split_line(fromlist,fromline,fromtext)
15 self._split_line(tolist,toline,totext)
16 # yield from/to line in pairs inserting blank lines as
17 # necessary when one side has more wrapped lines
18 while fromlist or tolist:
19 if fromlist:
20 fromdata = fromlist.pop(0)
21 else:
22 fromdata = ('',' ')
23 if tolist:
24 todata = tolist.pop(0)
25 else:
26 todata = ('',' ')
27 yield fromdata,todata,flag
Path 2: 1 calls (0.33)
_mdiff def (1)
tuple (19) (None, None, None) (4)
1def _line_wrapper(self,diffs):
2 """Returns iterator that splits (wraps) mdiff text lines"""
3
4 # pull from/to data and flags from mdiff iterator
5 for fromdata,todata,flag in diffs:
6 # check for context separators and pass them through
7 if flag is None:
8 yield fromdata,todata,flag
9 continue
10 (fromline,fromtext),(toline,totext) = fromdata,todata
11 # for each from/to line split it at the wrap column to form
12 # list of text lines.
13 fromlist,tolist = [],[]
14 self._split_line(fromlist,fromline,fromtext)
15 self._split_line(tolist,toline,totext)
16 # yield from/to line in pairs inserting blank lines as
17 # necessary when one side has more wrapped lines
18 while fromlist or tolist:
19 if fromlist:
20 fromdata = fromlist.pop(0)
21 else:
22 fromdata = ('',' ')
23 if tolist:
24 todata = tolist.pop(0)
25 else:
26 todata = ('',' ')
27 yield fromdata,todata,flag