MCPcopy Index your code
hub / github.com/1Panel-dev/MaxKB / convert_value

Method convert_value

apps/tools/serializers/tool.py:602–613  ·  view source on GitHub ↗
(name: str, value: str, _type: str, is_required: bool)

Source from the content-addressed store, hash-verified

600
601 @staticmethod
602 def convert_value(name: str, value: str, _type: str, is_required: bool):
603 if not is_required and (value is None or (isinstance(value, str) and len(value.strip()) == 0)):
604 return None
605 try:
606 return common_convert_value(_type, value)
607 except Exception as e:
608 raise AppApiException(
609 500,
610 _("Field: {name} Type: {type} Value: {value} Type conversion error").format(
611 name=name, type=_type, value=value
612 ),
613 )
614
615 class Operate(serializers.Serializer):
616 id = serializers.UUIDField(required=True, label=_("tool id"))

Callers 1

debugMethod · 0.95

Calls 2

common_convert_valueFunction · 0.90
AppApiExceptionClass · 0.90

Tested by

no test coverage detected