Skip to content

Commit

Permalink
format code
Browse files Browse the repository at this point in the history
  • Loading branch information
MeetWq committed Aug 4, 2024
1 parent 972fd70 commit 6b27ed5
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 23 deletions.
5 changes: 2 additions & 3 deletions memes/behead/__init__.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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 = [
Expand All @@ -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]
Expand Down
7 changes: 4 additions & 3 deletions memes/can_can_need/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
from pathlib import Path
from typing import List

from meme_generator import add_meme
from pil_utils import BuildImage

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
Expand All @@ -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=["看看你的"]
)
5 changes: 2 additions & 3 deletions memes/do/__init__.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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 = (
Expand All @@ -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)
Expand Down
3 changes: 1 addition & 2 deletions memes/empathy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
from pathlib import Path
from typing import List

from meme_generator import add_meme
from pil_utils import BuildImage

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),
Expand Down
3 changes: 1 addition & 2 deletions memes/fleshlight/__init__.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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)),
Expand Down
3 changes: 1 addition & 2 deletions memes/forbid/__init__.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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:
Expand Down
3 changes: 1 addition & 2 deletions memes/grab/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
from pathlib import Path
from typing import List

from meme_generator import add_meme
from pil_utils import BuildImage

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
Expand Down
4 changes: 3 additions & 1 deletion memes/lash/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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=["鞭笞", "鞭打", "鞭挞", "鞭策"]
)
6 changes: 5 additions & 1 deletion memes/little_do/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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=["小撅", "轻撅", "滑稽撅"],
)
3 changes: 1 addition & 2 deletions memes/operator_generator/__init__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import random
from pathlib import Path
from typing import List

from meme_generator import add_meme
from pil_utils import BuildImage

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 "你好"

Expand Down
3 changes: 1 addition & 2 deletions memes/stretch/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
from pathlib import Path
from typing import List

from meme_generator import add_meme
from pil_utils import BuildImage

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
Expand Down

0 comments on commit 6b27ed5

Please sign in to comment.