MCPcopy Create free account
hub / github.com/Dispatcharr/Dispatcharr / _normalize_actions

Method _normalize_actions

apps/plugins/loader.py:663–680  ·  view source on GitHub ↗
(self, actions: Any)

Source from the content-addressed store, hash-verified

661 return normalized
662
663 def _normalize_actions(self, actions: Any) -> List[Dict[str, Any]]:
664 try:
665 from .serializers import PluginActionSerializer
666 except Exception:
667 return actions if isinstance(actions, list) else []
668 if not isinstance(actions, list):
669 return []
670 serializer = PluginActionSerializer(data=actions, many=True)
671 if serializer.is_valid():
672 return serializer.validated_data
673 normalized: List[Dict[str, Any]] = []
674 for item in actions:
675 item_ser = PluginActionSerializer(data=item)
676 if item_ser.is_valid():
677 normalized.append(item_ser.validated_data)
678 else:
679 logger.warning("Invalid plugin action entry ignored: %s", item_ser.errors)
680 return normalized
681
682 def _merge_settings_with_defaults(self, settings: Dict[str, Any], fields: List[Dict[str, Any]]) -> Dict[str, Any]:
683 merged = dict(settings or {})

Callers 2

_load_pluginMethod · 0.95

Calls 1

Tested by

no test coverage detected