MCPcopy Index your code
hub / github.com/python/cpython / prefix

Function prefix

Lib/_pyrepl/completing_reader.py:37–50  ·  view source on GitHub ↗
(wordlist: list[str], j: int = 0)

Source from the content-addressed store, hash-verified

35
36
37def prefix(wordlist: list[str], j: int = 0) -> str:
38 d = {}
39 i = j
40 try:
41 while 1:
42 for word in wordlist:
43 d[word[i]] = 1
44 if len(d) > 1:
45 return wordlist[0][j:i]
46 i += 1
47 d = {}
48 except IndexError:
49 return wordlist[0][j:i]
50 return ""
51
52
53STRIPCOLOR_REGEX = re.compile(r"\x1B\[([0-9]{1,3}(;[0-9]{1,2})?)?[m|K]")

Callers 1

doMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…