Skip to content

Commit dfc8726

Browse files
committed
Added support for Python 3.9
1 parent 73be58b commit dfc8726

File tree

4 files changed

+24
-21
lines changed

4 files changed

+24
-21
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ With pip:
2525
pip install logicalpy
2626
```
2727

28-
Note than the library needs a Python version higher than 3.10.
28+
Note than the library needs a Python version higher than 3.9.
2929

3030
## Contributing
3131

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ With pip:
2323
pip install logicalpy
2424
```
2525

26-
Note than the library needs a Python version higher than 3.10.
26+
Note than the library needs a Python version higher than 3.9.
2727

2828
## Usage
2929

pyproject.toml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ authors = [
1010
{name = "Timothée Monin"}
1111
]
1212
dependencies = ["lark>=1.2.2"]
13-
requires-python = ">= 3.10"
13+
requires-python = ">= 3.9"
1414
readme = "README.md"
1515
license = "MIT"
1616
keywords = [
@@ -20,7 +20,11 @@ keywords = [
2020
]
2121
classifiers = [
2222
"License :: OSI Approved :: MIT License",
23-
"Programming Language :: Python :: 3",
23+
"Programming Language :: Python :: 3.9",
24+
"Programming Language :: Python :: 3.10",
25+
"Programming Language :: Python :: 3.11",
26+
"Programming Language :: Python :: 3.12",
27+
"Programming Language :: Python :: 3.13",
2428
]
2529

2630
[project.urls]

src/logicalpy/base.py

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -280,23 +280,22 @@ def _eliminate_conditionals(self):
280280

281281

282282
def _interpret_formula_tree(tree: lark.Tree):
283-
match tree.data:
284-
case "start":
285-
return _interpret_formula_tree(tree.children[0])
286-
case "proposition":
287-
return Proposition(str(tree.children[0]))
288-
case "negation":
289-
return Not(_interpret_formula_tree(tree.children[0]))
290-
case "disjunction":
291-
return Or(_interpret_formula_tree(tree.children[0]), _interpret_formula_tree(tree.children[1]))
292-
case "conjunction":
293-
return And(_interpret_formula_tree(tree.children[0]), _interpret_formula_tree(tree.children[1]))
294-
case "implication":
295-
return Implies(_interpret_formula_tree(tree.children[0]), _interpret_formula_tree(tree.children[1]))
296-
case "biconditional":
297-
return BiImplies(_interpret_formula_tree(tree.children[0]), _interpret_formula_tree(tree.children[1]))
298-
case "formula":
299-
return _interpret_formula_tree(tree.children[0])
283+
if tree.data == "start":
284+
return _interpret_formula_tree(tree.children[0])
285+
elif tree.data == "proposition":
286+
return Proposition(str(tree.children[0]))
287+
elif tree.data == "negation":
288+
return Not(_interpret_formula_tree(tree.children[0]))
289+
elif tree.data == "disjunction":
290+
return Or(_interpret_formula_tree(tree.children[0]), _interpret_formula_tree(tree.children[1]))
291+
elif tree.data == "conjunction":
292+
return And(_interpret_formula_tree(tree.children[0]), _interpret_formula_tree(tree.children[1]))
293+
elif tree.data == "implication":
294+
return Implies(_interpret_formula_tree(tree.children[0]), _interpret_formula_tree(tree.children[1]))
295+
elif tree.data == "biconditional":
296+
return BiImplies(_interpret_formula_tree(tree.children[0]), _interpret_formula_tree(tree.children[1]))
297+
elif tree.data == "formula":
298+
return _interpret_formula_tree(tree.children[0])
300299

301300

302301
class Formula:

0 commit comments

Comments
 (0)