Skip to content

Commit

Permalink
[python] Fixes typing issue with py3.8 (#2035)
Browse files Browse the repository at this point in the history
  • Loading branch information
frankfliu authored Jun 7, 2024
1 parent 8ad2395 commit add924e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions engines/python/setup/djl_python/session_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import time
import uuid
import subprocess as sp
from typing import Optional

import numpy as np

Expand Down Expand Up @@ -96,7 +97,7 @@ def create_session(self) -> Session:
self.cloud_watch.post("create_session")
return session

def get_session(self, session_id: str) -> (Session | None):
def get_session(self, session_id: str) -> Optional[Session]:
if not session_id or not UUID_PATTERN.match(session_id):
raise ValueError(f"invalid session_id: {session_id}")

Expand All @@ -121,7 +122,7 @@ def _clean_expired_session(self):
if time.time() - session.get(".creation_time") > self.expiration:
self.close_session(session_id)

def _recover_from_s3(self, session: Session) -> (Session | None):
def _recover_from_s3(self, session: Session) -> Optional[Session]:
if not self.sessions_s3url:
return None

Expand Down

0 comments on commit add924e

Please sign in to comment.