Skip to content

Commit

Permalink
feat: add new release indexes functions
Browse files Browse the repository at this point in the history
  • Loading branch information
RaczeQ committed Oct 11, 2024
1 parent b2bd7dc commit b6bc3ab
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
8 changes: 7 additions & 1 deletion overturemaestro/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@
convert_geometry_to_parquet,
convert_geometry_to_parquet_for_multiple_types,
)
from overturemaestro.release_index import get_available_theme_type_pairs
from overturemaestro.release_index import (
get_all_available_release_versions,
get_available_theme_type_pairs,
get_newest_release_version,
)

__app_name__ = "OvertureMaestro"
__version__ = "0.0.3"
Expand All @@ -29,5 +33,7 @@
"convert_geometry_to_geodataframe_for_multiple_types",
"convert_geometry_to_parquet",
"convert_geometry_to_parquet_for_multiple_types",
"get_all_available_release_versions",
"get_available_theme_type_pairs",
"get_newest_release_version",
]
21 changes: 18 additions & 3 deletions overturemaestro/release_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,18 @@ def get_newest_release_version() -> str:
)
return newest_release_version

Check warning on line 74 in overturemaestro/release_index.py

View check run for this annotation

Codecov / codecov/patch

overturemaestro/release_index.py#L74

Added line #L74 was not covered by tests

def get_all_available_release_versions() -> list[str]:
"""
Get all available OvertureMaps release versions.
Checks available precalculated release indexes in the GitHub repository
and returns them.
Returns:
list[str]: Release versions.
"""
return sorted(_load_all_available_release_versions_from_github())[::-1]

Check warning on line 86 in overturemaestro/release_index.py

View check run for this annotation

Codecov / codecov/patch

overturemaestro/release_index.py#L86

Added line #L86 was not covered by tests


@overload
def load_release_indexes(
Expand Down Expand Up @@ -485,11 +497,14 @@ def _get_release_cache_directory(release: str) -> Path:
def _get_index_file_name(theme_value: str, type_value: str) -> str:
return f"{theme_value}_{type_value}.parquet"


def _load_newest_release_version_from_github() -> str:
def _load_all_available_release_versions_from_github() -> list[str]:
gh_fs = GithubFileSystem(org="kraina-ai", repo="overturemaps-releases-indexes")
release_versions = [file_path.split("/")[1] for file_path in gh_fs.ls("release_indexes")]
return cast(str, sorted(release_versions)[-1])
return release_versions

Check warning on line 503 in overturemaestro/release_index.py

View check run for this annotation

Codecov / codecov/patch

overturemaestro/release_index.py#L501-L503

Added lines #L501 - L503 were not covered by tests

def _load_newest_release_version_from_github() -> str:
release_versions = _load_all_available_release_versions_from_github()
return sorted(release_versions)[-1]

Check warning on line 507 in overturemaestro/release_index.py

View check run for this annotation

Codecov / codecov/patch

overturemaestro/release_index.py#L506-L507

Added lines #L506 - L507 were not covered by tests


def _consolidate_release_index_files(release: str, remove_other_files: bool = False) -> bool:
Expand Down

0 comments on commit b6bc3ab

Please sign in to comment.