aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Numerlor <[email protected]>2021-08-15 22:09:32 +0200
committerGravatar Numerlor <[email protected]>2021-08-15 22:09:32 +0200
commit2b8a5b6f5b275c40af1139fab07461e6e96bdeb4 (patch)
tree52e5ff26276452524c83615bd05e4d2ca253ff36
parentrefactor fuzzy_search to use conventional iteration (diff)
Move definition of loop vars next to loop
-rw-r--r--bot/exts/info/tags.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/bot/exts/info/tags.py b/bot/exts/info/tags.py
index d659be8c4..8bb682366 100644
--- a/bot/exts/info/tags.py
+++ b/bot/exts/info/tags.py
@@ -114,10 +114,10 @@ class Tag:
def _fuzzy_search(search: str, target: str) -> float:
"""A simple scoring algorithm based on how many letters are found / total, with order in mind."""
- current, index = 0, 0
_search = REGEX_NON_ALPHABET.sub("", search.lower())
_targets = iter(REGEX_NON_ALPHABET.split(target.lower()))
+ current, index = 0, 0
for _target in _targets:
while index < len(_target) and _search[current] == _target[index]:
current += 1