MCPcopy Create free account
hub / github.com/apple/coremltools / ParseInteger

Function ParseInteger

deps/protobuf/python/google/protobuf/text_format.py:1659–1679  ·  view source on GitHub ↗

Parses an integer. Args: text: The text to parse. is_signed: True if a signed integer must be parsed. is_long: True if a long integer must be parsed. Returns: The integer value. Raises: ValueError: Thrown Iff the text is not a valid integer.

(text, is_signed=False, is_long=False)

Source from the content-addressed store, hash-verified

1657
1658
1659def ParseInteger(text, is_signed=False, is_long=False):
1660 """Parses an integer.
1661
1662 Args:
1663 text: The text to parse.
1664 is_signed: True if a signed integer must be parsed.
1665 is_long: True if a long integer must be parsed.
1666
1667 Returns:
1668 The integer value.
1669
1670 Raises:
1671 ValueError: Thrown Iff the text is not a valid integer.
1672 """
1673 # Do the actual parsing. Exception handling is propagated to caller.
1674 result = _ParseAbstractInteger(text)
1675
1676 # Check if the integer is sane. Exceptions handled by callers.
1677 checker = _INTEGER_CHECKERS[2 * int(is_long) + int(is_signed)]
1678 checker.CheckValue(result)
1679 return result
1680
1681
1682def _ParseAbstractInteger(text):

Callers 9

_MergeFieldMethod · 0.85
_ConsumeIntegerFunction · 0.85
ConsumeIntegerMethod · 0.85
ConsumeInteger64Method · 0.85
ConsumeNumberMethod · 0.85
ParseIntegerMethod · 0.85
TEST_FFunction · 0.85

Calls 3

_ParseAbstractIntegerFunction · 0.85
intClass · 0.85
CheckValueMethod · 0.45

Tested by 2

ParseIntegerMethod · 0.68
TEST_FFunction · 0.68