From 6b27ed57e5e64d0e9a01512105bd2d88d82aab0e Mon Sep 17 00:00:00 2001 From: meetwq Date: Sun, 4 Aug 2024 18:08:11 +0800 Subject: [PATCH] format code --- memes/behead/__init__.py | 5 ++--- memes/can_can_need/__init__.py | 7 ++++--- memes/do/__init__.py | 5 ++--- memes/empathy/__init__.py | 3 +-- memes/fleshlight/__init__.py | 3 +-- memes/forbid/__init__.py | 3 +-- memes/grab/__init__.py | 3 +-- memes/lash/__init__.py | 4 +++- memes/little_do/__init__.py | 6 +++++- memes/operator_generator/__init__.py | 3 +-- memes/stretch/__init__.py | 3 +-- 11 files changed, 22 insertions(+), 23 deletions(-) diff --git a/memes/behead/__init__.py b/memes/behead/__init__.py index 7c8c9ce..6206014 100644 --- a/memes/behead/__init__.py +++ b/memes/behead/__init__.py @@ -1,5 +1,4 @@ from pathlib import Path -from typing import List from meme_generator import add_meme from meme_generator.utils import save_gif @@ -9,7 +8,7 @@ img_dir = Path(__file__).parent / "images" -def behead(images: List[BuildImage], texts, args): +def behead(images: list[BuildImage], texts, args): img = images[0].convert("RGBA").square().resize((75, 75)) # fmt: off locs = [ @@ -22,7 +21,7 @@ def behead(images: List[BuildImage], texts, args): (9, 91, 155), (6, 161, 175), (-4, 248, 180), ] # fmt: on - frames: List[IMG] = [] + frames: list[IMG] = [] for i in range(21): frame = BuildImage.open(img_dir / f"{i}.png") x, y, angle = locs[i] diff --git a/memes/can_can_need/__init__.py b/memes/can_can_need/__init__.py index b10f478..aa4a9ba 100644 --- a/memes/can_can_need/__init__.py +++ b/memes/can_can_need/__init__.py @@ -1,5 +1,4 @@ from pathlib import Path -from typing import List from meme_generator import add_meme from pil_utils import BuildImage @@ -7,7 +6,7 @@ img_dir = Path(__file__).parent / "images" -def can_can_need(images: List[BuildImage], texts, args): +def can_can_need(images: list[BuildImage], texts, args): frame = BuildImage.open(img_dir / "0.jpg") frame.paste( images[1].convert("RGBA").circle().resize((340, 340)), (120, 21), alpha=True @@ -17,4 +16,6 @@ def can_can_need(images: List[BuildImage], texts, args): return frame.save_jpg() -add_meme("can_can_need", can_can_need, min_images=2, max_images=2, keywords=["看看你的"]) +add_meme( + "can_can_need", can_can_need, min_images=2, max_images=2, keywords=["看看你的"] +) diff --git a/memes/do/__init__.py b/memes/do/__init__.py index 4128da3..81108c5 100644 --- a/memes/do/__init__.py +++ b/memes/do/__init__.py @@ -1,5 +1,4 @@ from pathlib import Path -from typing import List from meme_generator import add_meme from meme_generator.utils import save_gif @@ -9,7 +8,7 @@ img_dir = Path(__file__).parent / "images" -def do(images: List[BuildImage], texts, args): +def do(images: list[BuildImage], texts, args): self_locs = [(116, -8), (109, 3), (130, -10)] user_locs = [(2, 177), (12, 172), (6, 158)] self_head = ( @@ -26,7 +25,7 @@ def do(images: List[BuildImage], texts, args): .circle() .rotate(90) ) - frames: List[IMG] = [] + frames: list[IMG] = [] for i in range(3): frame = BuildImage.open(img_dir / f"{i}.png") frame.paste(user_head, user_locs[i], alpha=True) diff --git a/memes/empathy/__init__.py b/memes/empathy/__init__.py index 6468a31..6fe0abd 100644 --- a/memes/empathy/__init__.py +++ b/memes/empathy/__init__.py @@ -1,5 +1,4 @@ from pathlib import Path -from typing import List from meme_generator import add_meme from pil_utils import BuildImage @@ -7,7 +6,7 @@ img_dir = Path(__file__).parent / "images" -def empathy(images: List[BuildImage], texts, args): +def empathy(images: list[BuildImage], texts, args): frame = BuildImage.open(img_dir / "0.png") frame.paste( images[0].convert("RGBA").circle().resize((90, 90)).rotate(100), diff --git a/memes/fleshlight/__init__.py b/memes/fleshlight/__init__.py index 625cdb8..0391de2 100644 --- a/memes/fleshlight/__init__.py +++ b/memes/fleshlight/__init__.py @@ -1,5 +1,4 @@ from pathlib import Path -from typing import List from meme_generator import add_meme from meme_generator.utils import FrameAlignPolicy, Maker, make_gif_or_combined_gif @@ -8,7 +7,7 @@ img_dir = Path(__file__).parent / "images" -def fleshlight(images: List[BuildImage], texts, args): +def fleshlight(images: list[BuildImage], texts, args): params = [ (((0, 6), (205, 0), (213, 157), (8, 171)), (117, 59)), (((0, 6), (205, 0), (213, 157), (8, 171)), (117, 59)), diff --git a/memes/forbid/__init__.py b/memes/forbid/__init__.py index a181617..c18d85f 100644 --- a/memes/forbid/__init__.py +++ b/memes/forbid/__init__.py @@ -1,5 +1,4 @@ from pathlib import Path -from typing import List from meme_generator import add_meme from meme_generator.utils import make_jpg_or_gif @@ -8,7 +7,7 @@ img_dir = Path(__file__).parent / "images" -def forbid(images: List[BuildImage], texts, args): +def forbid(images: list[BuildImage], texts, args): frame = BuildImage.open(img_dir / "0.png") def make(img: BuildImage) -> BuildImage: diff --git a/memes/grab/__init__.py b/memes/grab/__init__.py index d40c0c8..82566df 100644 --- a/memes/grab/__init__.py +++ b/memes/grab/__init__.py @@ -1,5 +1,4 @@ from pathlib import Path -from typing import List from meme_generator import add_meme from pil_utils import BuildImage @@ -7,7 +6,7 @@ img_dir = Path(__file__).parent / "images" -def grab(images: List[BuildImage], texts, args): +def grab(images: list[BuildImage], texts, args): frame = BuildImage.open(img_dir / "0.png") frame.paste( images[0].convert("RGBA").resize((500, 500), keep_ratio=True), below=True diff --git a/memes/lash/__init__.py b/memes/lash/__init__.py index d665ae6..ac45092 100644 --- a/memes/lash/__init__.py +++ b/memes/lash/__init__.py @@ -30,4 +30,6 @@ def lash(images: list[BuildImage], texts, args): return save_gif(frames, 0.05) -add_meme("lash", lash, min_images=2, max_images=2, keywords=["鞭笞", "鞭打", "鞭挞", "鞭策"]) +add_meme( + "lash", lash, min_images=2, max_images=2, keywords=["鞭笞", "鞭打", "鞭挞", "鞭策"] +) diff --git a/memes/little_do/__init__.py b/memes/little_do/__init__.py index 0f3c3d0..79c60c0 100644 --- a/memes/little_do/__init__.py +++ b/memes/little_do/__init__.py @@ -21,5 +21,9 @@ def little_do(images: list[BuildImage], texts, args): add_meme( - "little_do", little_do, min_images=2, max_images=2, keywords=["小撅", "轻撅", "滑稽撅"] + "little_do", + little_do, + min_images=2, + max_images=2, + keywords=["小撅", "轻撅", "滑稽撅"], ) diff --git a/memes/operator_generator/__init__.py b/memes/operator_generator/__init__.py index 462fd47..2573bef 100644 --- a/memes/operator_generator/__init__.py +++ b/memes/operator_generator/__init__.py @@ -1,6 +1,5 @@ import random from pathlib import Path -from typing import List from meme_generator import add_meme from pil_utils import BuildImage @@ -8,7 +7,7 @@ img_dir = Path(__file__).parent / "images" -def operator_generator(images: List[BuildImage], texts: List[str], args): +def operator_generator(images: list[BuildImage], texts: list[str], args): img = images[0].convert("RGBA").circle().resize((80, 80)) name = texts[0] if texts else "你好" diff --git a/memes/stretch/__init__.py b/memes/stretch/__init__.py index d8c5fd2..006f787 100644 --- a/memes/stretch/__init__.py +++ b/memes/stretch/__init__.py @@ -1,5 +1,4 @@ from pathlib import Path -from typing import List from meme_generator import add_meme from pil_utils import BuildImage @@ -7,7 +6,7 @@ img_dir = Path(__file__).parent / "images" -def stretch(images: List[BuildImage], texts, args): +def stretch(images: list[BuildImage], texts, args): frame = BuildImage.open(img_dir / "0.png") frame.paste( images[0].convert("RGBA").resize((500, 500), keep_ratio=True), below=True