From 51a002bb3fd75f16c560c2b7616c8bf5b510e3e3 Mon Sep 17 00:00:00 2001 From: Myned Date: Fri, 20 Oct 2017 16:23:27 -0400 Subject: [PATCH] 2 > 4 space --- src/main/misc/checks.py | 48 +++++++++++++++++++-------------------- src/main/utils/scraper.py | 30 ++++++++++++------------ 2 files changed, 39 insertions(+), 39 deletions(-) diff --git a/src/main/misc/checks.py b/src/main/misc/checks.py index 261911f..1c080e8 100644 --- a/src/main/misc/checks.py +++ b/src/main/misc/checks.py @@ -14,48 +14,48 @@ owner_id = u.config['owner_id'] def is_owner(): - async def predicate(ctx): - return ctx.message.author.id == owner_id - return commands.check(predicate) + async def predicate(ctx): + return ctx.message.author.id == owner_id + return commands.check(predicate) def is_admin(): - def predicate(ctx): - return ctx.message.author.guild_permissions.administrator - return commands.check(predicate) + def predicate(ctx): + return ctx.message.author.guild_permissions.administrator + return commands.check(predicate) def is_mod(): - def predicate(ctx): - return ctx.message.author.guild_permissions.ban_members - return commands.check(predicate) + def predicate(ctx): + return ctx.message.author.guild_permissions.ban_members + return commands.check(predicate) def owner(ctx): - return ctx.message.author.id == owner_id + return ctx.message.author.id == owner_id def admin(ctx): - return ctx.message.author.guild_permissions.administrator + return ctx.message.author.guild_permissions.administrator def mod(ctx): - return ctx.message.author.guild_permissions.ban_members + return ctx.message.author.guild_permissions.ban_members def is_nsfw(): - def predicate(ctx): - if isinstance(ctx.message.channel, d.TextChannel): - return ctx.message.channel.is_nsfw() - return True - return commands.check(predicate) + def predicate(ctx): + if isinstance(ctx.message.channel, d.TextChannel): + return ctx.message.channel.is_nsfw() + return True + return commands.check(predicate) def del_ctx(): - async def predicate(ctx): - with suppress(AttributeError): - if ctx.guild.id in u.settings['del_ctx'] and ctx.me.permissions_in(ctx.channel).manage_messages and isinstance(ctx.message.channel, d.TextChannel): - with suppress(err.NotFound): - await ctx.message.delete() - return True - return commands.check(predicate) + async def predicate(ctx): + with suppress(AttributeError): + if ctx.guild.id in u.settings['del_ctx'] and ctx.me.permissions_in(ctx.channel).manage_messages and isinstance(ctx.message.channel, d.TextChannel): + with suppress(err.NotFound): + await ctx.message.delete() + return True + return commands.check(predicate) diff --git a/src/main/utils/scraper.py b/src/main/utils/scraper.py index afdac07..1c4fabc 100644 --- a/src/main/utils/scraper.py +++ b/src/main/utils/scraper.py @@ -8,26 +8,26 @@ from utils import utils as u async def get_post(url): - content = await u.fetch('http://iqdb.harry.lu', params={'url': url}) + content = await u.fetch('http://iqdb.harry.lu', params={'url': url}) - try: - value = BeautifulSoup(content, 'html.parser').find_all('a')[1].get('href') - if value != '#': - return value - else: - raise IndexError - except IndexError: try: - raise exc.MatchError(re.search('\/([^\/]+)$', url).group(1)) + value = BeautifulSoup(content, 'html.parser').find_all('a')[1].get('href') + if value != '#': + return value + else: + raise IndexError + except IndexError: + try: + raise exc.MatchError(re.search('\/([^\/]+)$', url).group(1)) - except AttributeError: - raise exc.MissingArgument + except AttributeError: + raise exc.MissingArgument async def get_image(url): - content = await u.fetch(url) + content = await u.fetch(url) - value = html.fromstring(content).xpath( - 'string(/html/body/div[@id="content"]/div[@id="post-view"]/div[@class="content"]/div[2]/img/@src)') + value = html.fromstring(content).xpath( + 'string(/html/body/div[@id="content"]/div[@id="post-view"]/div[@class="content"]/div[2]/img/@src)') - return value + return value