def list_local_datasets(self, team_slug: Optional[str] = None) -> Iterator[Path]: """ Returns a list of all local folders which are detected as dataset. Parameters ---------- team_slug: Optional[str] The team slug of the dataset. Defaults to None. Returns ------- Iterator[Path] Iterator of all local datasets """ team_configs: List[Team] = [] if team_slug: team_data: Optional[Team] = self.config.get_team(team_slug) if team_data: team_configs.append(team_data) else: team_configs = self.config.get_all_teams() for team_config in team_configs: projects_team: Path = Path( team_config.datasets_dir) / team_config.slug for project_path in projects_team.glob("*"): if project_path.is_dir() and is_project_dir(project_path): yield Path(project_path)
def it_returns_true_if_path_is_project_dir(tmp_path): releases_path = tmp_path / "releases" releases_path.mkdir() images_path = tmp_path / "images" images_path.mkdir() assert is_project_dir(tmp_path)
def list_local_datasets(self, team: Optional[str] = None) -> Iterator[Path]: """Returns a list of all local folders who are detected as dataset. Returns ------- list[Path] List of all local datasets """ team_config = self.config.get_team(team or self.default_team) for project_path in Path(team_config["datasets_dir"]).glob("*"): if project_path.is_dir() and is_project_dir(project_path): yield Path(project_path)
def list_local_datasets(self, team: Optional[str] = None) -> Iterator[Path]: """Returns a list of all local folders which are detected as dataset. Returns ------- list[Path] List of all local datasets """ if team is not None: team_configs = [self.config.get_team(team)] else: team_configs = self.config.get_all_teams() for team_config in team_configs: projects_team = Path( team_config["datasets_dir"]) / team_config["slug"] for project_path in projects_team.glob("*"): if project_path.is_dir() and is_project_dir(project_path): yield Path(project_path)
def it_returns_false_if_path_is_not_project_dir(tmp_path): assert not is_project_dir(tmp_path)