Skip to content

Commit 78f6dc3

Browse files
committed
Use Union instead of | for typing
due to python 3.9
1 parent 7a1ac00 commit 78f6dc3

File tree

5 files changed

+9
-8
lines changed

5 files changed

+9
-8
lines changed

graphdatascience/arrow_client/v2/api_types.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from typing import Optional
12
from graphdatascience.arrow_client.arrow_base_model import ArrowBaseModel
23

34

@@ -19,15 +20,15 @@ def progress_known(self) -> bool:
1920
return False
2021
return True
2122

22-
def progress_percent(self) -> float | None:
23+
def progress_percent(self) -> Optional[float]:
2324
if self.progress_known():
2425
return self.progress * 100
2526
return None
2627

2728
def base_task(self) -> str:
2829
return self.description.split("::")[0].strip()
2930

30-
def sub_tasks(self) -> str | None:
31+
def sub_tasks(self) -> Optional[str]:
3132
task_split = self.description.split("::", maxsplit=1)
3233
if len(task_split) > 1:
3334
return task_split[1].strip()

graphdatascience/arrow_client/v2/job_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515

1616
class JobClient:
17-
def __init__(self, progress_bar_options: dict[str, Any] | None = None):
17+
def __init__(self, progress_bar_options: Optional[dict[str, Any]] = None):
1818
self._progress_bar_options = progress_bar_options or {}
1919

2020
@staticmethod

graphdatascience/query_runner/protocol/write_protocols.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def run_write_back(
127127

128128

129129
class RemoteWriteBackV3(WriteProtocol):
130-
def __init__(self, progress_bar_options: dict[str, Any] | None = None):
130+
def __init__(self, progress_bar_options: Optional[dict[str, Any]] = None):
131131
self._progress_bar_options = progress_bar_options or {}
132132

133133
def write_back_params(

graphdatascience/session/aura_api_responses.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class SessionDetails:
3232
def from_json(cls, data: dict[str, Any]) -> SessionDetails:
3333
id = data["id"]
3434
expiry_date = data.get("expiry_date")
35-
ttl: Any | None = data.get("ttl")
35+
ttl: Optional[Any] = data.get("ttl")
3636
instance_id = data.get("instance_id")
3737
cloud_location = CloudLocation(data["cloud_provider"], data["region"]) if data.get("cloud_provider") else None
3838

@@ -65,7 +65,7 @@ def from_json_with_error(cls, data: dict[str, Any], errors: list[dict[str, Any]]
6565

6666
id = data["id"]
6767
expiry_date = data.get("expiry_date")
68-
ttl: Any | None = data.get("ttl")
68+
ttl: Optional[Any] = data.get("ttl")
6969
instance_id = data.get("instance_id")
7070
cloud_location = CloudLocation(data["cloud_provider"], data["region"]) if data.get("cloud_provider") else None
7171

graphdatascience/session/session_info.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from dataclasses import dataclass
44
from datetime import datetime, timedelta
5-
from typing import Optional
5+
from typing import Optional, Union
66

77
from graphdatascience.session.aura_api_responses import SessionDetails, SessionDetailsWithErrors, SessionErrorData
88
from graphdatascience.session.cloud_location import CloudLocation
@@ -41,7 +41,7 @@ class SessionInfo:
4141
errors: Optional[list[SessionErrorData]] = None
4242

4343
@classmethod
44-
def from_session_details(cls, details: SessionDetailsWithErrors | SessionDetails) -> SessionInfo:
44+
def from_session_details(cls, details: Union[SessionDetailsWithErrors, SessionDetails]) -> SessionInfo:
4545
errors: Optional[list[SessionErrorData]] = None
4646
if isinstance(details, SessionDetailsWithErrors):
4747
errors = details.errors

0 commit comments

Comments
 (0)