MCPcopy Create free account
hub / github.com/SakuraEngine/SakuraEngine / dump_json

Method dump_json

tools/meta_codegen/framework/scheme.py:480–492  ·  view source on GitHub ↗
(self, with_key=True)

Source from the content-addressed store, hash-verified

478 rewrite_by: 'JsonObject' = None # 在 solve override 时最近的 rewrite 来源('!!' 标记)同时也会从父节点向子节点传播
479
480 def dump_json(self, with_key=True) -> str:
481 result = f'"{self.key}": ' if self.key and with_key else ""
482
483 if self.is_dict and type(self.val) is list:
484 result += f"{{{', '.join([child.dump_json() for child in self.val])}}}"
485 elif type(self.val) is list:
486 result += f"[{', '.join([child.dump_json() for child in self.val])}]"
487 elif type(self.val) is str:
488 result += f'"{self.val}"'
489 else:
490 result += f"{self.val}"
491
492 return result
493
494 def make_log_stack(self, end_key: str = None) -> t.List[log.LogStack]:
495 result = []

Callers 1

make_log_stackMethod · 0.95

Calls 2

typeFunction · 0.50
joinMethod · 0.45

Tested by

no test coverage detected