Method: difflib.HtmlDiff._split_line
Calls: 132, Exceptions: 0, Paths: 5Back
Path 1: 82 calls (0.62)
[] (42) list (40)
'>' (40) 14 (6) 1 (4) 3 (4) 5 (4) 9 (4) 11 (4) 16 (4) 4 (3) 10 (3)
'\x00^e\x01d' (6) '\x00^E\x01d' (6) '\x00^\x01ed' (6) 'line 0' (4) '012345' (4) 'line 1' (4) 'line 3' (4) 'line 7' (4) 'line 9' (4) 'the end' (4)
None (82)
1def _split_line(self,data_list,line_num,text):
2 """Builds list of text lines by splitting text lines at wrap point
3
4 This function will determine if the input text line needs to be
5 wrapped (split) into separate lines. If so, the first wrap point
6 will be determined and the first line appended to the output
7 text line list. This function is used recursively to handle
8 the second part of the split line to further split it.
9 """
10 # if blank line or context separator, just add it to the output list
11 if not line_num:
12 data_list.append((line_num,text))
13 return
14
15 # if line text doesn't need wrapping, just add it to the output list
16 size = len(text)
17 max = self._wrapcolumn
18 if (size <= max) or ((size -(text.count('\0')*3)) <= max):
19 data_list.append((line_num,text))
20 return
21
22 # scan text looking for the wrap point, keeping track if the wrap
23 # point is inside markers
24 i = 0
25 n = 0
26 mark = ''
27 while n < max and i < size:
28 if text[i] == '\0':
29 i += 1
30 mark = text[i]
31 i += 1
32 elif text[i] == '\1':
33 i += 1
34 mark = ''
35 else:
36 i += 1
37 n += 1
38
39 # wrap point is inside text, break it up into separate lines
40 line1 = text[:i]
41 line2 = text[i:]
42
43 # if wrap point is inside markers, place end marker at end of first
44 # line and start marker at beginning of second line because each
45 # line will have its own table tag markup around it.
46 if mark:
47 line1 = line1 + '\1'
48 line2 = '\0' + mark + line2
49
50 # tack on first line onto the output list
51 data_list.append((line_num,line1))
52
53 # use this routine again to wrap the remaining text
54 self._split_line(data_list,'>',line2)
Path 2: 24 calls (0.18)
[] (18) list (6)
6 (6) '>' (6) 4 (3) 10 (3) 12 (3) 13 (3)
'\x00+line 2 added\x01' (3) 'line 4 chan\x00^ge\x01d' (3) 'line 4 chan\x00^GE\x01d' (3) '\x00-line 8 subtracted\x01' (3) '\x00-123456789012345...
1def _split_line(self,data_list,line_num,text):
2 """Builds list of text lines by splitting text lines at wrap point
3
4 This function will determine if the input text line needs to be
5 wrapped (split) into separate lines. If so, the first wrap point
6 will be determined and the first line appended to the output
7 text line list. This function is used recursively to handle
8 the second part of the split line to further split it.
9 """
10 # if blank line or context separator, just add it to the output list
11 if not line_num:
12 data_list.append((line_num,text))
13 return
14
15 # if line text doesn't need wrapping, just add it to the output list
16 size = len(text)
17 max = self._wrapcolumn
18 if (size <= max) or ((size -(text.count('\0')*3)) <= max):
19 data_list.append((line_num,text))
20 return
21
22 # scan text looking for the wrap point, keeping track if the wrap
23 # point is inside markers
24 i = 0
25 n = 0
26 mark = ''
27 while n < max and i < size:
28 if text[i] == '\0':
29 i += 1
30 mark = text[i]
31 i += 1
32 elif text[i] == '\1':
33 i += 1
34 mark = ''
35 else:
36 i += 1
37 n += 1
38
39 # wrap point is inside text, break it up into separate lines
40 line1 = text[:i]
41 line2 = text[i:]
42
43 # if wrap point is inside markers, place end marker at end of first
44 # line and start marker at beginning of second line because each
45 # line will have its own table tag markup around it.
46 if mark:
47 line1 = line1 + '\1'
48 line2 = '\0' + mark + line2
49
50 # tack on first line onto the output list
51 data_list.append((line_num,line1))
52
53 # use this routine again to wrap the remaining text
54 self._split_line(data_list,'>',line2)
Path 3: 14 calls (0.11)
[] (10) list (4)
15 (6) 2 (4) '>' (4)
'1234567890123456789012345689012345' (4) '56789012345689012345' (4) 'just fits in two line\x00^s\x01 yup!!' (3) 'just fits in two line\x00^S\x01 yup!!...
1def _split_line(self,data_list,line_num,text):
2 """Builds list of text lines by splitting text lines at wrap point
3
4 This function will determine if the input text line needs to be
5 wrapped (split) into separate lines. If so, the first wrap point
6 will be determined and the first line appended to the output
7 text line list. This function is used recursively to handle
8 the second part of the split line to further split it.
9 """
10 # if blank line or context separator, just add it to the output list
11 if not line_num:
12 data_list.append((line_num,text))
13 return
14
15 # if line text doesn't need wrapping, just add it to the output list
16 size = len(text)
17 max = self._wrapcolumn
18 if (size <= max) or ((size -(text.count('\0')*3)) <= max):
19 data_list.append((line_num,text))
20 return
21
22 # scan text looking for the wrap point, keeping track if the wrap
23 # point is inside markers
24 i = 0
25 n = 0
26 mark = ''
27 while n < max and i < size:
28 if text[i] == '\0':
29 i += 1
30 mark = text[i]
31 i += 1
32 elif text[i] == '\1':
33 i += 1
34 mark = ''
35 else:
36 i += 1
37 n += 1
38
39 # wrap point is inside text, break it up into separate lines
40 line1 = text[:i]
41 line2 = text[i:]
42
43 # if wrap point is inside markers, place end marker at end of first
44 # line and start marker at beginning of second line because each
45 # line will have its own table tag markup around it.
46 if mark:
47 line1 = line1 + '\1'
48 line2 = '\0' + mark + line2
49
50 # tack on first line onto the output list
51 data_list.append((line_num,line1))
52
53 # use this routine again to wrap the remaining text
54 self._split_line(data_list,'>',line2)
Path 4: 6 calls (0.05)
[] (6)
7 (6)
'line 5\x00^ \x01 chan\x00^g\x01ed' (3) 'line 5\x00^a\x01 chan\x00^G\x01ed' (3)
1def _split_line(self,data_list,line_num,text):
2 """Builds list of text lines by splitting text lines at wrap point
3
4 This function will determine if the input text line needs to be
5 wrapped (split) into separate lines. If so, the first wrap point
6 will be determined and the first line appended to the output
7 text line list. This function is used recursively to handle
8 the second part of the split line to further split it.
9 """
10 # if blank line or context separator, just add it to the output list
11 if not line_num:
12 data_list.append((line_num,text))
13 return
14
15 # if line text doesn't need wrapping, just add it to the output list
16 size = len(text)
17 max = self._wrapcolumn
18 if (size <= max) or ((size -(text.count('\0')*3)) <= max):
19 data_list.append((line_num,text))
20 return
21
22 # scan text looking for the wrap point, keeping track if the wrap
23 # point is inside markers
24 i = 0
25 n = 0
26 mark = ''
27 while n < max and i < size:
28 if text[i] == '\0':
29 i += 1
30 mark = text[i]
31 i += 1
32 elif text[i] == '\1':
33 i += 1
34 mark = ''
35 else:
36 i += 1
37 n += 1
38
39 # wrap point is inside text, break it up into separate lines
40 line1 = text[:i]
41 line2 = text[i:]
42
43 # if wrap point is inside markers, place end marker at end of first
44 # line and start marker at beginning of second line because each
45 # line will have its own table tag markup around it.
46 if mark:
47 line1 = line1 + '\1'
48 line2 = '\0' + mark + line2
49
50 # tack on first line onto the output list
51 data_list.append((line_num,line1))
52
53 # use this routine again to wrap the remaining text
54 self._split_line(data_list,'>',line2)
Path 5: 6 calls (0.05)
[] (6)
8 (6)
'line 6\x00^ \x01 chang\x00^e\x01d' (3) 'line 6\x00^a\x01 chang\x00^E\x01d' (3)
1def _split_line(self,data_list,line_num,text):
2 """Builds list of text lines by splitting text lines at wrap point
3
4 This function will determine if the input text line needs to be
5 wrapped (split) into separate lines. If so, the first wrap point
6 will be determined and the first line appended to the output
7 text line list. This function is used recursively to handle
8 the second part of the split line to further split it.
9 """
10 # if blank line or context separator, just add it to the output list
11 if not line_num:
12 data_list.append((line_num,text))
13 return
14
15 # if line text doesn't need wrapping, just add it to the output list
16 size = len(text)
17 max = self._wrapcolumn
18 if (size <= max) or ((size -(text.count('\0')*3)) <= max):
19 data_list.append((line_num,text))
20 return
21
22 # scan text looking for the wrap point, keeping track if the wrap
23 # point is inside markers
24 i = 0
25 n = 0
26 mark = ''
27 while n < max and i < size:
28 if text[i] == '\0':
29 i += 1
30 mark = text[i]
31 i += 1
32 elif text[i] == '\1':
33 i += 1
34 mark = ''
35 else:
36 i += 1
37 n += 1
38
39 # wrap point is inside text, break it up into separate lines
40 line1 = text[:i]
41 line2 = text[i:]
42
43 # if wrap point is inside markers, place end marker at end of first
44 # line and start marker at beginning of second line because each
45 # line will have its own table tag markup around it.
46 if mark:
47 line1 = line1 + '\1'
48 line2 = '\0' + mark + line2
49
50 # tack on first line onto the output list
51 data_list.append((line_num,line1))
52
53 # use this routine again to wrap the remaining text
54 self._split_line(data_list,'>',line2)