Skip to content

Commit 95ec89a

Browse files
authored
Merge pull request #1319 from maxbachmann-forks/master
use rapidfuzz instead of fuzzywuzzy
2 parents 9b10256 + d19e9e7 commit 95ec89a

File tree

3 files changed

+3
-11
lines changed

3 files changed

+3
-11
lines changed

nbgrader/converters/base.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import sqlalchemy
66
import traceback
77

8+
from rapidfuzz import fuzz
89
from traitlets.config import LoggingConfigurable, Config
910
from traitlets import Bool, List, Dict, Integer, Instance, Type
1011
from traitlets import default
@@ -120,11 +121,6 @@ def init_notebooks(self) -> None:
120121
assignment_glob2 = self._format_source("*", self.coursedir.student_id)
121122
found = glob.glob(assignment_glob2)
122123
if found:
123-
# Normally it is a bad idea to put imports in the middle of
124-
# a function, but we do this here because otherwise fuzzywuzzy
125-
# prints an annoying message about python-Levenshtein every
126-
# time nbgrader is run.
127-
from fuzzywuzzy import fuzz
128124
scores = sorted([(fuzz.ratio(assignment_glob, x), x) for x in found])
129125
self.log.error("Did you mean: %s", scores[-1][1])
130126

nbgrader/exchange/exchange.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
from dateutil.tz import gettz
1010
from dateutil.parser import parse
11+
from rapidfuzz import fuzz
1112
from traitlets.config import LoggingConfigurable
1213
from traitlets import Unicode, Bool, Instance, Type, default, validate, TraitError
1314
from jupyter_core.paths import jupyter_data_dir
@@ -177,11 +178,6 @@ def _assignment_not_found(self, src_path, other_path):
177178
self.log.fatal(msg)
178179
found = glob.glob(other_path)
179180
if found:
180-
# Normally it is a bad idea to put imports in the middle of
181-
# a function, but we do this here because otherwise fuzzywuzzy
182-
# prints an annoying message about python-Levenshtein every
183-
# time nbgrader is run.
184-
from fuzzywuzzy import fuzz
185181
scores = sorted([(fuzz.ratio(self.src_path, x), x) for x in found])
186182
self.log.error("Did you mean: %s", scores[-1][1])
187183

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
"requests",
101101
"jsonschema",
102102
"alembic",
103-
"fuzzywuzzy"
103+
"rapidfuzz"
104104
]
105105
)
106106

0 commit comments

Comments
 (0)