Method: difflib.HtmlDiff._format_line
Calls: 686, Exceptions: 104, Paths: 2Back
Path 1: 582 calls (0.85)
0 (291) 1 (291)
False (364) True (218)
4 (26) 2 (24) 3 (24) 5 (24) 1 (22) 6 (18) 7 (16) 8 (16) 10 (16) 12 (16)
'123' (264) '' (40) ' 3. Simple is better than complex.' (23) '\x00- 4. Complex is better than complicated.\x01' (18) '\x00+ 5. Flat is better t...
'
1def _format_line(self,side,flag,linenum,text):
2 """Returns HTML markup of "from" / "to" text lines
3
4 side -- 0 or 1 indicating "from" or "to" text
5 flag -- indicates if difference on line
6 linenum -- line number (used for line number column)
7 text -- line text to be marked up
8 """
9 try:
10 linenum = '%d' % linenum
11 id = ' id="%s%s"' % (self._prefix[side],linenum)
12 except TypeError:
13 # handle blank lines where linenum is '>' or ''
14 id = ''
15 # replace those things that would get confused with HTML symbols
16 text=text.replace("&","&").replace(">",">").replace("<","<")
17
18 # make space non-breakable so they don't get compressed or line wrapped
19 text = text.replace(' ',' ').rstrip()
20
21 return '<td class="diff_header"%s>%s</td><td nowrap="nowrap">%s</td>' \
22 % (id,linenum,text)
Path 2: 104 calls (0.15)
1 (52) 0 (52)
True (96) False (8)
'' (54) '>' (50)
'\n' (36) ' ' (18) '\x00^e\x01d' (6) '\x00^E\x01d' (6) '\x00^\x01ed' (6) '56789012345689' (4) '012345' (4) '\x00+d\x01' (3) '\x00-cted\x01' (3) '\x00-...
'
1def _format_line(self,side,flag,linenum,text): 2 """Returns HTML markup of "from" / "to" text lines 3 4 side -- 0 or 1 indicating "from" or "to" text 5 flag -- indicates if difference on line 6 linenum -- line number (used for line number column) 7 text -- line text to be marked up 8 """ 9 try: 10 linenum = '%d' % linenum 11 id = ' id="%s%s"' % (self._prefix[side],linenum) 12 except TypeError: 13 # handle blank lines where linenum is '>' or '' 14 id = '' 15 # replace those things that would get confused with HTML symbols 16 text=text.replace("&","&").replace(">",">").replace("<","<") 17 18 # make space non-breakable so they don't get compressed or line wrapped 19 text = text.replace(' ',' ').rstrip() 20 21 return '<td class="diff_header"%s>%s</td><td nowrap="nowrap">%s</td>' \ 22 % (id,linenum,text)