diff --git a/compile.py b/compile.py index c3c2217..88b1f14 100755 --- a/compile.py +++ b/compile.py @@ -28,7 +28,7 @@ def get_arch() -> str: arch = k break - if arch == None: + if arch is None: arch = platform.machine().lower() return arch @@ -64,9 +64,9 @@ def copy_if_universal(wheel_name: Path, in_dir: Path, out_dir: Path) -> bool: src_path = Path(in_dir, wheel_name.name) dst_path = Path( out_dir, - wheel_name.name - .replace("x86_64", "universal2") - .replace("arm64", "universal2"), + wheel_name.name.replace("x86_64", "universal2").replace( + "arm64", "universal2" + ), ) shutil.copy(src_path, dst_path) diff --git a/scripts/opt-comp-experiment.py b/scripts/opt-comp-experiment.py index e5441b4..29c69ee 100755 --- a/scripts/opt-comp-experiment.py +++ b/scripts/opt-comp-experiment.py @@ -25,9 +25,9 @@ os.chdir(Path(__file__).resolve().parent) sys.path.append("../src") -from sticker_convert.converter import StickerConvert -from sticker_convert.job_option import CompOption -from sticker_convert.utils.callback import Callback, CallbackReturn +from sticker_convert.converter import StickerConvert # noqa: E402 +from sticker_convert.job_option import CompOption # noqa: E402 +from sticker_convert.utils.callback import Callback, CallbackReturn # noqa: E402 processes_max = math.ceil(cpu_count() / 2) diff --git a/src/sticker_convert/converter.py b/src/sticker_convert/converter.py index e7e5142..2cb3654 100755 --- a/src/sticker_convert/converter.py +++ b/src/sticker_convert/converter.py @@ -158,7 +158,7 @@ def convert( Callback, ], cb_return: CallbackReturn, - ) -> tuple[bool, Union[BytesIO, Path], Union[None, bytes, Path], int]: + ) -> tuple[bool, Union[None, BytesIO, Path], Union[None, bytes, Path], int]: sticker = StickerConvert(in_f, out_f, opt_comp, cb) result = sticker._convert() cb.put("update_bar") @@ -342,7 +342,7 @@ def compress_fail( def compress_done( self, data: bytes, result_step: Optional[int] = None - ) -> tuple[bool, Union[BytesIO, Path], Union[None, bytes, Path], int]: + ) -> tuple[bool, Union[None, BytesIO, Path], Union[None, bytes, Path], int]: if self.out_f.stem == "none": out_f = None elif self.out_f.stem == "bytes": diff --git a/tests/common.py b/tests/common.py index 049a092..b347995 100644 --- a/tests/common.py +++ b/tests/common.py @@ -6,8 +6,6 @@ from pathlib import Path from typing import Any -import pytest # type: ignore - def get_python_path() -> str: path = shutil.which("python3") diff --git a/tests/test_compression.py b/tests/test_compression.py index b0cd638..24646e7 100644 --- a/tests/test_compression.py +++ b/tests/test_compression.py @@ -2,14 +2,13 @@ import sys from pathlib import Path -import pytest # type: ignore from tests.common import COMPRESSION_DICT, PYTHON_EXE, SAMPLE_DIR, SRC_DIR, run_cmd os.chdir(Path(__file__).resolve().parent) sys.path.append("../src") -from sticker_convert.utils.media.codec_info import CodecInfo +from sticker_convert.utils.media.codec_info import CodecInfo # noqa: E402 SIZE_MAX_IMG = COMPRESSION_DICT.get("custom").get("size_max").get("img") SIZE_MAX_VID = COMPRESSION_DICT.get("custom").get("size_max").get("vid") diff --git a/tests/test_export.py b/tests/test_export.py index 864ad45..08b2b1a 100644 --- a/tests/test_export.py +++ b/tests/test_export.py @@ -20,7 +20,7 @@ os.chdir(Path(__file__).resolve().parent) sys.path.append("../src") -from sticker_convert.utils.media.codec_info import CodecInfo +from sticker_convert.utils.media.codec_info import CodecInfo # noqa: E402 TEST_UPLOAD = os.environ.get("TEST_UPLOAD") @@ -163,7 +163,7 @@ def test_upload_telegram_emoji(tmp_path): # type: ignore def test_export_wastickers(tmp_path): # type: ignore _run_sticker_convert(tmp_path, "whatsapp", "whatsapp") # type: ignore - wastickers_path = Path(tmp_path, f"sticker-convert-test.wastickers") # type: ignore + wastickers_path = Path(tmp_path, "sticker-convert-test.wastickers") # type: ignore assert Path(wastickers_path).is_file()