[V3 Travis] Update travis to not skip pipfile lock... (#1678)

* Update travis to not sip pipfile lock

update pipfile dependencies

additional black formatting pass to conform to black 18.5b

* .

* pin async timeout until further discussion of 3.5 support

* .
This commit is contained in:
Michael H
2018-05-18 21:48:22 -04:00
committed by palmtree5
parent 55afc7eb33
commit d3f406a34a
35 changed files with 214 additions and 297 deletions

View File

@@ -21,7 +21,11 @@ class VersionInfo:
my_index = self._levels.index(self.releaselevel)
other_index = self._levels.index(other.releaselevel)
return (self.major, self.minor, self.micro, my_index, self.serial) < (
other.major, other.minor, other.micro, other_index, other.serial
other.major,
other.minor,
other.micro,
other_index,
other.serial,
)
def __repr__(self):

View File

@@ -79,12 +79,10 @@ class RedBase(BotBase, RpcMethodMixin):
return global_prefix
server_prefix = await bot.db.guild(message.guild).prefix()
if cli_flags.mentionable:
return when_mentioned_or(*server_prefix)(
bot, message
) if server_prefix else when_mentioned_or(
*global_prefix
)(
bot, message
return (
when_mentioned_or(*server_prefix)(bot, message)
if server_prefix
else when_mentioned_or(*global_prefix)(bot, message)
)
else:
return server_prefix if server_prefix else global_prefix
@@ -159,9 +157,8 @@ class RedBase(BotBase, RpcMethodMixin):
bool
:code:`True` if an embed is requested
"""
if (
isinstance(channel, discord.abc.PrivateChannel)
or (command and command == self.get_command("help"))
if isinstance(channel, discord.abc.PrivateChannel) or (
command and command == self.get_command("help")
):
user_setting = await self.db.user(user).embeds()
if user_setting is not None:

View File

@@ -19,7 +19,7 @@ def is_owner(**kwargs):
async def check(ctx):
override = await check_overrides(ctx, level="owner")
return (override if override is not None else await ctx.bot.is_owner(ctx.author, **kwargs))
return override if override is not None else await ctx.bot.is_owner(ctx.author, **kwargs)
return commands.check(check)
@@ -113,7 +113,7 @@ def guildowner_or_permissions(**perms):
is_guild_owner = ctx.author == ctx.guild.owner
override = await check_overrides(ctx, level="guildowner")
return (override if override is not None else is_guild_owner or has_perms_or_is_owner)
return override if override is not None else is_guild_owner or has_perms_or_is_owner
return commands.check(predicate)

View File

@@ -348,8 +348,8 @@ class Core:
except Exception as e:
log.exception("Package loading failed", exc_info=e)
exception_log = (
"Exception in command '{}'\n" "".format(ctx.command.qualified_name)
exception_log = "Exception in command '{}'\n" "".format(
ctx.command.qualified_name
)
exception_log += "".join(
traceback.format_exception(type(e), e, e.__traceback__)
@@ -434,9 +434,7 @@ class Core:
except Exception as e:
log.exception("Package reloading failed", exc_info=e)
exception_log = (
"Exception in command '{}'\n" "".format(ctx.command.qualified_name)
)
exception_log = "Exception in command '{}'\n" "".format(ctx.command.qualified_name)
exception_log += "".join(traceback.format_exception(type(e), e, e.__traceback__))
self.bot._last_exception = exception_log
@@ -448,7 +446,7 @@ class Core:
await ctx.send(_(formed))
if failed_packages:
fmt = ("Failed to reload package{plural} {packs}. Check your " "logs for details")
fmt = "Failed to reload package{plural} {packs}. Check your " "logs for details"
formed = self.get_package_strings(failed_packages, fmt)
await ctx.send(_(formed))
@@ -694,9 +692,7 @@ class Core:
"only do it up to 2 times an hour. Use "
"nicknames if you need frequent changes. "
"`{}set nickname`"
).format(
ctx.prefix
)
).format(ctx.prefix)
)
else:
await ctx.send(_("Done."))
@@ -799,9 +795,7 @@ class Core:
" it is recommended to reset it right now. Go to the following link and"
" select `Reveal Token` and `Generate a new token?`."
"\n\nhttps://discordapp.com/developers/applications/me/{}"
).format(
self.bot.user.id
)
).format(self.bot.user.id)
)
return
@@ -948,7 +942,7 @@ class Core:
else:
await ctx.send(_("Your message has been sent."))
else:
msg_text = ("{}\nMessage:\n\n{}\n{}".format(description, message, footer))
msg_text = "{}\nMessage:\n\n{}\n{}".format(description, message, footer)
try:
await owner.send("{}\n{}".format(content, box(msg_text)))
except discord.InvalidArgument:

View File

@@ -214,7 +214,7 @@ def init_events(bot, cli_flags):
"logs for details."
"".format(ctx.command.qualified_name)
)
exception_log = ("Exception in command '{}'\n" "".format(ctx.command.qualified_name))
exception_log = "Exception in command '{}'\n" "".format(ctx.command.qualified_name)
exception_log += "".join(
traceback.format_exception(type(error), error, error.__traceback__)
)

View File

@@ -110,8 +110,11 @@ class Help(formatter.HelpFormatter):
def get_ending_note(self):
# command_name = self.context.invoked_with
return "Type {0}help <command> for more info on a command.\n" "You can also type {0}help <category> for more info on a category.".format(
self.clean_prefix
return (
"Type {0}help <command> for more info on a command.\n"
"You can also type {0}help <category> for more info on a category.".format(
self.clean_prefix
)
)
async def format(self) -> dict:

View File

@@ -55,7 +55,7 @@ def _parse(translation_file):
# Don't check if step is WAITING_FOR_MSGID
untranslated = ""
translated = ""
data = line[len(MSGID):-1]
data = line[len(MSGID) : -1]
if len(data) == 0: # Multiline mode
step = IN_MSGID
else:
@@ -70,7 +70,7 @@ def _parse(translation_file):
step = WAITING_FOR_MSGSTR
if step is WAITING_FOR_MSGSTR and line.startswith(MSGSTR):
data = line[len(MSGSTR):-1]
data = line[len(MSGSTR) : -1]
if len(data) == 0: # Multiline mode
step = IN_MSGSTR
else:
@@ -109,8 +109,8 @@ def _normalize(string, remove_newline=False):
"""Normalizes the whitespace in a string; \s+ becomes one space."""
if not s:
return str(s) # not the same reference
starts_with_space = (s[0] in " \n\t\r")
ends_with_space = (s[-1] in " \n\t\r")
starts_with_space = s[0] in " \n\t\r"
ends_with_space = s[-1] in " \n\t\r"
if remove_newline:
newline_re = re.compile("[\r\n]+")
s = " ".join(filter(bool, newline_re.split(s)))

View File

@@ -36,9 +36,10 @@ class AntiSpam:
self.__discard_after = max([x.period for x in self.__intervals])
def __interval_check(self, interval: AntiSpamInterval):
return len(
[t for t in self.__event_timestamps if (t + interval.period) > datetime.utcnow()]
) >= interval.frequency
return (
len([t for t in self.__event_timestamps if (t + interval.period) > datetime.utcnow()])
>= interval.frequency
)
@property
def spammy(self):

View File

@@ -235,8 +235,8 @@ def pagify(
while len(in_text) > page_length:
this_page_len = page_length
if escape_mass_mentions:
this_page_len -= (
in_text.count("@here", 0, page_length) + in_text.count("@everyone", 0, page_length)
this_page_len -= in_text.count("@here", 0, page_length) + in_text.count(
"@everyone", 0, page_length
)
closest_delim = (in_text.rfind(d, 1, this_page_len) for d in delims)
if priority:
@@ -315,7 +315,5 @@ def escape(text: str, *, mass_mentions: bool = False, formatting: bool = False)
text = text.replace("@everyone", "@\u200beveryone")
text = text.replace("@here", "@\u200bhere")
if formatting:
text = (
text.replace("`", "\\`").replace("*", "\\*").replace("_", "\\_").replace("~", "\\~")
)
text = text.replace("`", "\\`").replace("*", "\\*").replace("_", "\\_").replace("~", "\\~")
return text

View File

@@ -52,9 +52,8 @@ async def menu(
RuntimeError
If either of the notes above are violated
"""
if (
not all(isinstance(x, discord.Embed) for x in pages)
and not all(isinstance(x, str) for x in pages)
if not all(isinstance(x, discord.Embed) for x in pages) and not all(
isinstance(x, str) for x in pages
):
raise RuntimeError("All pages must be of the same type")
for key, value in controls.items():

View File

@@ -79,10 +79,10 @@ def get_audit_reason(author: discord.Member, reason: str = None):
The formatted audit log reason.
"""
return "Action requested by {} (ID {}). Reason: {}".format(
author, author.id, reason
) if reason else "Action requested by {} (ID {}).".format(
author, author.id
return (
"Action requested by {} (ID {}). Reason: {}".format(author, author.id, reason)
if reason
else "Action requested by {} (ID {}).".format(author, author.id)
)