@staticmethod
  def work_dirs_for_path(path, require=False):
    '''
    Given a path, return all enclosing Zinc working directories. This should be
    zero or one except in erroneous situations. Returns a list of (work_dir,
    rel_path) pairs, where rel_path is the relative path within the working
    directory.
    '''
    out = []
    all_dot_dirs = []
    # Use absolute path, so we walk all the way up to the root.
    abs_path = os.path.abspath(path)
    # We will simplify returned paths to be relative, for readability, but only if the input is relative.
    return_abs_paths = os.path.isabs(path)
    def simplify_path(p):
      return p if return_abs_paths else os.path.relpath(p)
    for (parent, rel_path) in parent_dirs(abs_path):
      dot_dir = WorkingDir._path_for_dot_dir(parent)
      if os.path.isdir(dot_dir):
        log.debug("found working dir '%s' (with relative path '%s') for path '%s'", parent, rel_path, path)
        out.append((simplify_path(parent), rel_path))
        all_dot_dirs.append(dot_dir)
    if require and not out:
      raise InvalidOperation("path is not within a Zinc working directory: %s" % path)
    if 1 > len(all_dot_dirs):
      log.error("found nested Zinc woking directories, which should never happen: %s", ", ".join(all_dot_dirs))
    return out
dataset/ETHPy150Open bloomreach/zinc/zinc.py/WorkingDir.work_dirs_for_path/swapped operands of `>`