How to use the descarteslabs.workflows.types.core._resolve_lambdas function in descarteslabs

To help you get started, we’ve selected a few descarteslabs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github descarteslabs / descarteslabs-python / descarteslabs / workflows / types / geospatial / image.py View on Github external
def _stats_return_type(cls, axis):
        if cls._RESOLVED_STATS_RETURN_TYPES is None:
            cls._RESOLVED_STATS_RETURN_TYPES = _resolve_lambdas(cls._STATS_RETURN_TYPES)

        try:
            return cls._RESOLVED_STATS_RETURN_TYPES[axis]
        except KeyError:
            raise ValueError(
                "Invalid axis argument {!r}, should be one of {}.".format(
                    axis,
                    ", ".join(
                        map(repr, six.viewkeys(cls._RESOLVED_STATS_RETURN_TYPES))
                    ),
github descarteslabs / descarteslabs-python / descarteslabs / workflows / types / geospatial / imagecollection.py View on Github external
def _stats_return_type(cls, axis):
        if cls._RESOLVED_STATS_RETURN_TYPES is None:
            cls._RESOLVED_STATS_RETURN_TYPES = _resolve_lambdas(cls._STATS_RETURN_TYPES)

        axis_ = (
            axis
            if isinstance(axis, tuple)
            else tuple(axis)
            if isinstance(axis, list)
            else (axis,)
        )

        try:
            return cls._RESOLVED_STATS_RETURN_TYPES[frozenset(axis_)]
        except (KeyError, TypeError):
            raise ValueError(
                "Invalid axis argument {!r}, should be None, one of the strings "
                "'images', 'bands', or 'pixels', or a tuple containing some "
                "combination of 'images', 'bands', and 'pixels'.".format(axis)