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

Method _qformat

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

r""" Format "?" output and deal with tabs. Example: >>> d = Differ() >>> results = d._qformat('\tabcDefghiJkl\n', '\tabcdefGhijkl\n', ... ' ^ ^ ^ ', ' ^ ^ ^ ') >>> for line in results: print(repr(line))

(self, aline, bline, atags, btags)

Source from the content-addressed store, hash-verified

997 yield from g
998
999 def _qformat(self, aline, bline, atags, btags):
1000 r"""
1001 Format "?" output and deal with tabs.
1002
1003 Example:
1004
1005 >>> d = Differ()
1006 >>> results = d._qformat('\tabcDefghiJkl\n', '\tabcdefGhijkl\n',
1007 ... ' ^ ^ ^ ', ' ^ ^ ^ ')
1008 >>> for line in results: print(repr(line))
1009 ...
1010 '- \tabcDefghiJkl\n'
1011 '? \t ^ ^ ^\n'
1012 '+ \tabcdefGhijkl\n'
1013 '? \t ^ ^ ^\n'
1014 """
1015 atags = _keep_original_ws(aline, atags).rstrip()
1016 btags = _keep_original_ws(bline, btags).rstrip()
1017
1018 yield "- " + aline
1019 if atags:
1020 yield f"? {atags}\n"
1021
1022 yield "+ " + bline
1023 if btags:
1024 yield f"? {btags}\n"
1025
1026# With respect to junk, an earlier version of ndiff simply refused to
1027# *start* a match with a junk element. The result was cases like this:

Callers 1

_fancy_replaceMethod · 0.95

Calls 2

_keep_original_wsFunction · 0.85
rstripMethod · 0.45

Tested by

no test coverage detected