Skip to content

Commit

Permalink
Format Python code with psf/black push
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions authored and github-actions committed Jan 31, 2024
1 parent e760cbf commit 3ff1416
Show file tree
Hide file tree
Showing 10 changed files with 163 additions and 118 deletions.
15 changes: 10 additions & 5 deletions cogs/code_interpreter_service_cog.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,11 +285,16 @@ async def on_message(self, message):
)
await message.reply(
embed=response_embed,
view=CodeInterpreterDownloadArtifactsView(
message, self, self.sessions[message.channel.id], artifact_names
)
if artifacts_available
else None,
view=(
CodeInterpreterDownloadArtifactsView(
message,
self,
self.sessions[message.channel.id],
artifact_names,
)
if artifacts_available
else None
),
)

safe_remove_list(self.thread_awaiting_responses, message.channel.id)
Expand Down
32 changes: 20 additions & 12 deletions cogs/moderations_service_cog.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,11 @@ async def start_moderations_service(self, guild_id, alert_channel_id=None):
self.set_guild_moderated(guild_id)
moderations_channel = await self.check_and_launch_moderations(
guild_id,
Moderation.moderation_alerts_channel
if not alert_channel_id
else alert_channel_id,
(
Moderation.moderation_alerts_channel
if not alert_channel_id
else alert_channel_id
),
)
self.set_moderated_alert_channel(guild_id, moderations_channel.id)

Expand Down Expand Up @@ -269,9 +271,11 @@ async def config_command(
ephemeral=True,
embed=await self.build_moderation_settings_embed(
config_type,
self.get_or_set_warn_set(ctx.guild_id)
if config_type == "warn"
else self.get_or_set_delete_set(ctx.guild_id),
(
self.get_or_set_warn_set(ctx.guild_id)
if config_type == "warn"
else self.get_or_set_delete_set(ctx.guild_id)
),
),
)
return
Expand All @@ -297,16 +301,20 @@ async def config_command(

new_delete_set = ThresholdSet(
hate if hate else delete_set["hate"],
hate_threatening
if hate_threatening
else delete_set["hate/threatening"],
(
hate_threatening
if hate_threatening
else delete_set["hate/threatening"]
),
self_harm if self_harm else delete_set["self-harm"],
sexual if sexual else delete_set["sexual"],
sexual_minors if sexual_minors else delete_set["sexual/minors"],
violence if violence else delete_set["violence"],
violence_graphic
if violence_graphic
else delete_set["violence/graphic"],
(
violence_graphic
if violence_graphic
else delete_set["violence/graphic"]
),
)
self.set_delete_set(ctx.guild_id, new_delete_set)
await self.restart_moderations_service(ctx)
Expand Down
6 changes: 3 additions & 3 deletions cogs/search_service_cog.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,9 @@ async def paginate_embed(
for count, chunk in enumerate(response_text, start=1):
if not first:
page = discord.Embed(
title="Search Results"
if not original_link
else "Follow-up results",
title=(
"Search Results" if not original_link else "Follow-up results"
),
description=chunk,
url=original_link,
)
Expand Down
34 changes: 21 additions & 13 deletions cogs/text_service_cog.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,9 @@ def __init__(
assert self.CONVERSATION_DRAWING_ABILITY_EXTRACTION_SNIPPET is not None

except Exception:
self.CONVERSATION_STARTER_TEXT = (
self.CONVERSATION_STARTER_TEXT_MINIMAL
) = self.CONVERSATION_STARTER_TEXT_VISION = (
self.CONVERSATION_STARTER_TEXT = self.CONVERSATION_STARTER_TEXT_MINIMAL = (
self.CONVERSATION_STARTER_TEXT_VISION
) = (
"You are an artificial intelligence that is able to do anything, and answer any question,"
"I want you to be my personal assistant and help me with some tasks. "
"and I want you to make well-informed decisions using the data that you have been trained on, "
Expand Down Expand Up @@ -239,9 +239,9 @@ async def on_member_join(self, member):
welcome_message_response = await self.model.send_request(
query,
tokens=self.usage_service.count_tokens(query),
is_chatgpt_request=True
if "turbo" in str(self.model.model)
else False,
is_chatgpt_request=(
True if "turbo" in str(self.model.model) else False
),
)
welcome_message = str(welcome_message_response["choices"][0]["text"])
except Exception:
Expand Down Expand Up @@ -1401,10 +1401,16 @@ async def converse_command(
await TextService.encapsulated_send(
self,
target.id,
opener
if target.id not in self.conversation_threads or self.pinecone_service
else "".join(
[item.text for item in self.conversation_threads[target.id].history]
(
opener
if target.id not in self.conversation_threads
or self.pinecone_service
else "".join(
[
item.text
for item in self.conversation_threads[target.id].history
]
)
),
target_message,
overrides=overrides,
Expand Down Expand Up @@ -1594,9 +1600,11 @@ async def callback(self, interaction: discord.Interaction):
try:
id = await self.converser_cog.sharegpt_service.format_and_share(
self.converser_cog.full_conversation_history[self.conversation_id],
self.converser_cog.bot.user.default_avatar.url
if not self.converser_cog.bot.user.avatar
else self.converser_cog.bot.user.avatar.url,
(
self.converser_cog.bot.user.default_avatar.url
if not self.converser_cog.bot.user.avatar
else self.converser_cog.bot.user.avatar.url
),
)
url = f"https://shareg.pt/{id}"
await interaction.response.send_message(
Expand Down
6 changes: 3 additions & 3 deletions cogs/translation_service_cog.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ def build_translation_embed(
)
embed.set_footer(
text=f"Requested by {requestor.name}#{requestor.discriminator}",
icon_url=requestor.avatar.url
if requestor.avatar
else requestor.default_avatar.url,
icon_url=(
requestor.avatar.url if requestor.avatar else requestor.default_avatar.url
),
)

return embed
Expand Down
10 changes: 6 additions & 4 deletions models/index_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -1688,10 +1688,12 @@ async def interaction_check(self, interaction: discord.Interaction) -> bool:
self.user_id,
indexes,
self.name,
False
if not self.deep_select.values
or self.deep_select.values[0] == "no"
else True,
(
False
if not self.deep_select.values
or self.deep_select.values[0] == "no"
else True
),
)
except ValueError as e:
await interaction.followup.send(
Expand Down
Loading

0 comments on commit 3ff1416

Please sign in to comment.