-
-
Notifications
You must be signed in to change notification settings - Fork 0
Conversation
match = next( | ||
if match := next( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function BassBoostConverter.convert
refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression
) - Lift code into else after jump in control flow (
reintroduce-else
) - Swap if/else branches (
swap-if-else-branches
)
player = self.cog.lavalink.get_player(self.guild_id) | ||
if not player: | ||
if player := self.cog.lavalink.get_player(self.guild_id): | ||
return player.history.raw_queue if self.history else player.queue.raw_queue | ||
else: | ||
return [] | ||
return player.history.raw_queue if self.history else player.queue.raw_queue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function QueueSource.entries
refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression
) - Lift code into else after jump in control flow (
reintroduce-else
) - Swap if/else branches (
swap-if-else-branches
)
player = self.cog.lavalink.get_player(menu.ctx.guild.id) | ||
if not player: | ||
if player := self.cog.lavalink.get_player(menu.ctx.guild.id): | ||
return ( | ||
await player.get_queue_page( | ||
page_index=menu.current_page, | ||
per_page=self.per_page, | ||
total_pages=self.get_max_pages(), | ||
embed=True, | ||
messageable=menu.ctx, | ||
history=self.history, | ||
) | ||
if player.current and (player.history.size() if self.history else True) | ||
else await self.cog.lavalink.construct_embed( | ||
description="There's nothing in recently played." | ||
if self.history | ||
else "There's nothing currently being played.", | ||
messageable=menu.ctx, | ||
) | ||
) | ||
else: | ||
return await self.cog.lavalink.construct_embed( | ||
description="No active player found in server.", messageable=menu.ctx | ||
) | ||
return ( | ||
await player.get_queue_page( | ||
page_index=menu.current_page, | ||
per_page=self.per_page, | ||
total_pages=self.get_max_pages(), | ||
embed=True, | ||
messageable=menu.ctx, | ||
history=self.history, | ||
) | ||
if player.current and (player.history.size() if self.history else True) | ||
else await self.cog.lavalink.construct_embed( | ||
description="There's nothing in recently played." | ||
if self.history | ||
else "There's nothing currently being played.", | ||
messageable=menu.ctx, | ||
) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function QueueSource.format_page
refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression
) - Lift code into else after jump in control flow (
reintroduce-else
) - Swap if/else branches (
swap-if-else-branches
)
player = self.cog.lavalink.get_player(menu.ctx.guild.id) | ||
if not player: | ||
if player := self.cog.lavalink.get_player(menu.ctx.guild.id): | ||
return ( | ||
await player.get_queue_page( | ||
page_index=menu.current_page, | ||
per_page=self.per_page, | ||
total_pages=self.get_max_pages(), | ||
embed=True, | ||
messageable=menu.ctx, | ||
) | ||
if player.current | ||
else await self.cog.lavalink.construct_embed( | ||
description="There's nothing currently being played.", | ||
messageable=menu.ctx, | ||
) | ||
) | ||
else: | ||
return await self.cog.lavalink.construct_embed( | ||
description="No active player found in server.", messageable=menu.ctx | ||
) | ||
return ( | ||
await player.get_queue_page( | ||
page_index=menu.current_page, | ||
per_page=self.per_page, | ||
total_pages=self.get_max_pages(), | ||
embed=True, | ||
messageable=menu.ctx, | ||
) | ||
if player.current | ||
else await self.cog.lavalink.construct_embed( | ||
description="There's nothing currently being played.", | ||
messageable=menu.ctx, | ||
) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function QueuePickerSource.format_page
refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression
) - Lift code into else after jump in control flow (
reintroduce-else
) - Swap if/else branches (
swap-if-else-branches
)
Sourcery Code Quality Report❌ Merging this PR will decrease code quality in the affected files by 0.43%.
Here are some functions in these files that still need a tune-up:
Legend and ExplanationThe emojis denote the absolute quality of the code:
The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request. Please see our documentation here for details on how these metrics are calculated. We are actively working on this report - lots more documentation and extra metrics to come! Help us improve this quality report! |
Branch
master
refactored by Sourcery.If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.
See our documentation here.
Run Sourcery locally
Reduce the feedback loop during development by using the Sourcery editor plugin:
Review changes via command line
To manually merge these changes, make sure you're on the
master
branch, then run:Help us improve this pull request!