Skip to content

Commit

Permalink
style: format code with Black
Browse files Browse the repository at this point in the history
This commit fixes the style issues introduced in 10ab7cb according to the output
from Black.

Details: None
  • Loading branch information
deepsource-autofix[bot] authored Jun 26, 2024
1 parent 10ab7cb commit c0007f6
Show file tree
Hide file tree
Showing 15 changed files with 46 additions and 30 deletions.
8 changes: 2 additions & 6 deletions minato_namikaze/cogs/fun/periodic_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,17 +91,13 @@ def get_lattice_string(element: ELEMENTS) -> str:
def get_xray_wavelength(element: ELEMENTS) -> str:
try:
ka = 1239.84 / (
13.6057
* ((element.atomic_number - 1) ** 2)
* ((1 / 1**2) - (1 / 2**2))
13.6057 * ((element.atomic_number - 1) ** 2) * ((1 / 1**2) - (1 / 2**2))
)
except Exception:
ka = ""
try:
kb = 1239.84 / (
13.6057
* ((element.atomic_number - 1) ** 2)
* ((1 / 1**2) - (1 / 3**2))
13.6057 * ((element.atomic_number - 1) ** 2) * ((1 / 1**2) - (1 / 3**2))
)
except Exception:
kb = ""
Expand Down
1 change: 1 addition & 0 deletions minato_namikaze/lib/classes/barcode.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
All the code below was hacked together from https://github.com/mvictor212/pyBarcode
Which is itself a port of python-barcode which is no longer available
"""

from __future__ import annotations

import gzip
Expand Down
16 changes: 10 additions & 6 deletions minato_namikaze/lib/classes/games/shinobi_match.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,15 +119,19 @@ async def callback(self, interaction: discord.Interaction):
await self.reduce_health(amount=random.randint(1, 5))
elif self.label.lower() == "Ninjutsu Attack".lower():
await self.reduce_health(
amount=abs(view.character1.hitpoint - view.character2.regainpoint)
if view.turn == view.player1
else abs(view.character2.hitpoint - view.character1.regainpoint),
amount=(
abs(view.character1.hitpoint - view.character2.regainpoint)
if view.turn == view.player1
else abs(view.character2.hitpoint - view.character1.regainpoint)
),
)
elif self.label.lower() == "Special Power Attack".lower():
await self.reduce_health(
amount=(view.character1.specialpoint / 100) * view.overall_health
if view.turn == view.player1
else (view.character2.specialpoint / 100) * view.overall_health,
amount=(
(view.character1.specialpoint / 100) * view.overall_health
if view.turn == view.player1
else (view.character2.specialpoint / 100) * view.overall_health
),
)
if view.turn == view.player1:
view.special_moves1 -= 1
Expand Down
1 change: 1 addition & 0 deletions minato_namikaze/lib/classes/games/tictactoe.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import discord


# Defines a custom button that contains the logic of the game.
# The ['TicTacToe'] bit is for type hinting purposes to tell your IDE or linter
# what the type of `self.view` is. It is not required.
Expand Down
1 change: 1 addition & 0 deletions minato_namikaze/lib/classes/select_help.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
This code has been fully copied from here https://github.com/Rapptz/RoboDanny/blob/rewrite/cogs/utils/paginator.py
"""

from __future__ import annotations

import inspect
Expand Down
1 change: 1 addition & 0 deletions minato_namikaze/lib/classes/time_class.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
This code has been fully copied from here https://github.com/Rapptz/RoboDanny/blob/rewrite/cogs/utils/paginator.py
"""

from __future__ import annotations

import datetime
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2024-03-28 08:27:01.495168
"""

from __future__ import annotations

import sqlalchemy as sa
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2022-06-28 12:37:08.506648
"""

from __future__ import annotations

import sqlalchemy as sa
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2022-06-28 15:17:41.117219
"""

# revision identifiers, used by Alembic.
from __future__ import annotations

Expand Down
8 changes: 5 additions & 3 deletions minato_namikaze/lib/functions/moderation.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,11 @@ async def serverinfo(
)
embed.add_field(
name=":bell: Notifications",
value="All Messages "
if guild.default_notifications == discord.NotificationLevel.all_messages
else "Disabled",
value=(
"All Messages "
if guild.default_notifications == discord.NotificationLevel.all_messages
else "Disabled"
),
)
embed.add_field(name="Categories", value=len(guild.categories))
embed.add_field(
Expand Down
2 changes: 1 addition & 1 deletion minato_namikaze/lib/raid.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ async def add_and_check_data(
@tasks.loop(seconds=10.0)
async def bulk_send_messages(self):
async with self._batch_message_lock:
for ((guild_id, channel_id), messages) in self.message_batches.items():
for (guild_id, channel_id), messages in self.message_batches.items():
guild = self.bot.get_guild(guild_id)
channel = guild and guild.get_channel(channel_id)
if channel is None:
Expand Down
8 changes: 5 additions & 3 deletions minato_namikaze/lib/util/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,11 @@ async def detect_bad_domains(message_content: str) -> list:
if len(i.split("//")) != 0:
try:
parsed_url = urlparse(
i.lower().strip("/")
if i.split("://")[0].lower() in uses_netloc
else f'//{i.strip("/")}',
(
i.lower().strip("/")
if i.split("://")[0].lower() in uses_netloc
else f'//{i.strip("/")}'
),
)
if parsed_url.hostname in list_of_bad_domains:
detected_urls.append(parsed_url.hostname)
Expand Down
1 change: 1 addition & 0 deletions minato_namikaze/lib/util/vars.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

from sqlalchemy.orm import declarative_base


# only way to resolve the circular, yes this is the only way
class _MissingSentinel:
__slots__ = ()
Expand Down
8 changes: 5 additions & 3 deletions minato_namikaze/old_outdated/setup_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,11 @@ async def badlinks(
"badlinks": {
"option": option,
"action": action,
"logging_channel": logging_channel.id
if logging_channel is not None
else logging_channel,
"logging_channel": (
logging_channel.id
if logging_channel is not None
else logging_channel
),
},
},
ctx=ctx,
Expand Down
18 changes: 10 additions & 8 deletions minato_namikaze/slash/moderation.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,11 +428,11 @@ class BadLinks(discord.SlashCommand, parent=Setup):
description="Enable or Disable",
default=True,
)
action: None | (
typing.Literal["ban", "mute", "timeout", "kick", "log"]
) = discord.application_command_option(
description="What kind of action to take",
default=None,
action: None | (typing.Literal["ban", "mute", "timeout", "kick", "log"]) = (
discord.application_command_option(
description="What kind of action to take",
default=None,
)
)
channel: GuildChannel | None = discord.application_command_option(
channel_types=[discord.TextChannel],
Expand All @@ -455,9 +455,11 @@ async def callback(self, response: discord.SlashCommandResponse):
"badlinks": {
"option": response.options.option,
"action": response.options.action,
"logging_channel": response.options.channel.id
if response.options.channel is not None
else response.options.channel,
"logging_channel": (
response.options.channel.id
if response.options.channel is not None
else response.options.channel
),
},
},
response.interaction.guild,
Expand Down

0 comments on commit c0007f6

Please sign in to comment.