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

Method matches

bpython/autocomplete.py:575–600  ·  view source on GitHub ↗
(
        self,
        cursor_offset: int,
        line: str,
        *,
        funcprops: inspection.FuncProps | None = None,
        **kwargs: Any,
    )

Source from the content-addressed store, hash-verified

573
574class ParameterNameCompletion(BaseCompletionType):
575 def matches(
576 self,
577 cursor_offset: int,
578 line: str,
579 *,
580 funcprops: inspection.FuncProps | None = None,
581 **kwargs: Any,
582 ) -> set[str] | None:
583 if funcprops is None:
584 return None
585
586 r = self.locate(cursor_offset, line)
587 if r is None:
588 return None
589
590 matches = {
591 f"{name}="
592 for name in funcprops.argspec.args
593 if isinstance(name, str) and name.startswith(r.word)
594 }
595 matches.update(
596 f"{name}="
597 for name in funcprops.argspec.kwonly
598 if name.startswith(r.word)
599 )
600 return matches if matches else None
601
602 def locate(self, cursor_offset: int, line: str) -> LinePart | None:
603 r = lineparts.current_word(cursor_offset, line)

Calls 2

locateMethod · 0.95
updateMethod · 0.80