Unverified Commit 6f68be40 authored by Tzu-Ling Kan's avatar Tzu-Ling Kan Committed by GitHub
Browse files

fix: mypy error (#5426)


Signed-off-by: default avatartzulingk@nvidia.com <tzulingk@nvidia.com>
parent 4816d639
...@@ -16,13 +16,16 @@ import tempfile ...@@ -16,13 +16,16 @@ import tempfile
import time import time
from dataclasses import dataclass from dataclasses import dataclass
from pathlib import Path from pathlib import Path
from typing import Optional from typing import TYPE_CHECKING, Optional
import boto3 import boto3
import requests import requests
from botocore.client import Config from botocore.client import Config
from botocore.exceptions import ClientError from botocore.exceptions import ClientError
if TYPE_CHECKING:
from mypy_boto3_s3.client import S3Client
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
# LoRA testing constants # LoRA testing constants
...@@ -79,7 +82,7 @@ class MinioService: ...@@ -79,7 +82,7 @@ class MinioService:
self.config = config self.config = config
self._logger = logging.getLogger(self.__class__.__name__) self._logger = logging.getLogger(self.__class__.__name__)
self._temp_download_dir: Optional[str] = None self._temp_download_dir: Optional[str] = None
self._s3_client = None self._s3_client: Optional["S3Client"] = None
self._owns_container: bool = False self._owns_container: bool = False
def _get_s3_client(self): def _get_s3_client(self):
...@@ -265,15 +268,15 @@ class MinioService: ...@@ -265,15 +268,15 @@ class MinioService:
) )
s3_client = self._get_s3_client() s3_client = self._get_s3_client()
local_path = Path(local_path) local_path_obj = Path(local_path)
for file_path in local_path.rglob("*"): for file_path in local_path_obj.rglob("*"):
if not file_path.is_file(): if not file_path.is_file():
continue continue
if ".git" in file_path.parts: if ".git" in file_path.parts:
continue continue
relative_path = file_path.relative_to(local_path).as_posix() relative_path = file_path.relative_to(local_path_obj).as_posix()
s3_key = f"{self.config.lora_name}/{relative_path}" s3_key = f"{self.config.lora_name}/{relative_path}"
try: try:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment