Skip to content

Skip Tasks

ecoscope.platform.tasks.skip

Functions:

all_geometry_are_none

all_geometry_are_none(*args: Any) -> bool

Check if any item in the args is an GeoDataFrame-like object with a nulled out geometry column.

Source code in ecoscope/platform/tasks/skip/_skip.py
@register()
def all_geometry_are_none(*args: Any) -> bool:
    """Check if any item in the args is an GeoDataFrame-like object with a nulled out geometry column."""
    return any(_is_gdf_duck(a) and (a.geometry.isna() | a.geometry.is_empty).all() for a in args)

all_keyed_iterables_are_skips

all_keyed_iterables_are_skips(*args: tuple[Any, ...]) -> bool

Check if all items in the keyed iterable are SKIP_SENTINEL.

Source code in ecoscope/platform/tasks/skip/_skip.py
@register()
def all_keyed_iterables_are_skips(*args: tuple[Any, ...]) -> bool:
    """Check if all items in the keyed iterable are SKIP_SENTINEL."""
    return len([i for i in args for elem in i if elem[1] is not SKIP_SENTINEL]) == 0

any_dependency_is_empty_string

any_dependency_is_empty_string(*args: tuple[Any, ...]) -> bool

Check if any arg is an empty string.

Source code in ecoscope/platform/tasks/skip/_skip.py
@register()
def any_dependency_is_empty_string(*args: tuple[Any, ...]) -> bool:
    """Check if any arg is an empty string."""
    return any(isinstance(item, str) and item == "" for item in args)

any_dependency_is_none

any_dependency_is_none(*args: tuple[Any, ...]) -> bool

Check if any arg is None.

Source code in ecoscope/platform/tasks/skip/_skip.py
@register()
def any_dependency_is_none(*args: tuple[Any, ...]) -> bool:
    """Check if any arg is None."""
    return any(item is None for item in args)

any_dependency_skipped

any_dependency_skipped(*args: tuple[Any, ...]) -> bool

Check if any item in the iterable is the SKIP_SENTINEL, indicating that some dependency was skipped.

Source code in ecoscope/platform/tasks/skip/_skip.py
@register()
def any_dependency_skipped(*args: tuple[Any, ...]) -> bool:
    """Check if any item in the iterable is the SKIP_SENTINEL,
    indicating that some dependency was skipped.
    """
    return any(item is SKIP_SENTINEL for item in args)

any_is_empty_df

any_is_empty_df(*args: tuple[Any, ...]) -> bool

Check if any item in the args is an empty DataFrame-like object.

Source code in ecoscope/platform/tasks/skip/_skip.py
@register()
def any_is_empty_df(*args: tuple[Any, ...]) -> bool:
    """Check if any item in the args is an empty DataFrame-like object."""
    return any(_is_df_duck(a) and getattr(a, "empty") for a in args)

any_keyed_iterables_are_skips

any_keyed_iterables_are_skips(*args: tuple[Any, ...]) -> bool

Check if any items in the keyed iterable are SKIP_SENTINEL.

Source code in ecoscope/platform/tasks/skip/_skip.py
@register()
def any_keyed_iterables_are_skips(*args: tuple[Any, ...]) -> bool:
    """Check if any items in the keyed iterable are SKIP_SENTINEL."""
    return len([i for i in args for elem in i if elem[1] is SKIP_SENTINEL]) > 0

never

never(*args: tuple[Any, ...]) -> bool

Always return False.

Source code in ecoscope/platform/tasks/skip/_skip.py
@register()
def never(*args: tuple[Any, ...]) -> bool:
    """Always return False."""
    return False

skip_gdf_fallback_to_none

skip_gdf_fallback_to_none(gdf: AnyGeoDataFrame | SkipSentinel) -> AnyGeoDataFrame | None

Fallback function to convert SkipSentinel to None.

Source code in ecoscope/platform/tasks/skip/_skip.py
def skip_gdf_fallback_to_none(
    gdf: AnyGeoDataFrame | SkipSentinel,
) -> AnyGeoDataFrame | None:
    """Fallback function to convert SkipSentinel to None."""
    return None if isinstance(gdf, SkipSentinel) else gdf