gui.model.RepoState(root, spec=None, error='', error_path=None, error_line=None)
A repository the interface has tried to open.
Attributes
| root |
Path |
The repository root that was asked for. |
| spec |
RegenSpec | None |
The loaded spec, or None if loading failed. |
| error |
str |
The message of the failure, or an empty string. |
| error_path |
Path | None |
The file the failure is about, or None. |
| error_line |
int | None |
The line of the failure, or None. |
Examples
from pathlib import Path
from tempfile import TemporaryDirectory
from spotregen import make_sample_repo
from spotregen.gui.model import load_repository
with TemporaryDirectory() as tmp:
state = load_repository(make_sample_repo(Path(tmp) / "demo"))
print(state.ok, len(state.spec.units))