in glean_parser/lint.py [0:0]
def _hamming_distance(str1: str, str2: str) -> int:
"""
Count the # of differences between strings str1 and str2,
padding the shorter one with whitespace
"""
diffs = 0
if len(str1) < len(str2):
str1, str2 = str2, str1
len_dist = len(str1) - len(str2)
str2 += " " * len_dist
for ch1, ch2 in zip(str1, str2):
if ch1 != ch2:
diffs += 1
return diffs