Skip to content

Commit 18f3615

Browse files
authored
Merge pull request #50 from whitemech/develop
Release 0.1.0
2 parents d6c51db + 28236d2 commit 18f3615

File tree

10 files changed

+401
-406
lines changed

10 files changed

+401
-406
lines changed

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Contributions are welcome, and greatly appreciated! Every little bit helps, and credit will always be given.
44

55
If you need support, want to report/fix a bug, ask for/implement features, you can check the
6-
[Issues page](https://github.com/marcofavorito/logaut/issues)
7-
or [submit a Pull request](https://github.com/marcofavorito/logaut/pulls).
6+
[Issues page](https://github.com/whitemech/logaut/issues)
7+
or [submit a Pull request](https://github.com/whitemech/logaut/pulls).
88

99
For other kinds of feedback, you can contact one of the [authors](./authors.md) by email.

HISTORY.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# History
22

3+
# 0.1.0
4+
5+
First release.
6+
7+
- Synchronize with [`pylogics==0.1.0`](https://github.com/whitemech/pylogics)
8+
and [Lydia](https://github.com/whitemech/lydia) backend at version `0.1.1`.
9+
310
# 0.1.0a0
411

512
First alpha release.

README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,19 @@
1818
<a href="">
1919
<img alt="PyPI - Wheel" src="https://img.shields.io/pypi/wheel/logaut">
2020
</a>
21-
<a href="https://github.com/marcofavorito/logaut/blob/master/LICENSE">
21+
<a href="https://github.com/whitemech/logaut/blob/master/LICENSE">
2222
<img alt="GitHub" src="https://img.shields.io/github/license/marcofavorito/logaut">
2323
</a>
2424
</p>
2525
<p align="center">
2626
<a href="">
27-
<img alt="test" src="https://github.com/marcofavorito/logaut/workflows/test/badge.svg">
27+
<img alt="test" src="https://github.com/whitemech/logaut/workflows/test/badge.svg">
2828
</a>
2929
<a href="">
30-
<img alt="lint" src="https://github.com/marcofavorito/logaut/workflows/lint/badge.svg">
30+
<img alt="lint" src="https://github.com/whitemech/logaut/workflows/lint/badge.svg">
3131
</a>
3232
<a href="">
33-
<img alt="docs" src="https://github.com/marcofavorito/logaut/workflows/docs/badge.svg">
33+
<img alt="docs" src="https://github.com/whitemech/logaut/workflows/docs/badge.svg">
3434
</a>
3535
<a href="https://codecov.io/gh/marcofavorito/logaut">
3636
<img alt="codecov" src="https://codecov.io/gh/marcofavorito/logaut/branch/master/graph/badge.svg?token=FG3ATGP5P5">
@@ -65,7 +65,7 @@ but with human-friendly APIs.
6565

6666
To install the package from PyPI:
6767
```
68-
pip install logaut==0.1.0a0
68+
pip install logaut==0.1.0
6969
```
7070

7171
Make sure to have [Lydia](https://github.com/whitemech/lydia)
@@ -77,9 +77,11 @@ We suggest the following setup:
7777
```
7878
docker pull whitemech/lydia:latest
7979
```
80-
- Run the following commands:
80+
- Make the Docker image executable under the name `lydia`.
81+
On Linux and MacOS machines, the following commands should work:
8182
```
82-
echo 'docker run -v$(pwd):/home/default -it whitemech/lydia lydia $@' > lydia
83+
echo '#!/usr/bin/env sh' > lydia
84+
echo 'docker run -v$(pwd):/home/default whitemech/lydia lydia $@' >> lydia
8385
sudo chmod u+x lydia
8486
sudo mv lydia /usr/local/bin/
8587
```

logaut/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@
2222

2323
"""From LOGics to AUTomata"""
2424

25-
__version__ = "0.1.0a0"
25+
__version__ = "0.1.0"
2626

2727
from .core import fol2dfa, ldl2dfa, ltl2dfa, mso2dfa, pldl2dfa, pltl2dfa

logaut/backends/lydia/_lydia_utils.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,24 @@
2525
import subprocess
2626
from typing import Match, cast
2727

28+
from pylogics.helpers.misc import enforce
29+
30+
from logaut.exceptions import LogautException
31+
2832

2933
def call_lydia(*args) -> str:
3034
"""Call the Lydia CLI tool with the arguments provided."""
35+
command = ["lydia", *args]
3136
try:
32-
result = subprocess.run(["lydia", *args], stdout=subprocess.PIPE, check=True)
37+
result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
3338
output = result.stdout.decode()
39+
stderr = result.stderr.decode()
40+
enforce(result.returncode == 0, exception_cls=LogautException)
3441
return output
42+
except LogautException:
43+
raise Exception( # type: ignore
44+
f"the Lydia command {' '.join(command)} failed.\nstdout={output}\nstderr={stderr}" # type: ignore
45+
)
3546
except Exception as e:
3647
raise Exception(f"an error occurred while running lydia: {str(e)}") from e
3748

logaut/backends/lydia/to_lydia_grammar.py

Lines changed: 12 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -32,21 +32,12 @@
3232
FalseFormula,
3333
Formula,
3434
Implies,
35+
Logic,
3536
Not,
3637
Or,
3738
TrueFormula,
3839
)
39-
from pylogics.syntax.ldl import (
40-
Box,
41-
Diamond,
42-
LDLFalse,
43-
LDLTrue,
44-
Prop,
45-
Seq,
46-
Star,
47-
Test,
48-
Union,
49-
)
40+
from pylogics.syntax.ldl import Box, Diamond, Prop, Seq, Star, Test, Union
5041
from pylogics.syntax.ltl import (
5142
Always,
5243
Eventually,
@@ -111,28 +102,16 @@ def to_string_atomic(formula: AbstractAtomic) -> str:
111102
return formula.name
112103

113104

114-
@to_string.register(TrueFormula)
115-
def to_string_true(_formula: TrueFormula) -> str:
116-
"""Transform the "true" formula into string."""
117-
return "true"
118-
119-
120-
@to_string.register(FalseFormula)
121-
def to_string_false(_formula: FalseFormula) -> str:
122-
"""Transform the "false" formula into string."""
123-
return "false"
124-
125-
126105
@to_string.register(Next)
127106
def to_string_next(formula: Next) -> str:
128107
"""Transform a next formula into string."""
129-
return f"X({to_string(formula.argument)})"
108+
return f"X[!]({to_string(formula.argument)})"
130109

131110

132111
@to_string.register(WeakNext)
133112
def to_string_weak_next(formula: WeakNext):
134113
"""Transform the weak next formula."""
135-
return f"W({to_string(formula.argument)})"
114+
return f"X({to_string(formula.argument)})"
136115

137116

138117
@to_string.register(Until)
@@ -208,16 +187,16 @@ def to_string_pltl_historically(formula: Historically) -> str:
208187
return f"H({to_string(formula.argument)})"
209188

210189

211-
@to_string.register(LDLTrue)
212-
def to_string_ldl_true(_formula: LDLTrue) -> str:
213-
"""Transform an LDL true into string."""
214-
return "tt"
190+
@to_string.register(TrueFormula)
191+
def to_string_ldl_true(formula: TrueFormula) -> str:
192+
"""Transform a true into string."""
193+
return "tt" if formula.logic != Logic.PL else "true"
215194

216195

217-
@to_string.register(LDLFalse)
218-
def to_string_ldl_false(_formula: LDLFalse) -> str:
219-
"""Transform an LDL false into string."""
220-
return "ff"
196+
@to_string.register(FalseFormula)
197+
def to_string_ldl_false(formula: FalseFormula) -> str:
198+
"""Transform a false into string."""
199+
return "ff" if formula.logic != Logic.PL else "false"
221200

222201

223202
@to_string.register(Diamond)

mkdocs.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
site_name: My Docs
2-
repo_name: 'marcofavorito/logaut'
3-
repo_url: https://github.com/marcofavorito/logaut
1+
site_name: Logaut Docs
2+
site_url: "https://whitemech.github.io/logaut/"
3+
repo_name: 'whitemech/logaut'
4+
repo_url: "https://github.com/whitemech/logaut"
45

56
nav:
67
- Home: index.md
@@ -14,6 +15,11 @@ theme:
1415
markdown_extensions:
1516
- codehilite
1617
- pymdownx.arithmatex
18+
- pymdownx.highlight
19+
- pymdownx.superfences
20+
- pymdownx.emoji:
21+
emoji_index: !!python/name:materialx.emoji.twemoji
22+
emoji_generator: !!python/name:materialx.emoji.to_svg
1723
- markdown_include.include:
1824
base_path: docs
1925

0 commit comments

Comments
 (0)