MCPcopy Create free account
hub / github.com/BasisResearch/lean.py / parse

Method parse

lean_py/kernel.py:56–67  ·  view source on GitHub ↗

Parse the multi-line encoding produced by Lean's ``encodeTacticResult``.

(cls, encoded: str, kernel: Kernel, raw_state: Any)

Source from the content-addressed store, hash-verified

54
55 @classmethod
56 def parse(cls, encoded: str, kernel: Kernel, raw_state: Any) -> TacticResult:
57 """Parse the multi-line encoding produced by Lean's
58 ``encodeTacticResult``."""
59 if not encoded:
60 return cls("failure", [], None)
61 lines = encoded.split("\n")
62 status = lines[0]
63 messages = lines[1:] if len(lines) > 1 else []
64 state = None
65 if status == "success" and raw_state is not None:
66 state = GoalState(kernel, raw_state)
67 return cls(status, messages, state)
68
69
70class GoalState:

Callers 10

get_header_modelFunction · 0.80
try_tacticMethod · 0.80
try_assignMethod · 0.80
conv_enterMethod · 0.80
calc_enterMethod · 0.80
fragment_exitMethod · 0.80
try_haveMethod · 0.80
try_letMethod · 0.80
try_defineMethod · 0.80
try_draftMethod · 0.80

Calls 1

GoalStateClass · 0.85

Tested by

no test coverage detected