-
Notifications
You must be signed in to change notification settings - Fork 1
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
Sourcery Starbot ⭐ refactored kuba2k2/espionage-bot #1
base: master
Are you sure you want to change the base?
Conversation
for name in files.keys(): | ||
for name in files: |
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 Espionage.__init__
refactored with the following changes:
- Remove unnecessary call to keys() (
remove-dict-keys
)
cmd=ESPIONAGE_FILE if not member.guild.voice_client else None, | ||
cmd=None if member.guild.voice_client else ESPIONAGE_FILE, | ||
) | ||
|
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 Espionage.on_voice_state_update
refactored with the following changes:
- Swap if/else branches of if expression to remove negation (
swap-if-expression
)
pack = "pack" in cmd and cmd["pack"] | ||
if pack: | ||
if pack := "pack" in cmd and cmd["pack"]: |
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 Music.loop
refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression
)
f"Speed changing is not possible - missing file metadata.", | ||
"Speed changing is not possible - missing file metadata.", | ||
delete_after=10, | ||
) | ||
|
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 Music.speed
refactored with the following changes:
- Replace f-string with no interpolated values with string (
remove-redundant-fstring
)
version = file["version"] if "version" in file else 1 | ||
version = file.get("version", 1) |
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 migrate
refactored with the following changes:
- Simplify dictionary access using default get (
default-get
)
if not voice: | ||
return False | ||
return len(voice.channel.voice_states) <= 1 | ||
return len(voice.channel.voice_states) <= 1 if voice else False |
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 is_alone
refactored with the following changes:
- Swap if/else branches of if expression to remove negation (
swap-if-expression
) - Lift code into else after jump in control flow (
reintroduce-else
) - Replace if statement with if expression (
assign-if-exp
)
await ctx.send(f"User is not connected to a voice channel.", delete_after=3) | ||
await ctx.send("User is not connected to a voice channel.", delete_after=3) |
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 ensure_voice
refactored with the following changes:
- Replace f-string with no interpolated values with string (
remove-redundant-fstring
)
f"Only the author of the file or an admin can modify/remove it.", | ||
"Only the author of the file or an admin can modify/remove it.", | ||
delete_after=3, | ||
) | ||
|
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 ensure_can_modify
refactored with the following changes:
- Replace f-string with no interpolated values with string (
remove-redundant-fstring
)
soundfont = "audio/x-sfbk" == mime_type or "SoundFont/Bank" in mime_text | ||
soundfont = mime_type == "audio/x-sfbk" or "SoundFont/Bank" in mime_text | ||
if soundfont: | ||
return False, False, True, False, False | ||
audio = mime_type.startswith("audio/") | ||
video = mime_type.startswith("video/") | ||
archive = mime_type in archive_mimetypes | ||
midi = "audio/midi" == mime_type | ||
midi = mime_type == "audio/midi" |
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 check_file
refactored with the following changes:
- Ensure constant in comparison is on the right (
flip-comparison
)
if not "streams" in data: | ||
if "streams" not in data: |
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 get_audio_info
refactored with the following changes:
- Simplify logical expression using De Morgan identities (
de-morgan
)
Thanks for starring sourcery-ai/sourcery ✨ 🌟 ✨
Here's your pull request refactoring your most popular Python repo.
If you want Sourcery to refactor all your Python repos and incoming pull requests install our bot.
Review changes via command line
To manually merge these changes, make sure you're on the
master
branch, then run: