Note: always resets all path trackers to track the passed paths.
(self, paths)
| 242 | return tuple(self._path_watchers) |
| 243 | |
| 244 | def set_tracked_paths(self, paths): |
| 245 | """ |
| 246 | Note: always resets all path trackers to track the passed paths. |
| 247 | """ |
| 248 | if not isinstance(paths, (list, tuple, set)): |
| 249 | paths = (paths,) |
| 250 | |
| 251 | # Sort by the path len so that the bigger paths come first (so, |
| 252 | # if there's any nesting we want the nested paths to be visited |
| 253 | # before the parent paths so that the max_recursion_level is correct). |
| 254 | paths = sorted(set(paths), key=lambda path: -len(path)) |
| 255 | path_watchers = set() |
| 256 | |
| 257 | self._single_visit_info = _SingleVisitInfo() |
| 258 | |
| 259 | initial_time = time.time() |
| 260 | for path in paths: |
| 261 | sleep_time = 0.0 # When collecting the first time, sleep_time should be 0! |
| 262 | path_watcher = _PathWatcher( |
| 263 | path, |
| 264 | self.accept_directory, |
| 265 | self.accept_file, |
| 266 | self._single_visit_info, |
| 267 | max_recursion_level=self.max_recursion_level, |
| 268 | sleep_time=sleep_time, |
| 269 | ) |
| 270 | |
| 271 | path_watchers.add(path_watcher) |
| 272 | |
| 273 | actual_time = time.time() - initial_time |
| 274 | |
| 275 | pydev_log.debug("Tracking the following paths for changes: %s", paths) |
| 276 | pydev_log.debug("Time to track: %.2fs", actual_time) |
| 277 | pydev_log.debug("Folders found: %s", len(self._single_visit_info.visited_dirs)) |
| 278 | pydev_log.debug("Files found: %s", len(self._single_visit_info.file_to_mtime)) |
| 279 | self._path_watchers = path_watchers |
| 280 | |
| 281 | def iter_changes(self): |
| 282 | """ |
no test coverage detected