MCPcopy Create free account
hub / github.com/apache/thrift / readJSONDouble

Method readJSONDouble

lib/py/src/protocol/TJSONProtocol.py:351–374  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

349 "Bad data encounted in numeric data")
350
351 def readJSONDouble(self):
352 self.context.read()
353 if self.reader.peek() == QUOTE:
354 string = self.readJSONString(True)
355 try:
356 double = float(string)
357 if (self.context.escapeNum is False and
358 not math.isinf(double) and
359 not math.isnan(double)):
360 raise TProtocolException(
361 TProtocolException.INVALID_DATA,
362 "Numeric data unexpectedly quoted")
363 return double
364 except ValueError:
365 raise TProtocolException(TProtocolException.INVALID_DATA,
366 "Bad data encounted in numeric data")
367 else:
368 if self.context.escapeNum() is True:
369 self.readJSONSyntaxChar(QUOTE)
370 try:
371 return float(self.readJSONNumericChars())
372 except ValueError:
373 raise TProtocolException(TProtocolException.INVALID_DATA,
374 "Bad data encounted in numeric data")
375
376 def readJSONBase64(self):
377 string = self.readJSONString(False)

Callers

nothing calls this directly

Calls 7

readJSONStringMethod · 0.95
readJSONSyntaxCharMethod · 0.95
readJSONNumericCharsMethod · 0.95
TProtocolExceptionClass · 0.70
readMethod · 0.65
peekMethod · 0.45
escapeNumMethod · 0.45

Tested by

no test coverage detected