fix(images): card facts read the inspector's projected graphs
The inspector hands its browser parser only graphs the inspection projection parsed (strict JSON, depth 64, node ceiling); a deeper record is "limited" there, so the legacy fill never runs and no seed shows. The card parsed the raw records instead and showed a seed the inspector did not, e.g. for a 900-deep class_type beside a normal sampler. project_graph() is now the one projection step, used by the inspection response and by the card. The card runs the shared parser on the projected graphs, the same values the browser receives: big integers arrive as their exact digits, so the separate exact-integer re-parse and the parse_js_json flag it needed are gone.
This commit is contained in:
@@ -27,7 +27,6 @@ __all__ = [
|
||||
"GenerationParamsError",
|
||||
"extract_generation_params",
|
||||
"extract_from_records",
|
||||
"number_string",
|
||||
"parse_js_json",
|
||||
]
|
||||
|
||||
@@ -203,9 +202,6 @@ def _number_string(value):
|
||||
return sign + body
|
||||
|
||||
|
||||
number_string = _number_string
|
||||
|
||||
|
||||
def _js_string(value):
|
||||
"""``String(value)`` for any JSON-derived value."""
|
||||
if value is UNDEFINED:
|
||||
@@ -945,17 +941,14 @@ def _double_integer(text):
|
||||
return value if -_MAX_SAFE_INTEGER <= value <= _MAX_SAFE_INTEGER else float(text)
|
||||
|
||||
|
||||
def parse_js_json(text, *, exact_integers=False):
|
||||
"""``JSON.parse(text)``, or None where it throws (or the text is ``null``).
|
||||
|
||||
``exact_integers`` keeps integers beyond 2**53 exact instead of rounding
|
||||
them as JavaScript does; every other rule is unchanged.
|
||||
"""
|
||||
def parse_js_json(text):
|
||||
"""``JSON.parse(text)``, or None where it throws (or the text is ``null``)."""
|
||||
if not isinstance(text, str):
|
||||
return None
|
||||
integers = int if exact_integers else _double_integer
|
||||
try:
|
||||
return json.loads(text, parse_constant=_reject_constant, parse_int=integers)
|
||||
return json.loads(
|
||||
text, parse_constant=_reject_constant, parse_int=_double_integer
|
||||
)
|
||||
except (ValueError, RecursionError):
|
||||
return None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user