Merge pull request #67 from nchammas/fix-style-errors

Fix style errors
This commit is contained in:
James Turk 2016-11-16 13:34:12 -05:00 committed by GitHub
commit 7883b42dfa
2 changed files with 3 additions and 3 deletions

View File

@ -7,13 +7,14 @@ from .porter import Stemmer
def _normalize(s):
return unicodedata.normalize('NFKD', s)
def _check_type(s):
def _check_type(s):
if IS_PY3 and not isinstance(s, str):
raise TypeError('expected str or unicode, got %s' % type(s).__name__)
elif not IS_PY3 and not isinstance(s, unicode):
raise TypeError('expected unicode, got %s' % type(s).__name__)
def levenshtein_distance(s1, s2):
_check_type(s1)
_check_type(s2)
@ -311,7 +312,7 @@ def nysiis(s):
def match_rating_codex(s):
_check_type(s)
s = s.upper()
codex = []

View File

@ -112,7 +112,6 @@ if platform.python_implementation() == 'CPython':
# this segfaulted on 0.1.2
assert [[jf.match_rating_comparison(h1, h2) for h1 in sha1s] for h2 in sha1s]
def test_damerau_levenshtein_unicode_segfault():
# unfortunate difference in behavior between Py & C versions
from jellyfish.cjellyfish import damerau_levenshtein_distance as c_dl