Skip to content

Commit

Permalink
fix: some type lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
thep0y committed Sep 7, 2023
1 parent b8e8828 commit b432180
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
4 changes: 2 additions & 2 deletions up2b/up2b_lib/up2b_api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def _save_auth_info(self, auth_info: Dict[str, str]):
logger.fatal("save auth configure failed", error=e)

def _exceed_max_size(
self, images: Tuple[Union[ImageType, DownloadErrorResponse]]
self, images: Tuple[Union[ImageType, DownloadErrorResponse], ...]
) -> Tuple[bool, Optional[str]]:
for img in images:
if isinstance(img, DownloadErrorResponse):
Expand All @@ -173,7 +173,7 @@ def _exceed_max_size(
return False, None

def _check_images_valid(
self, images: Tuple[Union[ImageType, DownloadErrorResponse]]
self, images: Tuple[Union[ImageType, DownloadErrorResponse], ...]
):
"""
Check if all images exceed the max size or can be compressed
Expand Down
10 changes: 4 additions & 6 deletions up2b/up2b_lib/up2b_api/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ class ImageBedAbstract(ABC):
@abstractmethod
def description(self) -> str: ...

Images = Tuple[Union[ImageType, DownloadErrorResponse], ...]

class Base:
image_bed_code: ImageBedCode
max_size: int
Expand All @@ -89,12 +91,8 @@ class Base:
def check_login(self) -> None: ...
def _read_auth_info(self) -> Optional[AuthInfo]: ...
def _save_auth_info(self, auth_info: Dict[str, str]) -> None: ...
def _exceed_max_size(
self, images: Tuple[Union[ImageType, DownloadErrorResponse]]
) -> Tuple[bool, Optional[str]]: ...
def _check_images_valid(
self, images: Tuple[Union[ImageType, DownloadErrorResponse]]
): ...
def _exceed_max_size(self, images: Images) -> Tuple[bool, Optional[str]]: ...
def _check_images_valid(self, images: Images): ...
def _compress_image(self, image: ImageType) -> ImageType: ...
def _add_watermark(self, image_path: ImagePath) -> ImagePath: ...
def _clear_cache(self) -> None: ...
Expand Down
2 changes: 1 addition & 1 deletion up2b/up2b_lib/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def timeout() -> float:
return DEFAULT_TIMEOUT


def check_image_exists(images: Tuple[Union[ImageType, DownloadErrorResponse]]):
def check_image_exists(images: Tuple[Union[ImageType, DownloadErrorResponse], ...]):
for image in images:
if isinstance(image, Path) and not image.exists():
raise FileNotFoundError(image)
Expand Down

0 comments on commit b432180

Please sign in to comment.