Skip to content

Commit

Permalink
style: format code with Autopep8 and isort (#228)
Browse files Browse the repository at this point in the history
Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
  • Loading branch information
deepsource-autofix[bot] authored Nov 29, 2023
1 parent 5f1eb86 commit 82f739f
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 17 deletions.
3 changes: 1 addition & 2 deletions classes/urbandictionary.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@
from urllib.parse import quote

import aiohttp
from interactions import Embed
from bs4 import BeautifulSoup
from fake_useragent import FakeUserAgent
from interactions import Embed

from classes.excepts import ProviderHttpError


USER_AGENT = FakeUserAgent().random


Expand Down
3 changes: 2 additions & 1 deletion extensions/games.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ async def games_search(self, ctx: ipy.SlashContext, query: str):
title="Error",
description=f"I couldn't able to find any results for {query} on RAWG. Please check your query and try again.",
color=0xFF0000,
footer=ipy.EmbedFooter(text="Pro tip: Use native title to get the most accurate result... But I can't guarantee if RAWG has original title, it depends."),
footer=ipy.EmbedFooter(
text="Pro tip: Use native title to get the most accurate result... But I can't guarantee if RAWG has original title, it depends."),
)
embed.set_thumbnail(
url=f"https://cdn.discordapp.com/emojis/{emoji}.png?v=1"
Expand Down
4 changes: 2 additions & 2 deletions extensions/random.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from classes.randomorg import ProviderHttpError, RandomOrg
from modules.commons import save_traceback_to_file
from modules.const import (EMOJI_DOUBTING, EMOJI_SUCCESS, EMOJI_FORBIDDEN,
from modules.const import (EMOJI_DOUBTING, EMOJI_FORBIDDEN, EMOJI_SUCCESS,
EMOJI_UNEXPECTED_ERROR)


Expand Down Expand Up @@ -281,5 +281,5 @@ async def random_string(
save_traceback_to_file("random_string", ctx.author, e)


def setup(bot:ipy.Client | ipy.AutoShardedClient):
def setup(bot: ipy.Client | ipy.AutoShardedClient):
Random(bot)
10 changes: 6 additions & 4 deletions extensions/urban.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
"""Add Urban Dictionary commands to the bot."""

import interactions as ipy
import aiohttp
import interactions as ipy
from interactions.ext.paginators import Paginator

from classes.urbandictionary import UrbanDictionary as Urban, UrbanDictionaryEntry as Entry
from modules.commons import platform_exception_embed, save_traceback_to_file, get_nsfw_status
from classes.urbandictionary import UrbanDictionary as Urban
from classes.urbandictionary import UrbanDictionaryEntry as Entry
from modules.commons import (get_nsfw_status, platform_exception_embed,
save_traceback_to_file)


class UrbanDictionaryCog(ipy.Extension):
Expand Down Expand Up @@ -137,7 +139,7 @@ async def urban_wotd(self, ctx: ipy.SlashContext):
))
save_traceback_to_file("urban_random", ctx.author, e)
return
await ctx.send(embed=entry.embed) # type: ignore
await ctx.send(embed=entry.embed) # type: ignore


def setup(bot: ipy.Client):
Expand Down
14 changes: 9 additions & 5 deletions extensions/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

from classes.isitdownrightnow import WebsiteChecker, WebsiteStatus
from classes.thecolorapi import Color, TheColorApi
from classes.usrbg import UserBackground
from classes.userpfp import UserPFP
from classes.usrbg import UserBackground
from modules.commons import (generate_utils_except_embed,
save_traceback_to_file, snowflake_to_datetime)

Expand Down Expand Up @@ -114,8 +114,10 @@ async def utilities_base64(self, ctx: ipy.SlashContext, mode: str, string: str):
title=f"Base64 {mode.title()}",
color=0x996422,
fields=[
ipy.EmbedField(name="String", value=strVal, inline=False),
ipy.EmbedField(name="Result", value=resVal, inline=False),
ipy.EmbedField(
name="String", value=strVal, inline=False),
ipy.EmbedField(
name="Result", value=resVal, inline=False),
],
)
)
Expand Down Expand Up @@ -319,9 +321,11 @@ async def utilities_snowflake(self, ctx: ipy.SlashContext, snowflake: str):
raise ValueError("Invalid snowflake")
# else, check for the bits size should be 64 from binary
elif bin_len > 64:
raise ValueError("Snowflake is too big, did you randomly generate it?")
raise ValueError(
"Snowflake is too big, did you randomly generate it?")
elif bin_len < 60:
raise ValueError("Snowflake is too small, did you randomly generate it?")
raise ValueError(
"Snowflake is too small, did you randomly generate it?")
tmsp = int(snowflake_to_datetime(int(snowflake)))
except Exception as e:
await ctx.send(
Expand Down
7 changes: 4 additions & 3 deletions modules/myanimelist.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@
from classes.kitsu import Kitsu
from classes.myanimelist import MyAnimeList
from classes.simkl import Simkl
from modules.commons import (generate_commons_except_embed, generate_trailer,
get_nsfw_status, get_random_seed,
from modules.commons import (PlatformErrType, generate_commons_except_embed,
generate_trailer, get_nsfw_status,
get_random_seed, platform_exception_embed,
sanitize_markdown, save_traceback_to_file,
trim_synopsis, platform_exception_embed, PlatformErrType)
trim_synopsis)
from modules.const import (EMOJI_FORBIDDEN, MESSAGE_WARN_CONTENTS,
MYANIMELIST_CLIENT_ID, SIMKL_CLIENT_ID)
from modules.platforms import Platform, media_id_to_platform
Expand Down
1 change: 1 addition & 0 deletions modules/nekomimidb.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def determine_domain(url: str) -> str:
return guess_name
return domain


def generate_nekomimi_embed(row: NekomimiDbStruct) -> Embed:
"""
Generate nekomimi embed
Expand Down

0 comments on commit 82f739f

Please sign in to comment.