[V3] Update code standards (black code format pass) (#1650)

* ran black: code formatter against `redbot/` with `-l 99`

* badge
This commit is contained in:
Michael H
2018-05-14 15:33:24 -04:00
committed by Will
parent e7476edd68
commit b88b5a2601
90 changed files with 3629 additions and 3223 deletions

View File

@@ -5,7 +5,7 @@ from redbot.core.bot import Red
from redbot.core.i18n import Translator, cog_i18n
from redbot.core.utils.chat_formatting import box
_ = Translator('ModLog', __file__)
_ = Translator("ModLog", __file__)
@cog_i18n(_)
@@ -32,15 +32,12 @@ class ModLog:
if channel:
if channel.permissions_for(guild.me).send_messages:
await modlog.set_modlog_channel(guild, channel)
await ctx.send(
_("Mod events will be sent to {}").format(
channel.mention
)
)
await ctx.send(_("Mod events will be sent to {}").format(channel.mention))
else:
await ctx.send(
_("I do not have permissions to "
"send messages in {}!").format(channel.mention)
_("I do not have permissions to " "send messages in {}!").format(
channel.mention
)
)
else:
try:
@@ -51,7 +48,7 @@ class ModLog:
await modlog.set_modlog_channel(guild, None)
await ctx.send(_("Mod log deactivated."))
@modlogset.command(name='cases')
@modlogset.command(name="cases")
@commands.guild_only()
async def set_cases(self, ctx: commands.Context, action: str = None):
"""Enables or disables case creation for each type of mod action"""
@@ -64,8 +61,8 @@ class ModLog:
msg = ""
for ct in casetypes:
enabled = await ct.is_enabled()
value = 'enabled' if enabled else 'disabled'
msg += '%s : %s\n' % (ct.name, value)
value = "enabled" if enabled else "disabled"
msg += "%s : %s\n" % (ct.name, value)
msg = title + "\n" + box(msg)
await ctx.send(msg)
@@ -79,8 +76,8 @@ class ModLog:
await casetype.set_enabled(True if not enabled else False)
msg = (
_('Case creation for {} actions is now {}.').format(
action, 'enabled' if not enabled else 'disabled'
_("Case creation for {} actions is now {}.").format(
action, "enabled" if not enabled else "disabled"
)
)
await ctx.send(msg)
@@ -133,8 +130,10 @@ class ModLog:
if audit_type:
audit_case = None
async for entry in guild.audit_logs(action=audit_type):
if entry.target.id == case_before.user.id and \
entry.action == audit_type:
if (
entry.target.id == case_before.user.id
and entry.action == audit_type
):
audit_case = entry
break
if audit_case:
@@ -145,9 +144,7 @@ class ModLog:
if not (is_guild_owner or is_case_author or author_is_mod):
await ctx.send(_("You are not authorized to modify that case!"))
return
to_modify = {
"reason": reason,
}
to_modify = {"reason": reason}
if case_before.moderator != author:
to_modify["amended_by"] = author
to_modify["modified_at"] = ctx.message.created_at.timestamp()