From aba9a0e2a429aa8c3866e68ab22f0041eda3512c Mon Sep 17 00:00:00 2001 From: "Davide Gessa (dakk)" Date: Mon, 30 Oct 2023 10:27:13 +0100 Subject: [PATCH] fix 3.11 typing --- .github/workflows/ci.yaml | 2 +- TODO.md | 4 ++-- qlasskit/ast2logic/env.py | 7 ++++++- qlasskit/types/qtype.py | 7 ++++++- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index ee103cb6..2a4b0e0f 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -30,7 +30,7 @@ jobs: strategy: matrix: - python-version: ["3.11", "3.12"] + python-version: ["3.11"] #, "3.12"] steps: - name: Checkout diff --git a/TODO.md b/TODO.md index 4220d20b..21dddd1f 100644 --- a/TODO.md +++ b/TODO.md @@ -74,8 +74,8 @@ ### Week 2: (30 Oct 23) - [x] Integrate qrack on test suite -- [ ] Test on multiple py version -- [ ] Fixed size list support +- [x] Test / support on multiple py version >= 3.8 +- [ ] Fixed size list sugar - [ ] Groover algorithm tests - [ ] Slideshow for UF midterm diff --git a/qlasskit/ast2logic/env.py b/qlasskit/ast2logic/env.py index 456ca3cc..3b07ccec 100644 --- a/qlasskit/ast2logic/env.py +++ b/qlasskit/ast2logic/env.py @@ -12,11 +12,16 @@ # See the License for the specific language governing permissions and # limitations under the License. +import sys from typing import Dict, List, Tuple from sympy import Symbol from sympy.logic.boolalg import Boolean -from typing_extensions import TypeAlias + +if sys.version_info < (3, 11): + from typing_extensions import TypeAlias +else: + from typing import TypeAlias from ..types import BUILTIN_TYPES, Qint, Qtype # noqa: F401, E402 from . import exceptions diff --git a/qlasskit/types/qtype.py b/qlasskit/types/qtype.py index c70351ca..33240900 100644 --- a/qlasskit/types/qtype.py +++ b/qlasskit/types/qtype.py @@ -12,10 +12,15 @@ # See the License for the specific language governing permissions and # limitations under the License. +import sys from typing import Any, List, Literal, Tuple from sympy.logic.boolalg import Boolean, Not -from typing_extensions import TypeAlias + +if sys.version_info < (3, 11): + from typing_extensions import TypeAlias +else: + from typing import TypeAlias TType: TypeAlias = object TExp: TypeAlias = Tuple[TType, Boolean]