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

Method make_file

Lib/difflib.py:1757–1782  ·  view source on GitHub ↗

Returns HTML file of side by side comparison with change highlights Arguments: fromlines -- list of "from" lines tolines -- list of "to" lines fromdesc -- "from" file column header string todesc -- "to" file column header string context -- set to True

(self, fromlines, tolines, fromdesc='', todesc='',
                  context=False, numlines=5, *, charset='utf-8')

Source from the content-addressed store, hash-verified

1755 self._charjunk = charjunk
1756
1757 def make_file(self, fromlines, tolines, fromdesc='', todesc='',
1758 context=False, numlines=5, *, charset='utf-8'):
1759 """Returns HTML file of side by side comparison with change highlights
1760
1761 Arguments:
1762 fromlines -- list of "from" lines
1763 tolines -- list of "to" lines
1764 fromdesc -- "from" file column header string
1765 todesc -- "to" file column header string
1766 context -- set to True for contextual differences (defaults to False
1767 which shows full differences).
1768 numlines -- number of context lines. When context is set True,
1769 controls number of lines displayed before and after the change.
1770 When context is False, controls the number of lines to place
1771 the "next" link anchors before the next change (so click of
1772 "next" link jumps to just before the change).
1773 charset -- charset of the HTML document
1774 """
1775
1776 return (self._file_template % dict(
1777 styles=self._styles,
1778 legend=self._legend,
1779 table=self.make_table(fromlines, tolines, fromdesc, todesc,
1780 context=context, numlines=numlines),
1781 charset=charset
1782 )).encode(charset, 'xmlcharrefreplace').decode(charset)
1783
1784 def _tab_newline_replace(self,fromlines,tolines):
1785 """Returns from/to line lists with tabs expanded and newlines removed.

Calls 3

make_tableMethod · 0.95
decodeMethod · 0.45
encodeMethod · 0.45