Rename internal function as suggested during review

This commit is contained in:
Bruno Oliveira 2018-05-04 11:08:35 -03:00 committed by GitHub
parent dca77b2273
commit 413b1aa4e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -172,9 +172,9 @@ def _diff_text(left, right, verbose=False):
from difflib import ndiff
explanation = []
def to_unicode_text(binary_text):
def escape_for_readable_diff(binary_text):
"""
This ensures that the internal string is always valid unicode, converting any bytes safely to valid unicode.
Ensures that the internal string is always valid unicode, converting any bytes safely to valid unicode.
This is done using repr() which then needs post-processing to fix the encompassing quotes and un-escape
newlines and carriage returns (#429).
"""
@ -184,9 +184,9 @@ def _diff_text(left, right, verbose=False):
return r
if isinstance(left, six.binary_type):
left = to_unicode_text(left)
left = escape_for_readable_diff(left)
if isinstance(right, six.binary_type):
right = to_unicode_text(right)
right = escape_for_readable_diff(right)
if not verbose:
i = 0 # just in case left or right has zero length
for i in range(min(len(left), len(right))):