Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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))
),
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)