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

Method _line_wrapper

Lib/difflib.py:1862–1888  ·  view source on GitHub ↗

Returns iterator that splits (wraps) mdiff text lines

(self,diffs)

Source from the content-addressed store, hash-verified

1860 self._split_line(data_list,'>',line2)
1861
1862 def _line_wrapper(self,diffs):
1863 """Returns iterator that splits (wraps) mdiff text lines"""
1864
1865 # pull from/to data and flags from mdiff iterator
1866 for fromdata,todata,flag in diffs:
1867 # check for context separators and pass them through
1868 if flag is None:
1869 yield fromdata,todata,flag
1870 continue
1871 (fromline,fromtext),(toline,totext) = fromdata,todata
1872 # for each from/to line split it at the wrap column to form
1873 # list of text lines.
1874 fromlist,tolist = [],[]
1875 self._split_line(fromlist,fromline,fromtext)
1876 self._split_line(tolist,toline,totext)
1877 # yield from/to line in pairs inserting blank lines as
1878 # necessary when one side has more wrapped lines
1879 while fromlist or tolist:
1880 if fromlist:
1881 fromdata = fromlist.pop(0)
1882 else:
1883 fromdata = ('',' ')
1884 if tolist:
1885 todata = tolist.pop(0)
1886 else:
1887 todata = ('',' ')
1888 yield fromdata,todata,flag
1889
1890 def _collect_lines(self,diffs):
1891 """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