def _set_value(self, value: Any, flags: Optional[Dict[str, bool]] = None) -> None: if self._get_flag("readonly"): raise ReadonlyConfigError( "Cannot set value of read-only config node") self._val = self.validate_and_convert(value)
def _set_value(self, value: Any, flags: Optional[Dict[str, bool]] = None) -> None: if self._get_flag("readonly"): raise ReadonlyConfigError("Cannot set value of read-only config node") if isinstance(value, str) and get_value_kind( value, strict_interpolation_validation=True ) in ( ValueKind.INTERPOLATION, ValueKind.MANDATORY_MISSING, ): self._val = value else: self._val = self.validate_and_convert(value)
def _set_value(self, value: Any, flags: Optional[Dict[str, bool]] = None) -> None: from ._utils import ValueKind, get_value_kind if self._get_flag("readonly"): raise ReadonlyConfigError("Cannot set value of read-only config node") if isinstance(value, str) and get_value_kind(value) in ( ValueKind.INTERPOLATION, ValueKind.STR_INTERPOLATION, ValueKind.MANDATORY_MISSING, ): self._val = value else: if not self._metadata.optional and value is None: raise ValidationError("Non optional field cannot be assigned None") self._val = self.validate_and_convert(value)