(self, parser, namespace, paths, option_string=None)
| 111 | super(PathProcessor, self).__init__(option_strings, dest, **kwargs) |
| 112 | |
| 113 | def __call__(self, parser, namespace, paths, option_string=None): |
| 114 | root = self.repo.root if self.repo else '' |
| 115 | repo_dir = self.repo.path[:-1] if self.repo else '' # strip trailing / |
| 116 | def process_paths(): |
| 117 | for path in paths: |
| 118 | path = os.path.abspath(path) |
| 119 | if self.recursive and os.path.isdir(path): |
| 120 | for curr_dir, dirs, fps in os.walk(path, topdown=True): |
| 121 | if curr_dir.startswith(repo_dir): |
| 122 | dirs[:] = [] |
| 123 | continue |
| 124 | curr_dir_rel = os.path.relpath(curr_dir, root) |
| 125 | if (curr_dir_rel != "." and self.skip_dir_test and |
| 126 | self.skip_dir_test(curr_dir_rel)): |
| 127 | if self.skip_dir_cb: |
| 128 | self.skip_dir_cb(curr_dir_rel) |
| 129 | dirs[:] = [] |
| 130 | continue |
| 131 | for fp in fps: |
| 132 | yield os.path.join(curr_dir_rel, fp) |
| 133 | else: |
| 134 | if not path.startswith(repo_dir): |
| 135 | yield os.path.relpath(path, root) |
| 136 | else: |
| 137 | yield path |
| 138 | |
| 139 | setattr(namespace, self.dest, process_paths()) |
| 140 | |
| 141 | |
| 142 | class CommitIdProcessor(argparse.Action): |
nothing calls this directly
no outgoing calls
no test coverage detected