Skip to content

Commit

Permalink
chore: fix type check issues
Browse files Browse the repository at this point in the history
  • Loading branch information
noaione committed Dec 20, 2023
1 parent 3e1c7d6 commit c420dac
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 26 deletions.
44 changes: 22 additions & 22 deletions tests/sources/musq/test_proto.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,23 +54,23 @@ class TestChapterView(Fixtureable[ChapterViewer]):
def process(self, source: Path):
return _proto_read(source, ChapterViewer)

def assertion_test(self, chapter_view: ChapterViewer):
assert chapter_view.status == 0

assert chapter_view.user_point.free == 0
assert chapter_view.user_point.event == 0
assert chapter_view.user_point.paid == 480
assert chapter_view.user_point.total_point == 480
assert len(chapter_view.images) == 11
assert chapter_view.previous_chapter is None
assert chapter_view.next_chapter is not None

image = chapter_view.images[0]
def assertion_test(self, result: ChapterViewer):
assert result.status == 0

assert result.user_point.free == 0
assert result.user_point.event == 0
assert result.user_point.paid == 480
assert result.user_point.total_point == 480
assert len(result.images) == 11
assert result.previous_chapter is None
assert result.next_chapter is not None

image = result.images[0]
assert image.filename == "1.avif"
assert image.stem == "1"
assert image.extension == "avif"

image2 = chapter_view.images[1]
image2 = result.images[1]
image2.url = "/data/1/noextension"
assert image2.extension == ""

Expand All @@ -81,18 +81,18 @@ class TestChapterViewV2(Fixtureable[ChapterViewerV2]):
def process(self, source: Path):
return _proto_read(source, ChapterViewerV2)

def assertion_test(self, chapter_view: ChapterViewerV2):
assert chapter_view.status == 0
def assertion_test(self, result: ChapterViewerV2):
assert result.status == 0

assert chapter_view.user_point.free == 40
assert chapter_view.user_point.event == 0
assert chapter_view.user_point.paid == 370
assert chapter_view.user_point.total_point == 410
assert len(chapter_view.blocks) == 1
assert result.user_point.free == 40
assert result.user_point.event == 0
assert result.user_point.paid == 370
assert result.user_point.total_point == 410
assert len(result.blocks) == 1

assert chapter_view.next_chapter is not None
assert result.next_chapter is not None

block = chapter_view.blocks[0]
block = result.blocks[0]
assert block.title == "Chapter 10.1"
image = block.images[0]
assert image.filename == "1.avif"
Expand Down
4 changes: 2 additions & 2 deletions tosho_mango/cli/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import sys
import traceback
from functools import partial
from typing import TYPE_CHECKING, Callable, List, Optional, Tuple, Union, cast
from typing import IO, TYPE_CHECKING, Any, Callable, List, Optional, Tuple, Union, cast

import click
from click.core import Context
Expand Down Expand Up @@ -99,7 +99,7 @@ def __init__(self, message, exc_info):
super().__init__(message)
self.exc_info = exc_info

def show(self):
def show(self, file: IO[Any] | None = None):
"""Show the error message and traceback."""
emoji = ""
if console.is_advanced():
Expand Down
4 changes: 2 additions & 2 deletions tosho_mango/sources/kmkc/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class KMClientBase:

API_HOST = b64decode("aHR0cHM6Ly9hcGkua21hbmdhLmtvZGFuc2hhLmNvbQ==").decode("utf-8")
CDN_HOST = b64decode("aHR0cHM6Ly9jZG4ua21hbmdhLmtvZGFuc2hhLmNvbQ==").decode("utf-8")
_config: KMConfigWeb | KMConfigMobile
_config: KMConfigWeb | KMConfigMobile # type: ignore

def __init__(self, config: KMConfigWeb | KMConfigMobile) -> None:
self._config = config
Expand Down Expand Up @@ -287,7 +287,7 @@ class KMClientWeb(KMClientBase):

API_HOST = b64decode("aHR0cHM6Ly9hcGkua21hbmdhLmtvZGFuc2hhLmNvbQ==").decode("utf-8")
CDN_HOST = b64decode("aHR0cHM6Ly9jZG4ua21hbmdhLmtvZGFuc2hhLmNvbQ==").decode("utf-8")
_config: KMConfigWeb
_config: KMConfigWeb # type: ignore

def __init__(self, config: KMConfigWeb) -> None:
super().__init__(config)
Expand Down

0 comments on commit c420dac

Please sign in to comment.