MCPcopy Index your code
hub / github.com/dbcli/pgcli / _match

Method _match

pgcli/pgcompleter.py:378–387  ·  view source on GitHub ↗
(item)

Source from the content-addressed store, hash-verified

376 pat = re.compile("(%s)" % regex)
377
378 def _match(item):
379 if item.lower()[: len(text) + 1] in (text, text + " "):
380 # Exact match of first word in suggestion
381 # This is to get exact alias matches to the top
382 # E.g. for input `e`, 'Entries E' should be on top
383 # (before e.g. `EndUsers EU`)
384 return float("Infinity"), -1
385 r = pat.search(self.unescape_name(item.lower()))
386 if r:
387 return -len(r.group()), -r.start()
388
389 else:
390 match_end_limit = len(text)

Callers

nothing calls this directly

Calls 1

unescape_nameMethod · 0.95

Tested by

no test coverage detected