From 02e7672623dd1aea11a715e5187eaef7f8633d17 Mon Sep 17 00:00:00 2001 From: Leon Sandøy Date: Fri, 24 Jul 2020 10:42:09 +0200 Subject: More explicit dict indexing Addresses reviews from MarkKoz Co-authored-by: Mark --- bot/cogs/antimalware.py | 2 +- bot/cogs/filtering.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bot/cogs/antimalware.py b/bot/cogs/antimalware.py index 38ff1133d..5b56f937f 100644 --- a/bot/cogs/antimalware.py +++ b/bot/cogs/antimalware.py @@ -40,7 +40,7 @@ class AntiMalware(Cog): def _get_whitelisted_file_formats(self) -> list: """Get the file formats currently on the whitelist.""" - return [item.get('content') for item in self.bot.allow_deny_list_cache['file_format.True']] + return [item['content'] for item in self.bot.allow_deny_list_cache['file_format.True']] def _get_disallowed_extensions(self, message: Message) -> t.Iterable[str]: """Get an iterable containing all the disallowed extensions of attachments.""" diff --git a/bot/cogs/filtering.py b/bot/cogs/filtering.py index 98a60f489..8897cbaf9 100644 --- a/bot/cogs/filtering.py +++ b/bot/cogs/filtering.py @@ -104,9 +104,9 @@ class Filtering(Cog): items = self.bot.allow_deny_list_cache.get(f"{list_type.upper()}.{allowed}", []) if compiled: - return [re.compile(fr'{item.get("content")}', flags=re.IGNORECASE) for item in items] + return [re.compile(fr'{item["content"]}', flags=re.IGNORECASE) for item in items] else: - return [item.get("content") for item in items] + return [item["content"] for item in items] @staticmethod def _expand_spoilers(text: str) -> str: -- cgit v1.2.3