Parse value specified in a YANG module.

        Args:
            text: String representation of the value.

        Raises:
            InvalidArgument: If the receiver type cannot parse the text.
972337
def from_yang(self, text: str) -> ScalarValue:
        
        res = self.parse_value(text)
        if res is None:
            raise InvalidArgument(text)
        return res
826664
def parse(self, text, fn=None):
        

        if PY2 and not isinstance(text, unicode):
            # specify Unicode for Python 2.7
            text = unicode(text, 'utf-8')

        if self.expand_includes:
            text = self.load_includes(text, fn=fn)

        try:
            self._comments[:] = []  # clear any comments from a previous parse
            tree = self.lalr.parse(text)
            if self.include_comments:
                self.assign_comments(tree, self._comments)
            return tree
        except (ParseError, UnexpectedInput) as ex:
            if fn:
                log.error("Parsing of {} unsuccessful".format(fn))
            else:
                log.error("Parsing of Mapfile unsuccessful")
            log.info(ex)
            raise
1271608
def valueFromText( self, text ):
        
        value, currency = projex.money.fromString(text)
        
        return value
1302431
def parse(self, text):
        
        #: Do not process empty strings (Issue #3)
        if text.strip() == "":
            return ""
        #: Do not process strings consisting of a single punctuation mark (Issue #4)
        elif text.strip() in PUNCTUATION:
            _sym = text.strip()
            if _sym in tuple('.?!'):
                _tag = "."
            else:
                _tag = _sym
            if self.lemmata:
                return "{0}/{1}/O/O/{0}".format(_sym, _tag)
            else:
                return "{0}/{1}/O/O".format(_sym, _tag)
        if self.tokenize:
            _tokenized = " ".join(self.tokenizer.tokenize(text))
        else:
            _tokenized = text

        _parsed = pattern_parse(_tokenized,
                                # text is tokenized before it is passed on to
                                # pattern.de.parse
                                tokenize=False,
                                tags=self.tags, chunks=self.chunks,
                                relations=self.relations, lemmata=self.lemmata,
                                encoding=self.encoding, tagset=self.tagset)
        if self.pprint:
            _parsed = pattern_pprint(_parsed)

        return _parsed
7068
def Parse(text):
  
  precondition.AssertType(text, Text)

  if compatibility.PY2:
    text = text.encode("utf-8")

  return yaml.safe_load(text)
735997
def parse_line(text):
    
    indent,text = calculate_indent(text)
    results = line_parser.parseString(text, parseAll=True).asList()
    return indent,results[0]
722349
def parse(self, text):
        """"""
        self.expr = text
        try:
            out = ast.parse(text)
        except SyntaxError:
            self.raise_exception(None, msg='Syntax Error', expr=text)
        except:
            self.raise_exception(None, msg='Runtime Error', expr=text)

        return out
1157427
private String processText(String text) {
        String rslt = text; // default
        Expression x =
                portalSpELService.parseExpression(
                        text, PortalSpELServiceImpl.TemplateParserContext.INSTANCE);
        rslt = x.getValue(ctx, String.class);
        return rslt;
    }
1369713
@Pure
	@SuppressWarnings("checkstyle:cyclomaticcomplexity")
	public static AttributeValueImpl parse(String text) {
		final AttributeValueImpl value = new AttributeValueImpl(text);
		if (text != null && !text.isEmpty()) {
			Object binValue;
			for (final AttributeType type : AttributeType.values()) {
				try {
					binValue = null;
					switch (type) {
					case BOOLEAN:
						binValue = value.getBoolean();
						break;
					case DATE:
						binValue = value.getDate();
						break;
					case ENUMERATION:
						binValue = value.getEnumeration();
						break;
					case INET_ADDRESS:
						binValue = value.getInetAddress();
						break;
					case INTEGER:
						binValue = value.getInteger();
						break;
					case OBJECT:
						binValue = value.getJavaObject();
						break;
					case POINT:
						binValue = parsePoint((String) value.value, true);
						break;
					case POINT3D:
						binValue = parsePoint3D((String) value.value, true);
						break;
					case POLYLINE:
						binValue = parsePolyline((String) value.value, true);
						break;
					case POLYLINE3D:
						binValue = parsePolyline3D((String) value.value, true);
						break;
					case REAL:
						binValue = value.getReal();
						break;
					case STRING:
						binValue = value.getString();
						break;
					case TIMESTAMP:
						binValue = value.getTimestamp();
						break;
					case TYPE:
						binValue = value.getJavaClass();
						break;
					case URI:
						binValue = parseURI((String) value.value);
						break;
					case URL:
						binValue = value.getURL();
						break;
					case UUID:
						binValue = parseUUID((String) value.value);
						break;
					default:
						//
					}
					if (binValue != null) {
						return new AttributeValueImpl(type, binValue);
					}
				} catch (Throwable exception) {
					//
				}
			}
		}
		return value;
	}
812863
def set_text(self, text):
        
        log = logging.getLogger(self.cls_logger + '.set_text')
        if not isinstance(text, basestring):
            msg = 'text arg must be a string'
            log.error(msg)
            raise ValueError(msg)
        self.payload['text'] = text
        log.debug('Set message text to: {t}'.format(t=text))
23698
function(text) {
			var result = text;
			try {
				switch (this._headers.Accept) {
					case "application/json":
						result = JSON.parse(text);
						break;
					case "text/xml":
						result = new DOMParser().parseFromString(text, "text/xml");
						break;
				}
			} catch (exception) {
				if (gui.debug) {
					console.error(
						this._headers.Accept + " dysfunction at " + this._url
					);
				}
			}
			return result;
		}
563322
def from_yang(self, text: str) -> Optional[QualName]:
        """"""
        try:
            return self.sctx.schema_data.translate_pname(text, self.sctx.text_mid)
        except (ModuleNotRegistered, UnknownPrefix):
            raise InvalidArgument(text)
546445
def parse(self, ctx, ref, text):
        

        self.ctx = ctx
        self.pos = error.Position(ref)
        self.top = None
        try:
            self.tokenizer = YangTokenizer(text, self.pos, ctx.errors,
                                           ctx.max_line_len, ctx.keep_comments,
                                           not ctx.lax_quote_checks)
            stmt = self._parse_statement(None)
        except error.Abort:
            return None
        except error.Eof as e:
            error.err_add(self.ctx.errors, self.pos, 'EOF_ERROR', ())
            return None
        try:
            # we expect a error.Eof at this point, everything else is an error
            self.tokenizer.peek()
        except error.Eof:
            return stmt
        except:
            pass
        error.err_add(self.ctx.errors, self.pos, 'TRAILING_GARBAGE', ())
        return None
735797
public static Parameters parse(String text) throws AponParseException {
        Parameters parameters = new VariableParameters();
        return parse(text, parameters);
    }
550860
public static long parseBytes(String text) throws IllegalArgumentException {
		checkNotNull(text, "text");

		final String trimmed = text.trim();
		checkArgument(!trimmed.isEmpty(), "argument is an empty- or whitespace-only string");

		final int len = trimmed.length();
		int pos = 0;

		char current;
		while (pos < len && (current = trimmed.charAt(pos)) >= '0' && current <= '9') {
			pos++;
		}

		final String number = trimmed.substring(0, pos);
		final String unit = trimmed.substring(pos).trim().toLowerCase(Locale.US);

		if (number.isEmpty()) {
			throw new NumberFormatException("text does not start with a number");
		}

		final long value;
		try {
			value = Long.parseLong(number); // this throws a NumberFormatException on overflow
		}
		catch (NumberFormatException e) {
			throw new IllegalArgumentException("The value '" + number +
					"' cannot be re represented as 64bit number (numeric overflow).");
		}

		final long multiplier;
		if (unit.isEmpty()) {
			multiplier = 1L;
		}
		else {
			if (matchesAny(unit, BYTES)) {
				multiplier = 1L;
			}
			else if (matchesAny(unit, KILO_BYTES)) {
				multiplier = 1024L;
			}
			else if (matchesAny(unit, MEGA_BYTES)) {
				multiplier = 1024L * 1024L;
			}
			else if (matchesAny(unit, GIGA_BYTES)) {
				multiplier = 1024L * 1024L * 1024L;
			}
			else if (matchesAny(unit, TERA_BYTES)) {
				multiplier = 1024L * 1024L * 1024L * 1024L;
			}
			else {
				throw new IllegalArgumentException("Memory size unit '" + unit +
						"' does not match any of the recognized units: " + MemoryUnit.getAllUnits());
			}
		}

		final long result = value * multiplier;

		// check for overflow
		if (result / multiplier != value) {
			throw new IllegalArgumentException("The value '" + text +
					"' cannot be re represented as 64bit number of bytes (numeric overflow).");
		}

		return result;
	}
1260464
def parse_input(self, text):
        

        parts = util.split(text)
        command = parts[0] if text and parts else None
        command = command.lower() if command else None
        args = parts[1:] if len(parts) > 1 else []

        return (command, args)
1208879
def parse_inline(text):
    

    m = INLINE_SPLITTER.match(text)
    if not m:
        raise InlineUnparsableError
    args = m.group('args')
    name = m.group('name')
    value = ""
    kwtxt = ""
    kwargs = {}
    if args:
        kwtxt = INLINE_KWARG_PARSER.search(args).group('kwargs')
        value = re.sub("%s\Z" % kwtxt, "", args)
        value = value.strip()
    if m.group('variant'):
        kwargs['variant'] = m.group('variant')
    if kwtxt:
        for kws in kwtxt.split():
            k, v = kws.split('=')
            kwargs[str(k)] = v
    return (name, value, kwargs)