Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style: format code with Autopep8 and isort #250

Merged
merged 1 commit into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions extensions/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
from classes.stats.infinity import InfinityBots
from classes.stats.topgg import TopGG
from modules.commons import save_traceback_to_file
from modules.const import GIT_COMMIT_HASH, GT_HSH, USER_AGENT, VERIFICATION_SERVER
from modules.const import (GIT_COMMIT_HASH, GT_HSH, USER_AGENT,
VERIFICATION_SERVER)


@dataclass
Expand Down Expand Up @@ -209,7 +210,8 @@ def get_pip_pkgs() -> list[PackageInfo]:
final: list[PackageInfo] = []
for pkg in pipkg.working_set:
final.append(
PackageInfo(name=pkg.key, version=pkg.version, license=get_pkg_license(pkg))
PackageInfo(name=pkg.key, version=pkg.version,
license=get_pkg_license(pkg))
)
# sort by name
final.sort(key=lambda x: x.name)
Expand Down Expand Up @@ -341,7 +343,8 @@ async def stats_general(self, ctx: ipy.SlashContext):
save_traceback_to_file("stats_general-ibl", ctx.author, err, True)

provider_votes.sort(key=lambda x: x.name)
votes_str = "\n".join([vt.as_text for vt in provider_votes]) or "No reports"
votes_str = "\n".join(
[vt.as_text for vt in provider_votes]) or "No reports"

embed = ipy.Embed(
title="General stats for bot",
Expand All @@ -352,8 +355,10 @@ async def stats_general(self, ctx: ipy.SlashContext):
embed.add_fields(
ipy.EmbedField(name="🏠 Guilds", value=f"{guilds:,}", inline=True),
ipy.EmbedField(name="🔗 Shards", value=f"{shards:,}", inline=True),
ipy.EmbedField(name="📝 Commands", value=f"{command_count:,}", inline=True),
ipy.EmbedField(name="🕒 Uptime", value=f"<t:{uptime}:R>", inline=True),
ipy.EmbedField(name="📝 Commands",
value=f"{command_count:,}", inline=True),
ipy.EmbedField(name="🕒 Uptime",
value=f"<t:{uptime}:R>", inline=True),
ipy.EmbedField(name="🐍 Python Version", value=py_ver, inline=True),
ipy.EmbedField(
name="🤖 Bot Version",
Expand Down Expand Up @@ -478,7 +483,7 @@ async def deepstats_packages(self, ctx: ipy.SlashContext):

for page in range(0, len(packages), 15):
listed: list[ipy.EmbedField] = []
for pkg in packages[page : page + 15]:
for pkg in packages[page: page + 15]:
listed.append(
ipy.EmbedField(
name=pkg.name,
Expand Down
22 changes: 9 additions & 13 deletions extensions/tasker.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,16 @@
import os
import time
from typing import Union

from interactions import (
Activity,
ActivityType,
AutoShardedClient,
Client,
Extension,
IntervalTrigger,
Task,
)
from interactions import (Activity, ActivityType, AutoShardedClient, Client,
Extension, IntervalTrigger, Task)

from classes.excepts import ProviderHttpError
from classes.stats.dbgg import DiscordBotsGG
from classes.stats.dbl import DiscordBotList
from classes.stats.infinity import InfinityBots
from classes.stats.topgg import TopGG
from modules.commons import save_traceback_to_file
from typing import Union


class BotTasker(Extension):
Expand Down Expand Up @@ -124,7 +117,8 @@ async def poll_stats(self) -> None:
)
except ProviderHttpError as error:
print(f"[Tsk] [Stats] Failed to poll to DiscordBots.gg: {error}")
save_traceback_to_file("tasker_dbgg", self.bot.user, error, mute_error=True)
save_traceback_to_file(
"tasker_dbgg", self.bot.user, error, mute_error=True)
show_msg.append("DiscordBots.gg")

try:
Expand All @@ -135,7 +129,8 @@ async def poll_stats(self) -> None:
)
except ProviderHttpError as error:
print(f"[Tsk] [Stats] Failed to poll to DiscordBotList: {error}")
save_traceback_to_file("tasker_dbl", self.bot.user, error, mute_error=True)
save_traceback_to_file(
"tasker_dbl", self.bot.user, error, mute_error=True)
show_msg.append("DiscordBotList.com")

try:
Expand All @@ -147,7 +142,8 @@ async def poll_stats(self) -> None:
)
except ProviderHttpError as error:
print(f"[Tsk] [Stats] Failed to poll to InfinityBots: {error}")
save_traceback_to_file("tasker_ibgg", self.bot.user, error, mute_error=True)
save_traceback_to_file(
"tasker_ibgg", self.bot.user, error, mute_error=True)
show_msg.append("InfinityBots")

print(
Expand Down
3 changes: 2 additions & 1 deletion modules/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@
"""Shikimori client ID"""
SHIKIMORI_CLIENT_SECRET: Final[str] = cast(str, ge("SHIKIMORI_CLIENT_SECRET"))
"""Shikimori client secret"""
SHIKIMORI_APPLICATION_NAME: Final[str] = cast(str, ge("SHIKIMORI_APPLICATION_NAME"))
SHIKIMORI_APPLICATION_NAME: Final[str] = cast(
str, ge("SHIKIMORI_APPLICATION_NAME"))
"""Shikimori application name"""
SIMKL_CLIENT_ID: Final[str] = cast(str, ge("SIMKL_CLIENT_ID"))
"""SIMKL client ID"""
Expand Down