Let schema node's type parse the receiver's value.
963731
def parse_value(self, sn: "DataNode") -> ScalarValue:
        """"""
        res = sn.type.parse_value(self.value)
        if res is None:
            raise InvalidKeyValue(self.value)
        return res
796973
def serialize(self, node: SchemaNode,
                  value: Any) -> Union[str, ColanderNullType]:
        
        if value is None:
            retval = ''
        else:
            # noinspection PyUnresolvedReferences
            retval = self.type_.serialize(node, value)
        # log.debug("AllowNoneType.serialize: {!r} -> {!r}", value, retval)
        return retval
670479
def parse_content_type(header):
    """"""
    typ = subtyp = None; options = {}
    typ, pos = expect_re(re_token, header, 0)
    _, pos = expect_lit('/', header, pos)
    subtyp, pos = expect_re(re_token, header, pos)
    ctype = header[:pos] if subtyp else ''
    while pos < len(header):
        _, pos = accept_ws(header, pos)
        _, pos = expect_lit(';', header, pos)
        _, pos = accept_ws(header, pos)
        name, pos = expect_re(re_token, header, pos)
        _, pos = expect_lit('=', header, pos)
        char = lookahead(header, pos)
        if char == '"':
            value, pos = expect_re(re_qstring, header, pos)
            value = re_qpair.sub('\\1', value)
        elif char:
            value, pos = expect_re(re_token, header, pos)
        if name and value is not None:
            options[name] = value
    return ctype, options
373978
def parse_component_type(self, node):
        

        try:
            name = node.lattrib['name']
        except:
            self.raise_error('<ComponentType> must specify a name')

        if 'extends' in node.lattrib:
            extends = node.lattrib['extends']
        else:
            extends = None

        if 'description' in node.lattrib:
            description = node.lattrib['description']
        else:
            description = ''

        component_type = ComponentType(name, description, extends)
        self.model.add_component_type(component_type)

        self.current_component_type = component_type
        self.process_nested_tags(node)
        self.current_component_type = None
346221
void processSpecialNodeTypes(NodeWithType<?, Type> node, String name) {
        Type type = node.getType();
        if ("buffer".equals(name) && isRefArray(type, "E")) {
            node.setType(atomicRefArrayType((ArrayType) type));
        } else if ("sBuffer".equals(name) && isLongArray(type)) {
            node.setType(atomicLongArrayType());
        } else if (PrimitiveType.longType().equals(type)) {
            switch(name) {
            case "mask":
            case "offset":
            case "seqOffset":
            case "lookAheadSeqOffset":
            case "lookAheadElementOffset":
                node.setType(PrimitiveType.intType());
            }
        }
    }
592903
def cast_item(cls, key, value):
        """"""
        schema_type = cls.schema.get(key)
        if schema_type is None:
            if cls.strict:
                raise TypeError(f'Invalid key {key!r}')
        elif not isinstance(value, schema_type):
            try:
                return schema_type(value)
            except CastError:
                raise
            except Exception as exc:
                raise CastError(value, schema_type) from exc
        return value
1193230
def parse_at_root(
            self,
            root,  # type: ET.Element
            state  # type: _ProcessorState
    ):
        # type: (...) -> Any
        """"""
        xml_value = self._processor.parse_at_root(root, state)
        return _hooks_apply_after_parse(self._hooks, state, xml_value)
455127
private static ViewType parseType(JsonNode node) throws UnknownViewTypeException {
		if (node.hasNonNull("type")) {
			try {
				return ViewType.valueOf(node.get("type").asText().toUpperCase(Locale.ENGLISH));
			} catch (IllegalArgumentException e) {
				throw new UnknownViewTypeException(node.get("type").asText());
			}
		} else {
			throw new UnknownViewTypeException("missing type");
		}
	}
412449
def _parse_request(self, schema, req, locations):
        """"""
        if schema.many:
            assert (
                "json" in locations
            ), "schema.many=True is only supported for JSON location"
            # The ad hoc Nested field is more like a workaround or a helper,
            # and it servers its purpose fine. However, if somebody has a desire
            # to re-design the support of bulk-type arguments, go ahead.
            parsed = self.parse_arg(
                name="json",
                field=ma.fields.Nested(schema, many=True),
                req=req,
                locations=locations,
            )
            if parsed is missing:
                parsed = []
        else:
            argdict = schema.fields
            parsed = {}
            for argname, field_obj in iteritems(argdict):
                if MARSHMALLOW_VERSION_INFO[0] < 3:
                    parsed_value = self.parse_arg(argname, field_obj, req, locations)
                    # If load_from is specified on the field, try to parse from that key
                    if parsed_value is missing and field_obj.load_from:
                        parsed_value = self.parse_arg(
                            field_obj.load_from, field_obj, req, locations
                        )
                        argname = field_obj.load_from
                else:
                    argname = field_obj.data_key or argname
                    parsed_value = self.parse_arg(argname, field_obj, req, locations)
                if parsed_value is not missing:
                    parsed[argname] = parsed_value
        return parsed
211940
function(result) {
    var oResult = {},
        schema = this.responseSchema;
        
    try {
        // Loop through each data field in each result using the schema
        for(var m = schema.fields.length-1; m >= 0 ; m--) {
            var field = schema.fields[m];
            var key = (lang.isValue(field.key)) ? field.key : field;
            var data = null;

            if(this.useXPath) {
                data = YAHOO.util.DataSource._getLocationValue(field, result);
            }
            else {
                // Values may be held in an attribute...
                var xmlAttr = result.attributes.getNamedItem(key);
                if(xmlAttr) {
                    data = xmlAttr.value;
                }
                // ...or in a node
                else {
                    var xmlNode = result.getElementsByTagName(key);
                    if(xmlNode && xmlNode.item(0)) {
                        var item = xmlNode.item(0);
                        // For IE, then DOM...
                        data = (item) ? ((item.text) ? item.text : (item.textContent) ? item.textContent : null) : null;
                        // ...then fallback, but check for multiple child nodes
                        if(!data) {
                            var datapieces = [];
                            for(var j=0, len=item.childNodes.length; j<len; j++) {
                                if(item.childNodes[j].nodeValue) {
                                    datapieces[datapieces.length] = item.childNodes[j].nodeValue;
                                }
                            }
                            if(datapieces.length > 0) {
                                data = datapieces.join("");
                            }
                        }
                    }
                }
            }
            
            
            // Safety net
            if(data === null) {
                   data = "";
            }
            // Backward compatibility
            if(!field.parser && field.converter) {
                field.parser = field.converter;
                YAHOO.log("The field property converter has been deprecated" +
                        " in favor of parser", "warn", this.toString());
            }
            var parser = (typeof field.parser === 'function') ?
                field.parser :
                DS.Parser[field.parser+''];
            if(parser) {
                data = parser.call(this, data);
            }
            // Safety measure
            if(data === undefined) {
                data = null;
            }
            oResult[key] = data;
        }
    }
    catch(e) {
        YAHOO.log("Error while parsing XML result: " + e.message);
    }

    return oResult;
}
291986
def parse_object_type_definition(lexer: Lexer) -> Node:
    """"""
    start = lexer.token
    description = parse_description(lexer)
    expect_keyword(lexer, "type")
    name = parse_name(lexer)
    interfaces = parse_implements_interfaces(lexer)
    directives = parse_directives(lexer, True)
    fields = parse_fields_definition(lexer)
    return Node(
        description=description,
        name=name,
        interfaces=interfaces,
        directives=directives,
        fields=fields,
        loc=loc(lexer, start),
    )
462397
function processJsonataType(property, type, node) {
        console.log('prep - p:%s, t:%s', property, type);
        if (type === 'jsonata') {
            try {
                property = RED.util.prepareJSONataExpression(property, node);
            } catch (err) {
                // this.error(RED._('switch.errors.invalid-expr', { error: err.message }));
                // throw new
                // verror(err, RED._('switch.errors.invalid-expr', { error: err.message }));
                throw RED._('loop.errors.invalid-expr', {error: err.message});
            }
        }

        return property;
    }
353069
def cast(self, value, custom_formatters=None, strict=True):
        """"""
        if value is None:
            if not self.nullable:
                raise InvalidSchemaValue("Null value for non-nullable schema", value, self.type)
            return self.default

        cast_mapping = self.get_cast_mapping(
            custom_formatters=custom_formatters, strict=strict)

        if self.type is not SchemaType.STRING and value == '':
            return None

        cast_callable = cast_mapping[self.type]
        try:
            return cast_callable(value)
        except ValueError:
            raise InvalidSchemaValue(
                "Failed to cast value {value} to type {type}", value, self.type)
315471
function parseStoredType(value /* , context */) {
    const regex = /^(\w+)(\((.*?)\))?$/;
    const result = value.match(regex);
    if (!result) throw new ImplementationError(`Invalid storedType "${value}"`);

    const type = result[1];
    const options = {};
    if (result[2]) {
        const regexOptions = /^(\w+)=(.*)/;
        result[3].split(';').forEach(o => {
            const resultOptions = o.match(regexOptions);
            if (!resultOptions) throw new ImplementationError(`Invalid storedType "${value}"`);
            options[resultOptions[1]] = resultOptions[2];
        });
    }

    return { type, options };
}
145413
def parse_input_object_type_extension(lexer: Lexer) -> Node:
    """"""
    start = lexer.token
    expect_keyword(lexer, "extend")
    expect_keyword(lexer, "input")
    name = parse_name(lexer)
    directives = parse_directives(lexer, True)
    fields = parse_input_fields_definition(lexer)
    if not (directives or fields):
        raise unexpected(lexer)
    return Node(
        name=name, directives=directives, fields=fields, loc=loc(lexer, start)
    )
441667
private JsonElement parseEnumType(JsonSchema schema, JsonElement value)
      throws DataConversionException {
    if (schema.getSymbols().contains(value)) {
      return value;
    }
    throw new DataConversionException(
        "Invalid symbol: " + value.getAsString() + " allowed values: " + schema.getSymbols().toString());
  }
503350
function processValue(schema, value) {
  // "enum" is a reserved word, so only "type" and "items" can be destructured
  const { type, items } = schema;
  if (value === "") {
    return undefined;
  } else if (type === "array" && items && nums.has(items.type)) {
    return value.map(asNumber);
  } else if (type === "boolean") {
    return value === "true";
  } else if (type === "number") {
    return asNumber(value);
  }

  // If type is undefined, but an enum is present, try and infer the type from
  // the enum values
  if (schema.enum) {
    if (schema.enum.every(x => guessType(x) === "number")) {
      return asNumber(value);
    } else if (schema.enum.every(x => guessType(x) === "boolean")) {
      return value === "true";
    }
  }

  return value;
}