MCPcopy Create free account
hub / github.com/google-deepmind/alphageometry / from_txt

Method from_txt

problem.py:319–345  ·  view source on GitHub ↗

Load definitions from a str object.

(cls, data: str)

Source from the content-addressed store, hash-verified

317
318 @classmethod
319 def from_txt(cls, data: str) -> Definition:
320 """Load definitions from a str object."""
321 construction, rely, deps, basics, numerics, _ = data.split('\n')
322 basics = [] if not basics else [b.strip() for b in basics.split(';')]
323
324 levels = []
325 for bs in basics:
326 if ':' in bs:
327 points, bs = bs.split(':')
328 points = points.strip().split()
329 else:
330 points = []
331 if bs.strip():
332 bs = [Construction.from_txt(b.strip()) for b in bs.strip().split(',')]
333 else:
334 bs = []
335 levels.append((points, bs))
336
337 numerics = [] if not numerics else numerics.split(', ')
338
339 return Definition(
340 construction=Construction.from_txt(construction),
341 rely=parse_rely(rely),
342 deps=Clause.from_txt(deps),
343 basics=levels,
344 numerics=[Construction.from_txt(c) for c in numerics],
345 )
346
347 def __init__(
348 self,

Callers

nothing calls this directly

Calls 3

DefinitionClass · 0.85
parse_relyFunction · 0.85
from_txtMethod · 0.45

Tested by

no test coverage detected