Core
Provide the shared leaves of veriphy: its named exceptions, the protocol's type vocabulary, the project layout.
CertificateError
Bases: VeriphyError
Signal that no certificate exists or that a supplied certificate is malformed.
EncodingError
Bases: VeriphyError
Signal a method result that has no exact JSON encoding.
MethodError
Bases: VeriphyError
Signal a failed daemon method, with a message of the form <method>: <reason>.
ParamError(param, reason)
Bases: VeriphyError
Signal a request parameter that failed validation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
param
|
str
|
The name of the parameter. |
required |
reason
|
str
|
What is wrong with the parameter. |
required |
Source code in src/veriphy/core/_errors.py
16 17 18 19 20 | |
ScriptError(reason, stdout)
Bases: VeriphyError
Signal a Sage script that failed, carrying the output it printed before failing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
reason
|
str
|
Why the script failed. |
required |
stdout
|
str
|
The output the script printed, possibly empty. |
required |
Source code in src/veriphy/core/_errors.py
43 44 45 46 47 | |
TableError(source, field, reason)
Bases: VeriphyError
Signal a translation-table file that does not follow the schema.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
str
|
The file the table came from. |
required |
field
|
str
|
The field at fault. |
required |
reason
|
str
|
What is wrong with it. |
required |
Source code in src/veriphy/core/_errors.py
59 60 61 62 63 64 65 66 | |
VeriphyError
Bases: Exception
Signal a failure inside veriphy.
find_workspace_root(start=None)
Return the Lean workspace root: the nearest directory, from start upwards, that holds a lakefile.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
start
|
Path | None
|
The directory to search from, the working directory when |
None
|
Returns:
| Type | Description |
|---|---|
Path
|
The workspace root, or |
Examples:
>>> import tempfile
>>> with tempfile.TemporaryDirectory() as tmp:
... root = Path(tmp).resolve()
... _ = (root / 'lakefile.toml').write_text('')
... (root / 'Sub' / 'Dir').mkdir(parents=True)
... find_workspace_root(root / 'Sub' / 'Dir') == root
True
Source code in src/veriphy/core/_project.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | |
project_dir(root=None)
Return the project's .veriphy/ directory, without creating it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root
|
Path | None
|
The workspace root, found from the working directory when |
None
|
Returns:
| Type | Description |
|---|---|
Path
|
The path of |
Examples:
>>> project_dir(Path('/work/project')).as_posix()
'/work/project/.veriphy'
Source code in src/veriphy/core/_project.py
34 35 36 37 38 39 40 41 42 43 44 45 46 47 | |