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

Method make_log_stack

tools/meta_codegen/framework/scheme.py:494–524  ·  view source on GitHub ↗
(self, end_key: str = None)

Source from the content-addressed store, hash-verified

492 return result
493
494 def make_log_stack(self, end_key: str = None) -> t.List[log.LogStack]:
495 result = []
496
497 # make attr stack
498 attr_val = self.dump_json(with_key=False)
499 attr_stack = log.AttrStack(val=attr_val)
500 cur_object = self
501 while cur_object.parent:
502 # end key
503 if end_key and cur_object.key == end_key:
504 break
505
506 # append path
507 if cur_object.key:
508 attr_stack.path.append(cur_object.key)
509
510 # switch stack
511 if cur_object.source:
512 result.append(attr_stack)
513 source_kind = cur_object.source_kind
514 cur_object = cur_object.source
515 if source_kind == JsonSourceKind.PATH:
516 attr_stack = log.AttrPathStack(val=attr_val)
517 elif source_kind == JsonSourceKind.SHORTHAND:
518 attr_stack = log.AttrStack(val=cur_object.source.dump_json(with_key=False))
519 else:
520 cur_object = cur_object.parent
521 result.append(attr_stack)
522
523 result.reverse()
524 return result
525
526 def check_unrecognized_attrs(self, logger: log.Logger) -> None:
527 if not self.is_recognized and self.key != "attrs":

Callers 1

Calls 3

dump_jsonMethod · 0.95
appendMethod · 0.45
reverseMethod · 0.45

Tested by

no test coverage detected