Load definitions from a str object.
(cls, data: str)
| 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, |
nothing calls this directly
no test coverage detected