Skip to content

Commit d0a9984

Browse files
committed
Solve some backward compatible issue with python 3.9
1 parent c41ee0d commit d0a9984

4 files changed

Lines changed: 33 additions & 13 deletions

File tree

poetry.lock

Lines changed: 24 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ tenacity = "^8.2.3"
1919
pyarrow = "^15.0.2"
2020
cbor2 = "^5.6.3"
2121
pandas = "^2.2.2"
22+
StrEnum = "^0.4.15"
2223

2324
[tool.poetry.group.dev.dependencies]
2425
mypy = "^1.8.0"

wherobots/db/constants.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
from enum import StrEnum, auto
1+
from enum import auto
2+
from strenum import StrEnum
23

34
from .region import Region
45
from .runtime import Runtime

wherobots/db/cursor.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import queue
2-
from typing import Any
2+
from typing import Any, Optional
33

44
from .errors import ProgrammingError, DatabaseError
55

@@ -11,20 +11,20 @@ def __init__(self, exec_fn, cancel_fn):
1111
self.__cancel_fn = cancel_fn
1212

1313
self.__queue: queue.Queue = queue.Queue()
14-
self.__results: list[Any] | None = None
15-
self.__current_execution_id: str | None = None
14+
self.__results: Optional[list[Any]] = None
15+
self.__current_execution_id: Optional[str] = None
1616
self.__current_row: int = 0
1717

1818
# Description and row count are set by the last executed operation.
1919
# Their default values are defined by PEP-0249.
20-
self.__description: str | None = None
20+
self.__description: Optional[str] = None
2121
self.__rowcount: int = -1
2222

2323
# Array-size is also defined by PEP-0249 and is expected to be read/writable.
2424
self.arraysize: int = 1
2525

2626
@property
27-
def description(self) -> str | None:
27+
def description(self) -> Optional[str]:
2828
return self.__description
2929

3030
@property
@@ -34,7 +34,7 @@ def rowcount(self) -> int:
3434
def __on_execution_result(self, result) -> None:
3535
self.__queue.put(result)
3636

37-
def __get_results(self) -> list[Any] | None:
37+
def __get_results(self) -> Optional[list[Any]]:
3838
if not self.__current_execution_id:
3939
raise ProgrammingError("No query has been executed yet")
4040
if self.__results is not None:

0 commit comments

Comments
 (0)