| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Sorry, something went wrong.
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead. |
Sorry, something went wrong.
|
Quick check if this works for the original issue test: #!/usr/bin/python3
import difflib
def get_lines(filename):
with open(filename, 'r', encoding='utf8') as fd:
return fd.readlines()
for autojunk in (True, False):
old_new = list(difflib.unified_diff(
get_lines('small.external.old.json'),
get_lines('small.external.new.json'),
autojunk=autojunk
))
new_old = list(difflib.unified_diff(
get_lines('small.external.new.json'),
get_lines('small.external.old.json'),
autojunk=autojunk
))
print('Autojunk flag:', autojunk)
print('diff external.old external.new.json | wc -l')
print(len(old_new))
print('diff external.new external.old.json | wc -l')
print(len(new_old)) Autojunk flag: True diff external.old external.new.json | wc -l 90 diff -u external.new external.old.json | wc -l 25 Autojunk flag: False diff external.old external.new.json | wc -l 25 diff -u external.new external.old.json | wc -l 25 |
Sorry, something went wrong.
|
I think the Documentation (Doc/library/difflib.rst) should get updated too to include this new parameter. |
Sorry, something went wrong.
There was a problem hiding this comment.
Please could you add tests to Lib/test/test_difflib.py?
Sorry, something went wrong.
Co-authored-by: Petr Viktorin <encukou@gmail.com>
…python#153959) * Add tests in `TestAutojunk` verifying `autojunk` propagation and behavior across `get_close_matches`, `Differ`, `ndiff`, `unified_diff`, `context_diff`, and `HtmlDiff`. * Add signature inspection tests using `inspect.signature` to verify that `autojunk=True` is present and defined as a keyword-only parameter. * Fix passing of `autojunk` as a keyword argument in `difflib._mdiff()` call to `ndiff()`.
…junk * fixed conflicts in Doc/library/difflib.rst
Documentation build overview108 files changed · + 1 added · ± 107 modified + Added ± Modified |
Sorry, something went wrong.
There was a problem hiding this comment.
The change looks good; let's make the docs great :)
Sorry, something went wrong.
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Add references to junk heuristic description section for *autojunk* kwarg.
Updating description of *autojunk* kwarg to have exactly the same wording everywhere.
There was a problem hiding this comment.
Thank you!
Sorry, something went wrong.
…o public methods and functions (pythonGH-153959)
| Back | FazBrowse Home | New Git URL |
Until now difflib methods and functions took SequenceMatcher class kwarg autojunk by default which is set up to be True in this class.. This PR aims to expose this flag to the public methods and functions of this module, in order that user can choose behavior of this option in SequenceMatcher.
Issue: #118150
Related PR: #153892