MCPcopy Index your code
hub / github.com/dbcli/mycli / find_fuzzy_match

Method find_fuzzy_match

mycli/sqlcompleter.py:1274–1292  ·  view source on GitHub ↗
(
        self,
        item: str,
        pattern: re.Pattern[str],
        under_words_text: list[str],
        case_words_text: list[str],
    )

Source from the content-addressed store, hash-verified

1272 return occurrences >= len(text_parts)
1273
1274 def find_fuzzy_match(
1275 self,
1276 item: str,
1277 pattern: re.Pattern[str],
1278 under_words_text: list[str],
1279 case_words_text: list[str],
1280 ) -> int | None:
1281 if pattern.search(item.lower()):
1282 return Fuzziness.REGEX
1283
1284 under_words_item = [x for x in item.lower().split('_') if x]
1285 if self.word_parts_match(under_words_text, under_words_item):
1286 return Fuzziness.UNDER_WORDS
1287
1288 case_words_item = re.split(_CASE_CHANGE_PAT, item)
1289 if self.word_parts_match(case_words_text, case_words_item):
1290 return Fuzziness.CAMEL_CASE
1291
1292 return None
1293
1294 def find_fuzzy_matches(
1295 self,

Callers 2

find_fuzzy_matchesMethod · 0.95
test_find_fuzzy_matchFunction · 0.95

Calls 2

word_parts_matchMethod · 0.95
splitMethod · 0.80

Tested by 1

test_find_fuzzy_matchFunction · 0.76