MCPcopy Create free account
hub / github.com/bloomberg/pystack / ReadableDirectory

Class ReadableDirectory

src/pystack/__main__.py:91–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

89
90
91class ReadableDirectory(argparse.Action):
92 def __call__(
93 self,
94 parser: argparse.ArgumentParser,
95 namespace: argparse.Namespace,
96 values: Any,
97 option_string: Optional[str] = None,
98 ) -> None:
99 prospective_dir = os.path.expanduser(values)
100 if not os.path.isdir(prospective_dir):
101 parser.error(f"{prospective_dir} is not a valid path")
102 if not os.access(prospective_dir, os.R_OK):
103 parser.error(f"{prospective_dir} is not a readable directory")
104 setattr(namespace, self.dest, prospective_dir)
105
106
107def generate_cli_parser() -> argparse.ArgumentParser:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected