def _process_change(self, change): existing, nonexisting = self._get_existing_and_nonexisting_paths(change) existing = filter(None, map(lambda path: file_util.relative(path, None), existing)) nonexisting = filter(None, map(lambda path: file_util.relative(path, None), nonexisting)) if len(existing + nonexisting) == 0: info("skipped: %s" % (change.src_path)) return self.reset_scan() if not change.is_directory: existing = filter(file_util.is_pyfile, existing) nonexisting = filter(file_util.is_pyfile, nonexisting) map(self._inspect, existing) map(self._remove, nonexisting)
def _process_change(self, change): existing, nonexisting = self._get_existing_and_nonexisting_paths( change) existing = filter( None, map(lambda path: file_util.relative(path, None), existing)) nonexisting = filter( None, map(lambda path: file_util.relative(path, None), nonexisting)) if len(existing + nonexisting) == 0: info("skipped: %s" % (change.src_path)) return self.reset_scan() if not change.is_directory: existing = filter(file_util.is_pyfile, existing) nonexisting = filter(file_util.is_pyfile, nonexisting) map(self._inspect, existing) map(self._remove, nonexisting)
def _walk(self, dir): for root, dirs, files in os.walk(dir): for dir_ in dirs: if dir_.startswith('.'): dirs.remove(dir_) for file_ in files: try: rel_path = file_util.relative(os.path.join(root, file_)) except file_util.FileOutsideCurrentRoot: info("skipped non-cwd file: %s" % (file_,)) continue self._inspect(rel_path)
def _walk(self, dir): for root, dirs, files in os.walk(dir): for dir_ in dirs: if dir_.startswith('.'): dirs.remove(dir_) for file_ in files: try: rel_path = file_util.relative(os.path.join(root, file_)) except file_util.FileOutsideCurrentRoot: info("skipped non-cwd file: %s" % (file_, )) continue self._inspect(rel_path)
def update(self): """ updates state by visiting all python files in `base` """ self.reset() self.removed = set(self.dependencies) for root, dirs, files in os.walk(base): for dir_ in dirs: if dir_.startswith('.'): dirs.remove(dir_) for file_ in files: rel_path = file_util.relative(os.path.join(root, file_), None) if rel_path is not None and file_util.is_pyfile(rel_path): self.inspect(rel_path, known_exists = True) else: debug("skipped non-python or non-cwd file: %s" % (file_,)) for removed_file in self.removed: info("removed: %s" % removed_file.path) del self.dependencies[removed_file.path]
def _get_dependencies(self, file_stamp): paths = self._get_direct_dependency_paths(file_stamp.path) rel_paths = [FileStamp(file_util.relative(path)) for path in paths if file_util.relative(path, None) is not None] debug("rel_paths: %s" % (rel_paths)) return rel_paths
def _get_dependencies(self): paths = self._get_direct_dependency_paths(self.path) rel_paths = filter(lambda x: x is not None, map(lambda p: file_util.relative(p, None), paths)) log.debug("rel_paths: %s" % (rel_paths)) return rel_paths