MCPcopy Create free account
hub / github.com/bpython/bpython / matches

Method matches

bpython/autocomplete.py:233–251  ·  view source on GitHub ↗

Returns a list of possible matches given a line and cursor, or None if this completion type isn't applicable. ie, import completion doesn't make sense if there cursor isn't after an import or from statement, so it ought to return None. Completion types are used to:

(
        self, cursor_offset: int, line: str, **kwargs: Any
    )

Source from the content-addressed store, hash-verified

231
232 @abc.abstractmethod
233 def matches(
234 self, cursor_offset: int, line: str, **kwargs: Any
235 ) -> set[str] | None:
236 """Returns a list of possible matches given a line and cursor, or None
237 if this completion type isn't applicable.
238
239 ie, import completion doesn't make sense if there cursor isn't after
240 an import or from statement, so it ought to return None.
241
242 Completion types are used to:
243 * `locate(cur, line)` their initial target word to replace given a
244 line and cursor
245 * find `matches(cur, line)` that might replace that word
246 * `format(match)` matches to be displayed to the user
247 * determine whether suggestions should be `shown_before_tab`
248 * `substitute(cur, line, match)` in a match for what's found with
249 `target`
250 """
251 raise NotImplementedError
252
253 @abc.abstractmethod
254 def locate(self, cursor_offset: int, line: str) -> LinePart | None:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected