MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / _line_wrapper

Method _line_wrapper

tools/python-3.11.9-amd64/Lib/difflib.py:1810–1836  ·  view source on GitHub ↗

Returns iterator that splits (wraps) mdiff text lines

(self,diffs)

Source from the content-addressed store, hash-verified

1808 self._split_line(data_list,'>',line2)
1809
1810 def _line_wrapper(self,diffs):
1811 """Returns iterator that splits (wraps) mdiff text lines"""
1812
1813 # pull from/to data and flags from mdiff iterator
1814 for fromdata,todata,flag in diffs:
1815 # check for context separators and pass them through
1816 if flag is None:
1817 yield fromdata,todata,flag
1818 continue
1819 (fromline,fromtext),(toline,totext) = fromdata,todata
1820 # for each from/to line split it at the wrap column to form
1821 # list of text lines.
1822 fromlist,tolist = [],[]
1823 self._split_line(fromlist,fromline,fromtext)
1824 self._split_line(tolist,toline,totext)
1825 # yield from/to line in pairs inserting blank lines as
1826 # necessary when one side has more wrapped lines
1827 while fromlist or tolist:
1828 if fromlist:
1829 fromdata = fromlist.pop(0)
1830 else:
1831 fromdata = ('',' ')
1832 if tolist:
1833 todata = tolist.pop(0)
1834 else:
1835 todata = ('',' ')
1836 yield fromdata,todata,flag
1837
1838 def _collect_lines(self,diffs):
1839 """Collects mdiff output into separate lists

Callers 1

make_tableMethod · 0.95

Calls 2

_split_lineMethod · 0.95
popMethod · 0.45

Tested by

no test coverage detected