chore: add pre-commit

This commit is contained in:
2024-08-04 19:02:10 +01:00
parent ed973162b6
commit 14d7cecc55
12 changed files with 107 additions and 31 deletions

View File

@ -5,6 +5,7 @@ import os
class Config:
"""Configuration module."""
def __init__(self) -> None:
"""Configuration module."""
self.__environment: str = os.environ.get("APP_LIFECYCLE", "DEV").upper()

View File

@ -1,6 +1,5 @@
import requests
CHAR_REPLACEMENTS: list = [
["_", "__"],
["-", "--"],
@ -56,5 +55,7 @@ def generate_api_url(template: str, top_str: str, btm_str: str) -> str:
top_str = format_meme_string(top_str)
btm_str = format_meme_string(btm_str)
url: str = f"https://api.memegen.link/images/{tmpl_name}/{top_str}/{btm_str}.{tmpl_ext}"
url: str = (
f"https://api.memegen.link/images/{tmpl_name}/{top_str}/{btm_str}.{tmpl_ext}"
)
return url

View File

@ -2,13 +2,11 @@
import sentry_sdk
from sentry_sdk.integrations.stdlib import StdlibIntegration
from webex_bot.webex_bot import WebexBot
from app import close, meme
from app.config import config
if config.sentry_enabled:
apm = sentry_sdk.init(
dsn=config.sentry_dsn,
@ -16,7 +14,7 @@ if config.sentry_enabled:
environment=config.environment,
release=config.version,
integrations=[StdlibIntegration()],
spotlight=True
spotlight=True,
)

View File

@ -2,25 +2,25 @@ from webex_bot.models.command import Command
from webex_bot.models.response import Response, response_from_adaptive_card
from webexteamssdk.models.cards import (
AdaptiveCard,
Choice,
Choices,
Column,
ColumnSet,
FontSize,
FontWeight,
Text,
TextBlock,
Choice,
Choices,
)
from webexteamssdk.models.cards.actions import Submit, OpenUrl
from webexteamssdk.models.cards.actions import OpenUrl, Submit
from app import img
TEMPLATES = img.get_templates()
class MakeMemeCommand(Command):
"""Class for initial Webex interactive card."""
def __init__(self) -> None:
super().__init__(
command_keyword="/meme",
@ -69,7 +69,8 @@ class MakeMemeCommand(Command):
id="meme_type",
isMultiSelect=False,
choices=[
Choice(title=x["name"], value=x["choiceval"]) for x in TEMPLATES
Choice(title=x["name"], value=x["choiceval"])
for x in TEMPLATES
],
),
Text(id="text_top", placeholder="Top Text", maxLength=100),
@ -100,6 +101,7 @@ class MakeMemeCommand(Command):
class MakeMemeCallback(Command):
"""Class to process user data and return meme."""
def __init__(self) -> None:
super().__init__(
card_callback_keyword="make_meme_callback_rbamzfyx",