MCPcopy Index your code
hub / github.com/python/cpython / _collect_lines

Method _collect_lines

Lib/difflib.py:1890–1909  ·  view source on GitHub ↗

Collects mdiff output into separate lists Before storing the mdiff from/to data into a list, it is converted into a single line of text with HTML markup.

(self,diffs)

Source from the content-addressed store, hash-verified

1888 yield fromdata,todata,flag
1889
1890 def _collect_lines(self,diffs):
1891 """Collects mdiff output into separate lists
1892
1893 Before storing the mdiff from/to data into a list, it is converted
1894 into a single line of text with HTML markup.
1895 """
1896
1897 fromlist,tolist,flaglist = [],[],[]
1898 # pull from/to data and flags from mdiff style iterator
1899 for fromdata,todata,flag in diffs:
1900 try:
1901 # store HTML markup of the lines into the lists
1902 fromlist.append(self._format_line(0,flag,*fromdata))
1903 tolist.append(self._format_line(1,flag,*todata))
1904 except TypeError:
1905 # exceptions occur for lines where context separators go
1906 fromlist.append(None)
1907 tolist.append(None)
1908 flaglist.append(flag)
1909 return fromlist,tolist,flaglist
1910
1911 def _format_line(self,side,flag,linenum,text):
1912 """Returns HTML markup of "from" / "to" text lines

Callers 1

make_tableMethod · 0.95

Calls 2

_format_lineMethod · 0.95
appendMethod · 0.45

Tested by

no test coverage detected