MCPcopy Index your code
hub / github.com/bpython/bpython / matches

Method matches

bpython/autocomplete.py:616–637  ·  view source on GitHub ↗
(
        self,
        cursor_offset: int,
        line: str,
        *,
        locals_: dict[str, Any] | None = None,
        **kwargs: Any,
    )

Source from the content-addressed store, hash-verified

614 return lineparts.current_expression_attribute(cursor_offset, line)
615
616 def matches(
617 self,
618 cursor_offset: int,
619 line: str,
620 *,
621 locals_: dict[str, Any] | None = None,
622 **kwargs: Any,
623 ) -> set[str] | None:
624 if locals_ is None:
625 locals_ = __main__.__dict__
626
627 attr = self.locate(cursor_offset, line)
628 assert attr, "locate was already truthy for the same call"
629
630 try:
631 obj = evaluate_current_expression(cursor_offset, line, locals_)
632 except EvaluationError:
633 return set()
634
635 # strips leading dot
636 matches = (m[1:] for m in self.attr_lookup(obj, "", attr.word))
637 return {m for m in matches if _few_enough_underscores(attr.word, m)}
638
639
640try:

Callers

nothing calls this directly

Calls 4

locateMethod · 0.95
_few_enough_underscoresFunction · 0.85
attr_lookupMethod · 0.80

Tested by

no test coverage detected