MCPcopy Create free account
hub / github.com/pytest-dev/pytest / __call__

Method __call__

testing/test_argcomplete.py:46–65  ·  view source on GitHub ↗
(self, prefix, **kwargs)

Source from the content-addressed store, hash-verified

44 self.directories = directories
45
46 def __call__(self, prefix, **kwargs):
47 completion = []
48 if self.allowednames:
49 if self.directories:
50 files = _wrapcall(["bash", "-c", f"compgen -A directory -- '{prefix}'"])
51 completion += [f + "/" for f in files]
52 for x in self.allowednames:
53 completion += _wrapcall(
54 ["bash", "-c", f"compgen -A file -X '!*.{x}' -- '{prefix}'"]
55 )
56 else:
57 completion += _wrapcall(["bash", "-c", f"compgen -A file -- '{prefix}'"])
58
59 anticomp = _wrapcall(["bash", "-c", f"compgen -A directory -- '{prefix}'"])
60
61 completion = list(set(completion) - set(anticomp))
62
63 if self.directories:
64 completion += [f + "/" for f in anticomp]
65 return completion
66
67
68class TestArgComplete:

Callers

nothing calls this directly

Calls 1

_wrapcallFunction · 0.85

Tested by

no test coverage detected