Find the first index in self.completions where completions[i] is greater or equal to s, or the last index if there is no such.
(self, s)
| 76 | self.start = newstart |
| 77 | |
| 78 | def _binary_search(self, s): |
| 79 | """Find the first index in self.completions where completions[i] is |
| 80 | greater or equal to s, or the last index if there is no such. |
| 81 | """ |
| 82 | i = 0; j = len(self.completions) |
| 83 | while j > i: |
| 84 | m = (i + j) // 2 |
| 85 | if self.completions[m] >= s: |
| 86 | j = m |
| 87 | else: |
| 88 | i = m + 1 |
| 89 | return min(i, len(self.completions)-1) |
| 90 | |
| 91 | def _complete_string(self, s): |
| 92 | """Assuming that s is the prefix of a string in self.completions, |
no outgoing calls
no test coverage detected