MCPcopy Create free account
hub / github.com/dbcli/mssql-cli / _match

Method _match

mssqlcli/mssqlcompleter.py:366–377  ·  view source on GitHub ↗
(item)

Source from the content-addressed store, hash-verified

364 pat = re.compile('(%s)' % regex)
365
366 def _match(item):
367 match_item = None
368 if item.lower()[:len(text) + 1] in (text, text + ' '):
369 # Exact match of first word in suggestion
370 # This is to get exact alias matches to the top
371 # E.g. for input `e`, 'Entries E' should be on top
372 # (before e.g. `EndUsers EU`)
373 match_item = float('Infinity'), -1
374 r = pat.search(self.unescape_name(item.lower()))
375 if r:
376 match_item = -len(r.group()), -r.start()
377 return match_item
378 else:
379 match_end_limit = len(text)
380

Callers

nothing calls this directly

Calls 2

unescape_nameMethod · 0.95
startMethod · 0.80

Tested by

no test coverage detected