MCPcopy
hub / github.com/pytest-dev/pytest / __call__

Method __call__

src/_pytest/_argcomplete.py:80–99  ·  view source on GitHub ↗
(self, prefix: str, **kwargs: Any)

Source from the content-addressed store, hash-verified

78 self.directories = directories
79
80 def __call__(self, prefix: str, **kwargs: Any) -> list[str]:
81 # Only called on non option completions.
82 if os.sep in prefix[1:]:
83 prefix_dir = len(os.path.dirname(prefix) + os.sep)
84 else:
85 prefix_dir = 0
86 completion = []
87 globbed = []
88 if "*" not in prefix and "?" not in prefix:
89 # We are on unix, otherwise no bash.
90 if not prefix or prefix[-1] == os.sep:
91 globbed.extend(glob(prefix + ".*"))
92 prefix += "*"
93 globbed.extend(glob(prefix))
94 for x in sorted(globbed):
95 if os.path.isdir(x):
96 x += "/"
97 # Append stripping the prefix (like bash, not like compgen).
98 completion.append(x[prefix_dir:])
99 return completion
100
101
102if os.environ.get("_ARGCOMPLETE"):

Callers

nothing calls this directly

Calls 3

dirnameMethod · 0.80
appendMethod · 0.80
isdirMethod · 0.45

Tested by

no test coverage detected