support py3.10

This commit is contained in:
ChuyueSun 2024-05-21 22:15:45 -07:00
parent b944ce6b36
commit d973c9e300
2 changed files with 12 additions and 16 deletions

View File

@ -2,7 +2,7 @@
Data structuers for expressions and goals
"""
from dataclasses import dataclass
from typing import Optional, Self, Union
from typing import Optional, Union
Expr = str
@ -16,7 +16,7 @@ class Variable:
name: Optional[str] = None
@staticmethod
def parse(payload: dict) -> Self:
def parse(payload: dict):
name = payload.get("userName")
t = parse_expr(payload["type"])
v = payload.get("value")
@ -39,11 +39,11 @@ class Goal:
is_conversion: bool = False
@staticmethod
def sentence(target: Expr) -> Self:
def sentence(target: Expr):
return Goal(variables=[], target=target)
@staticmethod
def parse(payload: dict) -> Self:
def parse(payload: dict):
name = payload.get("userName")
variables = [Variable.parse(v) for v in payload["vars"]]
target = parse_expr(payload["target"])
@ -73,7 +73,7 @@ class GoalState:
return not self.goals
@staticmethod
def parse(payload: dict, _sentinel: list[int]) -> Self:
def parse(payload: dict, _sentinel: list[int]):
state_id = payload["nextStateId"]
goals = [Goal.parse(g) for g in payload["goals"]]
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]]
name = "pexpect"
version = "4.9.0"
description = "Pexpect allows easy control of interactive console applications."
category = "main"
optional = false
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]
ptyprocess = ">=0.5"
@ -18,14 +13,15 @@ ptyprocess = ">=0.5"
name = "ptyprocess"
version = "0.7.0"
description = "Run a subprocess in a pseudo terminal"
category = "main"
optional = false
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]
lock-version = "2.0"
lock-version = "1.1"
python-versions = "^3.11"
content-hash = "aaae6d4832f97d9ad1b145776be94a2c44a7e77068bb1b3a05241a81dde23909"
[metadata.files]
pexpect = []
ptyprocess = []