Skip to content

Commit

Permalink
ruff reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
laggykiller committed Feb 7, 2024
1 parent 4531cdd commit bd6dc55
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 15 deletions.
8 changes: 4 additions & 4 deletions compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def get_arch() -> str:
arch = k
break

if arch == None:
if arch is None:
arch = platform.machine().lower()

return arch
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions scripts/opt-comp-experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions src/sticker_convert/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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":
Expand Down
2 changes: 0 additions & 2 deletions tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
3 changes: 1 addition & 2 deletions tests/test_compression.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
4 changes: 2 additions & 2 deletions tests/test_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down Expand Up @@ -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()


Expand Down

0 comments on commit bd6dc55

Please sign in to comment.