Merge pull request #3 from lenianiva/lower_py_support

support py3.10
This commit is contained in:
Leni Aniva 2024-05-28 20:25:25 -07:00 committed by GitHub
commit 05bbb5e538
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 17 additions and 17 deletions

View File

@ -7,6 +7,10 @@ Update submodule
``` bash ``` bash
git submodule update --init git submodule update --init
``` ```
Install dependencies
```bash
poetry install
```
Execute Execute
```bash ```bash

View File

@ -2,7 +2,7 @@
Data structuers for expressions and goals Data structuers for expressions and goals
""" """
from dataclasses import dataclass from dataclasses import dataclass
from typing import Optional, Self, Union from typing import Optional, Union
Expr = str Expr = str
@ -16,7 +16,7 @@ class Variable:
name: Optional[str] = None name: Optional[str] = None
@staticmethod @staticmethod
def parse(payload: dict) -> Self: def parse(payload: dict):
name = payload.get("userName") name = payload.get("userName")
t = parse_expr(payload["type"]) t = parse_expr(payload["type"])
v = payload.get("value") v = payload.get("value")
@ -39,11 +39,11 @@ class Goal:
is_conversion: bool = False is_conversion: bool = False
@staticmethod @staticmethod
def sentence(target: Expr) -> Self: def sentence(target: Expr):
return Goal(variables=[], target=target) return Goal(variables=[], target=target)
@staticmethod @staticmethod
def parse(payload: dict) -> Self: def parse(payload: dict):
name = payload.get("userName") name = payload.get("userName")
variables = [Variable.parse(v) for v in payload["vars"]] variables = [Variable.parse(v) for v in payload["vars"]]
target = parse_expr(payload["target"]) target = parse_expr(payload["target"])
@ -73,7 +73,7 @@ class GoalState:
return not self.goals return not self.goals
@staticmethod @staticmethod
def parse(payload: dict, _sentinel: list[int]) -> Self: def parse(payload: dict, _sentinel: list[int]):
state_id = payload["nextStateId"] state_id = payload["nextStateId"]
goals = [Goal.parse(g) for g in payload["goals"]] goals = [Goal.parse(g) for g in payload["goals"]]
return GoalState(state_id, goals, _sentinel) return GoalState(state_id, goals, _sentinel)

18
poetry.lock generated
View File

@ -1,15 +1,10 @@
# This file is automatically @generated by Poetry 1.8.2 and should not be changed by hand.
[[package]] [[package]]
name = "pexpect" name = "pexpect"
version = "4.9.0" version = "4.9.0"
description = "Pexpect allows easy control of interactive console applications." description = "Pexpect allows easy control of interactive console applications."
category = "main"
optional = false optional = false
python-versions = "*" python-versions = "*"
files = [
{file = "pexpect-4.9.0-py2.py3-none-any.whl", hash = "sha256:7236d1e080e4936be2dc3e326cec0af72acf9212a7e1d060210e70a47e253523"},
{file = "pexpect-4.9.0.tar.gz", hash = "sha256:ee7d41123f3c9911050ea2c2dac107568dc43b2d3b0c7557a33212c398ead30f"},
]
[package.dependencies] [package.dependencies]
ptyprocess = ">=0.5" ptyprocess = ">=0.5"
@ -18,14 +13,15 @@ ptyprocess = ">=0.5"
name = "ptyprocess" name = "ptyprocess"
version = "0.7.0" version = "0.7.0"
description = "Run a subprocess in a pseudo terminal" description = "Run a subprocess in a pseudo terminal"
category = "main"
optional = false optional = false
python-versions = "*" python-versions = "*"
files = [
{file = "ptyprocess-0.7.0-py2.py3-none-any.whl", hash = "sha256:4b41f3967fce3af57cc7e94b888626c18bf37a083e3651ca8feeb66d492fef35"},
{file = "ptyprocess-0.7.0.tar.gz", hash = "sha256:5c5d0a3b48ceee0b48485e0c26037c0acd7d29765ca3fbb5cb3831d347423220"},
]
[metadata] [metadata]
lock-version = "2.0" lock-version = "1.1"
python-versions = "^3.11" python-versions = "^3.11"
content-hash = "aaae6d4832f97d9ad1b145776be94a2c44a7e77068bb1b3a05241a81dde23909" content-hash = "aaae6d4832f97d9ad1b145776be94a2c44a7e77068bb1b3a05241a81dde23909"
[metadata.files]
pexpect = []
ptyprocess = []

View File

@ -7,7 +7,7 @@ license = "GPL-3"
readme = "README.md" readme = "README.md"
[tool.poetry.dependencies] [tool.poetry.dependencies]
python = "^3.11" python = "^3.10"
pexpect = "^4.9.0" pexpect = "^4.9.0"
[tool.poetry.build] [tool.poetry.build]