MCPcopy Create free account
hub / github.com/ScrapeGraphAI/toonify / parse_literal

Function parse_literal

toon/utils.py:240–258  ·  view source on GitHub ↗

Parse a string as a boolean, null, or number literal. Args: value: String to parse Returns: Parsed value or original string if not a literal

(value: str)

Source from the content-addressed store, hash-verified

238
239
240def parse_literal(value: str) -> Any:
241 """
242 Parse a string as a boolean, null, or number literal.
243
244 Args:
245 value: String to parse
246
247 Returns:
248 Parsed value or original string if not a literal
249 """
250 lower_value = value.lower()
251 if lower_value == TRUE_LITERAL:
252 return True
253 elif lower_value == FALSE_LITERAL:
254 return False
255 elif lower_value == NULL_LITERAL:
256 return None
257 else:
258 return parse_number(value)
259
260
261def format_float(value: float) -> str:

Callers 1

_parse_valueFunction · 0.85

Calls 1

parse_numberFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…