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

Method matches

bpython/autocomplete.py:353–368  ·  view source on GitHub ↗
(
        self, cursor_offset: int, line: str, **kwargs: Any
    )

Source from the content-addressed store, hash-verified

351 super().__init__(False, mode)
352
353 def matches(
354 self, cursor_offset: int, line: str, **kwargs: Any
355 ) -> set[str] | None:
356 cs = lineparts.current_string(cursor_offset, line)
357 if cs is None:
358 return None
359 matches = set()
360 username = cs.word.split(os.path.sep, 1)[0]
361 user_dir = os.path.expanduser(username)
362 for filename in _safe_glob(os.path.expanduser(cs.word)):
363 if os.path.isdir(filename):
364 filename += os.path.sep
365 if cs.word.startswith("~"):
366 filename = username + filename[len(user_dir) :]
367 matches.add(filename)
368 return matches
369
370 def locate(self, cursor_offset: int, line: str) -> LinePart | None:
371 return lineparts.current_string(cursor_offset, line)

Callers

nothing calls this directly

Calls 3

_safe_globFunction · 0.85
current_stringMethod · 0.80
addMethod · 0.45

Tested by

no test coverage detected