Reformat with Black 22.1.0

This commit is contained in:
jack1142 2022-03-22 18:06:46 +01:00
parent f6d9632c8f
commit c69e8d31fd
39 changed files with 25 additions and 78 deletions

View File

@ -96,7 +96,6 @@ class Admin(commands.Cog):
return return
async def handle_migrations(self): async def handle_migrations(self):
lock = self.config.get_guilds_lock() lock = self.config.get_guilds_lock()
async with lock: async with lock:
# This prevents the edge case of someone loading admin, # This prevents the edge case of someone loading admin,
@ -110,7 +109,6 @@ class Admin(commands.Cog):
self._ready.set() self._ready.set()
async def migrate_config_from_0_to_1(self): async def migrate_config_from_0_to_1(self):
all_guilds = await self.config.all_guilds() all_guilds = await self.config.all_guilds()
for guild_id, guild_data in all_guilds.items(): for guild_id, guild_data in all_guilds.items():

View File

@ -94,12 +94,10 @@ class Alias(commands.Cog):
all_guild_aliases = await self.config.all_guilds() all_guild_aliases = await self.config.all_guilds()
for guild_id, guild_data in all_guild_aliases.items(): for guild_id, guild_data in all_guild_aliases.items():
to_set = [] to_set = []
modified = False modified = False
for a in guild_data.get("entries", []): for a in guild_data.get("entries", []):
for keyname in ("creator", "guild"): for keyname in ("creator", "guild"):
if isinstance((val := a.get(keyname)), str): if isinstance((val := a.get(keyname)), str):
try: try:
@ -482,7 +480,6 @@ class Alias(commands.Cog):
@commands.Cog.listener() @commands.Cog.listener()
async def on_message_without_command(self, message: discord.Message): async def on_message_without_command(self, message: discord.Message):
await self._ready_event.wait() await self._ready_event.wait()
if message.guild is not None: if message.guild is not None:

View File

@ -67,7 +67,6 @@ class AliasEntry:
return extra return extra
def to_json(self) -> dict: def to_json(self) -> dict:
return { return {
"name": self.name, "name": self.name,
"command": self.command, "command": self.command,
@ -91,7 +90,6 @@ class AliasCache:
self._aliases: Dict[Optional[int], Dict[str, AliasEntry]] = {None: {}} self._aliases: Dict[Optional[int], Dict[str, AliasEntry]] = {None: {}}
async def anonymize_aliases(self, user_id: int): async def anonymize_aliases(self, user_id: int):
async with self.config.entries() as global_aliases: async with self.config.entries() as global_aliases:
for a in global_aliases: for a in global_aliases:
if a.get("creator", 0) == user_id: if a.get("creator", 0) == user_id:

View File

@ -182,7 +182,6 @@ class PlaylistCompat23:
tracks: Optional[List[MutableMapping]] = None, tracks: Optional[List[MutableMapping]] = None,
guild: Union[discord.Guild, int, None] = None, guild: Union[discord.Guild, int, None] = None,
): ):
self.bot = bot self.bot = bot
self.guild = guild self.guild = guild
self.scope = standardize_scope(scope) self.scope = standardize_scope(scope)

View File

@ -192,7 +192,6 @@ class ScopeParser(commands.Converter):
async def convert( async def convert(
self, ctx: commands.Context, argument: str self, ctx: commands.Context, argument: str
) -> Tuple[Optional[str], discord.User, Optional[discord.Guild], bool]: ) -> Tuple[Optional[str], discord.User, Optional[discord.Guild], bool]:
target_scope: Optional[str] = None target_scope: Optional[str] = None
target_user: Optional[Union[discord.Member, discord.User]] = None target_user: Optional[Union[discord.Member, discord.User]] = None
target_guild: Optional[discord.Guild] = None target_guild: Optional[discord.Guild] = None
@ -302,7 +301,6 @@ class ComplexScopeParser(commands.Converter):
Optional[discord.Guild], Optional[discord.Guild],
bool, bool,
]: ]:
target_scope: Optional[str] = None target_scope: Optional[str] = None
target_user: Optional[Union[discord.Member, discord.User]] = None target_user: Optional[Union[discord.Member, discord.User]] = None
target_guild: Optional[discord.Guild] = None target_guild: Optional[discord.Guild] = None

View File

@ -244,7 +244,7 @@ class EqualizerCommands(MixinMeta, metaclass=CompositeMetaClass):
eq_name_msg = await self.bot.wait_for( eq_name_msg = await self.bot.wait_for(
"message", "message",
timeout=15.0, timeout=15.0,
check=MessagePredicate.regex(fr"^(?!{re.escape(ctx.prefix)})", ctx), check=MessagePredicate.regex(rf"^(?!{re.escape(ctx.prefix)})", ctx),
) )
eq_preset = eq_name_msg.content.split(" ")[0].strip('"').lower() eq_preset = eq_name_msg.content.split(" ")[0].strip('"').lower()
except asyncio.TimeoutError: except asyncio.TimeoutError:

View File

@ -224,7 +224,6 @@ class PlaylistCommands(MixinMeta, metaclass=CompositeMetaClass):
*, *,
scope_data: ComplexScopeParser = None, scope_data: ComplexScopeParser = None,
): ):
"""Copy a playlist from one scope to another. """Copy a playlist from one scope to another.
**Usage**: **Usage**:
@ -962,7 +961,6 @@ class PlaylistCommands(MixinMeta, metaclass=CompositeMetaClass):
scope, author, guild, specified_user = scope_data scope, author, guild, specified_user = scope_data
async with ctx.typing(): async with ctx.typing():
if scope is None: if scope is None:
global_matches = await get_all_playlist( global_matches = await get_all_playlist(
scope=PlaylistScope.GLOBAL.value, scope=PlaylistScope.GLOBAL.value,
bot=self.bot, bot=self.bot,

View File

@ -31,7 +31,6 @@ class RedEvents(MixinMeta, metaclass=CompositeMetaClass):
requester: Literal["discord_deleted_user", "owner", "user", "user_strict"], requester: Literal["discord_deleted_user", "owner", "user", "user_strict"],
user_id: int, user_id: int,
): ):
await self.cog_ready_event.wait() await self.cog_ready_event.wait()
if requester in ("discord_deleted_user", "owner"): if requester in ("discord_deleted_user", "owner"):

View File

@ -167,7 +167,6 @@ class FormattingUtilities(MixinMeta, metaclass=CompositeMetaClass):
ctx, title=_("This track is not allowed in this server.") ctx, title=_("This track is not allowed in this server.")
) )
elif guild_data["maxlength"] > 0: elif guild_data["maxlength"] > 0:
if self.is_track_length_allowed(search_choice, guild_data["maxlength"]): if self.is_track_length_allowed(search_choice, guild_data["maxlength"]):
search_choice.extras.update( search_choice.extras.update(
{ {

View File

@ -11,7 +11,7 @@ from ..cog_utils import CompositeMetaClass
log = getLogger("red.cogs.Audio.cog.Utilities.Parsing") log = getLogger("red.cogs.Audio.cog.Utilities.Parsing")
STREAM_TITLE: Final[re.Pattern] = re.compile(br"StreamTitle='([^']*)';") STREAM_TITLE: Final[re.Pattern] = re.compile(rb"StreamTitle='([^']*)';")
class ParsingUtilities(MixinMeta, metaclass=CompositeMetaClass): class ParsingUtilities(MixinMeta, metaclass=CompositeMetaClass):

View File

@ -676,7 +676,6 @@ class PlaylistUtilities(MixinMeta, metaclass=CompositeMetaClass):
def humanize_scope( def humanize_scope(
self, scope: str, ctx: Union[discord.Guild, discord.abc.User, str] = None, the: bool = None self, scope: str, ctx: Union[discord.Guild, discord.abc.User, str] = None, the: bool = None
) -> Optional[str]: ) -> Optional[str]:
if scope == PlaylistScope.GLOBAL.value: if scope == PlaylistScope.GLOBAL.value:
return _("the Global") if the else _("Global") return _("the Global") if the else _("Global")
elif scope == PlaylistScope.GUILD.value: elif scope == PlaylistScope.GUILD.value:

View File

@ -155,7 +155,7 @@ class Cleanup(commands.Cog):
resolved = reference.resolved resolved = reference.resolved
if resolved and isinstance(resolved, discord.Message): if resolved and isinstance(resolved, discord.Message):
message = resolved message = resolved
elif (message := reference.cached_message) : elif message := reference.cached_message:
pass pass
else: else:
try: try:

View File

@ -59,7 +59,6 @@ class CommandObj:
return {k: v for k, v in _commands.items() if _commands[k]} return {k: v for k, v in _commands.items() if _commands[k]}
async def redact_author_ids(self, user_id: int): async def redact_author_ids(self, user_id: int):
all_guilds = await self.config.all_guilds() all_guilds = await self.config.all_guilds()
for guild_id in all_guilds.keys(): for guild_id in all_guilds.keys():

View File

@ -349,7 +349,6 @@ class Economy(commands.Cog):
).format(author=author, time=dtime) ).format(author=author, time=dtime)
) )
else: else:
# Gets the users latest successfully payday and adds the guilds payday time # Gets the users latest successfully payday and adds the guilds payday time
next_payday = ( next_payday = (
await self.config.member(author).next_payday() await self.config.member(author).next_payday()

View File

@ -399,7 +399,6 @@ class Filter(commands.Cog):
async def filter_hits( async def filter_hits(
self, text: str, server_or_channel: Union[discord.Guild, discord.TextChannel] self, text: str, server_or_channel: Union[discord.Guild, discord.TextChannel]
) -> Set[str]: ) -> Set[str]:
try: try:
guild = server_or_channel.guild guild = server_or_channel.guild
channel = server_or_channel channel = server_or_channel
@ -528,7 +527,6 @@ class Filter(commands.Cog):
await self.maybe_filter_name(member) await self.maybe_filter_name(member)
async def maybe_filter_name(self, member: discord.Member): async def maybe_filter_name(self, member: discord.Member):
guild = member.guild guild = member.guild
if (not guild) or await self.bot.cog_disabled_in_guild(self, guild): if (not guild) or await self.bot.cog_disabled_in_guild(self, guild):
return return

View File

@ -226,7 +226,6 @@ class ModInfo(MixinMeta):
status_string = self.get_status_string(member) status_string = self.get_status_string(member)
if roles: if roles:
role_str = ", ".join([x.mention for x in roles]) role_str = ", ".join([x.mention for x in roles])
# 400 BAD REQUEST (error code: 50035): Invalid Form Body # 400 BAD REQUEST (error code: 50035): Invalid Form Body
# In embed.fields.2.value: Must be 1024 or fewer in length. # In embed.fields.2.value: Must be 1024 or fewer in length.

View File

@ -1065,7 +1065,6 @@ class Mutes(VoiceMutes, commands.Cog, metaclass=CompositeMetaClass):
if ctx.guild.id in self._server_mutes: if ctx.guild.id in self._server_mutes:
mutes_data = self._server_mutes[ctx.guild.id] mutes_data = self._server_mutes[ctx.guild.id]
if mutes_data: if mutes_data:
msg += _("__Server Mutes__\n") msg += _("__Server Mutes__\n")
for user_id, mutes in mutes_data.items(): for user_id, mutes in mutes_data.items():
if not mutes: if not mutes:
@ -1528,7 +1527,6 @@ class Mutes(VoiceMutes, commands.Cog, metaclass=CompositeMetaClass):
mute_role = await self.config.guild(guild).mute_role() mute_role = await self.config.guild(guild).mute_role()
if mute_role: if mute_role:
role = guild.get_role(mute_role) role = guild.get_role(mute_role)
if not role: if not role:
ret["reason"] = _(MUTE_UNMUTE_ISSUES["role_missing"]) ret["reason"] = _(MUTE_UNMUTE_ISSUES["role_missing"])
@ -1601,8 +1599,8 @@ class Mutes(VoiceMutes, commands.Cog, metaclass=CompositeMetaClass):
if not await self.is_allowed_by_hierarchy(guild, author, user): if not await self.is_allowed_by_hierarchy(guild, author, user):
ret["reason"] = _(MUTE_UNMUTE_ISSUES["hierarchy_problem"]) ret["reason"] = _(MUTE_UNMUTE_ISSUES["hierarchy_problem"])
return ret return ret
if mute_role:
if mute_role:
role = guild.get_role(mute_role) role = guild.get_role(mute_role)
if not role: if not role:
ret["reason"] = _(MUTE_UNMUTE_ISSUES["role_missing"]) ret["reason"] = _(MUTE_UNMUTE_ISSUES["role_missing"])

View File

@ -55,7 +55,6 @@ class VoiceMutes(MixinMeta):
ctx.permission_state is commands.PermState.NORMAL ctx.permission_state is commands.PermState.NORMAL
and not voice_channel.permissions_for(ctx.author) >= required_perms and not voice_channel.permissions_for(ctx.author) >= required_perms
): ):
return ( return (
False, False,
_( _(

View File

@ -131,7 +131,6 @@ class Permissions(commands.Cog):
# there's a below recast to int where needed for guild ids # there's a below recast to int where needed for guild ids
for typename, getter in ((COG, self.bot.get_cog), (COMMAND, self.bot.get_command)): for typename, getter in ((COG, self.bot.get_cog), (COMMAND, self.bot.get_command)):
obj_type_rules = await self.config.custom(typename).all() obj_type_rules = await self.config.custom(typename).all()
count += 1 count += 1
@ -139,7 +138,6 @@ class Permissions(commands.Cog):
await asyncio.sleep(0) await asyncio.sleep(0)
for obj_name, rules_dict in obj_type_rules.items(): for obj_name, rules_dict in obj_type_rules.items():
count += 1 count += 1
if not count % 100: if not count % 100:
await asyncio.sleep(0) await asyncio.sleep(0)
@ -147,7 +145,6 @@ class Permissions(commands.Cog):
obj = getter(obj_name) obj = getter(obj_name)
for guild_id, guild_rules in rules_dict.items(): for guild_id, guild_rules in rules_dict.items():
count += 1 count += 1
if not count % 100: if not count % 100:
await asyncio.sleep(0) await asyncio.sleep(0)

View File

@ -356,11 +356,9 @@ class Reports(commands.Cog):
@commands.Cog.listener() @commands.Cog.listener()
async def on_message(self, message: discord.Message): async def on_message(self, message: discord.Message):
to_remove = [] to_remove = []
for k, v in self.tunnel_store.items(): for k, v in self.tunnel_store.items():
guild, ticket_number = k guild, ticket_number = k
if await self.bot.cog_disabled_in_guild(self, guild): if await self.bot.cog_disabled_in_guild(self, guild):
to_remove.append(k) to_remove.append(k)

View File

@ -263,7 +263,6 @@ class YoutubeStream(Stream):
return snippet["title"] return snippet["title"]
async def _fetch_channel_resource(self, resource: str): async def _fetch_channel_resource(self, resource: str):
params = {"key": self._token["api_key"], "part": resource} params = {"key": self._token["api_key"], "part": resource}
if resource == "id": if resource == "id":
params["forUsername"] = self.name params["forUsername"] = self.name
@ -334,8 +333,8 @@ class TwitchStream(Stream):
""" """
current_time = int(time.time()) current_time = int(time.time())
self._rate_limit_resets = {x for x in self._rate_limit_resets if x > current_time} self._rate_limit_resets = {x for x in self._rate_limit_resets if x > current_time}
if self._rate_limit_remaining == 0:
if self._rate_limit_remaining == 0:
if self._rate_limit_resets: if self._rate_limit_resets:
reset_time = next(iter(self._rate_limit_resets)) reset_time = next(iter(self._rate_limit_resets))
# Calculate wait time and add 0.1s to the wait time to allow Twitch to reset # Calculate wait time and add 0.1s to the wait time to allow Twitch to reset

View File

@ -661,7 +661,6 @@ class Command(CogCommandMixin, DPYCommand):
@a_command.error @a_command.error
async def a_command_error_handler(self, ctx, error): async def a_command_error_handler(self, ctx, error):
if isinstance(error.original, MyErrorType): if isinstance(error.original, MyErrorType):
self.log_exception(error.original) self.log_exception(error.original)
else: else:

View File

@ -360,7 +360,6 @@ if TYPE_CHECKING or os.getenv("BUILDING_DOCS", False):
def me(self) -> discord.Member: def me(self) -> discord.Member:
... ...
else: else:
GuildContext = Context GuildContext = Context
DMContext = Context DMContext = Context

View File

@ -274,7 +274,6 @@ if TYPE_CHECKING:
def get_dict_converter(*expected_keys: str, delims: Optional[List[str]] = None) -> Type[dict]: def get_dict_converter(*expected_keys: str, delims: Optional[List[str]] = None) -> Type[dict]:
... ...
else: else:
def get_dict_converter(*expected_keys: str, delims: Optional[List[str]] = None) -> Type[dict]: def get_dict_converter(*expected_keys: str, delims: Optional[List[str]] = None) -> Type[dict]:
@ -354,7 +353,6 @@ if TYPE_CHECKING:
) -> Type[timedelta]: ) -> Type[timedelta]:
... ...
else: else:
def get_timedelta_converter( def get_timedelta_converter(

View File

@ -306,7 +306,6 @@ class RedHelpFormatter(HelpFormatterABC):
async def format_command_help( async def format_command_help(
self, ctx: Context, obj: commands.Command, help_settings: HelpSettings self, ctx: Context, obj: commands.Command, help_settings: HelpSettings
): ):
send = help_settings.verify_exists send = help_settings.verify_exists
if not send: if not send:
async for __ in self.help_filter_func( async for __ in self.help_filter_func(
@ -450,7 +449,6 @@ class RedHelpFormatter(HelpFormatterABC):
@staticmethod @staticmethod
def group_embed_fields(fields: List[EmbedField], max_chars=1000): def group_embed_fields(fields: List[EmbedField], max_chars=1000):
curr_group = [] curr_group = []
ret = [] ret = []
current_count = 0 current_count = 0
@ -473,7 +471,6 @@ class RedHelpFormatter(HelpFormatterABC):
return ret return ret
async def make_and_send_embeds(self, ctx, embed_dict: dict, help_settings: HelpSettings): async def make_and_send_embeds(self, ctx, embed_dict: dict, help_settings: HelpSettings):
pages = [] pages = []
page_char_limit = help_settings.page_char_limit page_char_limit = help_settings.page_char_limit
@ -544,7 +541,6 @@ class RedHelpFormatter(HelpFormatterABC):
await self.send_pages(ctx, pages, embed=True, help_settings=help_settings) await self.send_pages(ctx, pages, embed=True, help_settings=help_settings)
async def format_cog_help(self, ctx: Context, obj: commands.Cog, help_settings: HelpSettings): async def format_cog_help(self, ctx: Context, obj: commands.Cog, help_settings: HelpSettings):
coms = await self.get_cog_help_mapping(ctx, obj, help_settings=help_settings) coms = await self.get_cog_help_mapping(ctx, obj, help_settings=help_settings)
if not (coms or help_settings.verify_exists): if not (coms or help_settings.verify_exists):
return return
@ -613,7 +609,6 @@ class RedHelpFormatter(HelpFormatterABC):
await self.send_pages(ctx, pages, embed=False, help_settings=help_settings) await self.send_pages(ctx, pages, embed=False, help_settings=help_settings)
async def format_bot_help(self, ctx: Context, help_settings: HelpSettings): async def format_bot_help(self, ctx: Context, help_settings: HelpSettings):
coms = await self.get_bot_help_mapping(ctx, help_settings=help_settings) coms = await self.get_bot_help_mapping(ctx, help_settings=help_settings)
if not coms: if not coms:
return return
@ -622,7 +617,6 @@ class RedHelpFormatter(HelpFormatterABC):
tagline = (help_settings.tagline) or self.get_default_tagline(ctx) tagline = (help_settings.tagline) or self.get_default_tagline(ctx)
if await self.embed_requested(ctx): if await self.embed_requested(ctx):
emb = {"embed": {"title": "", "description": ""}, "footer": {"text": ""}, "fields": []} emb = {"embed": {"title": "", "description": ""}, "footer": {"text": ""}, "fields": []}
emb["footer"]["text"] = tagline emb["footer"]["text"] = tagline
@ -630,7 +624,6 @@ class RedHelpFormatter(HelpFormatterABC):
emb["embed"]["title"] = f"*{description[:250]}*" emb["embed"]["title"] = f"*{description[:250]}*"
for cog_name, data in coms: for cog_name, data in coms:
if cog_name: if cog_name:
title = underline(bold(f"{cog_name}:"), escape_formatting=False) title = underline(bold(f"{cog_name}:"), escape_formatting=False)
else: else:
@ -676,7 +669,6 @@ class RedHelpFormatter(HelpFormatterABC):
yield nm, doc, max_width - width_gap yield nm, doc, max_width - width_gap
for cog_name, data in coms: for cog_name, data in coms:
title = f"{cog_name}:" if cog_name else _("No Category:") title = f"{cog_name}:" if cog_name else _("No Category:")
to_join.append(title) to_join.append(title)
@ -830,7 +822,6 @@ class RedHelpFormatter(HelpFormatterABC):
and channel_permissions.read_message_history and channel_permissions.read_message_history
and help_settings.use_menus and help_settings.use_menus
): ):
max_pages_in_guild = help_settings.max_pages_in_guild max_pages_in_guild = help_settings.max_pages_in_guild
use_DMs = len(pages) > max_pages_in_guild use_DMs = len(pages) > max_pages_in_guild
destination = ctx.author if use_DMs else ctx.channel destination = ctx.author if use_DMs else ctx.channel
@ -862,7 +853,6 @@ class RedHelpFormatter(HelpFormatterABC):
and delete_delay > 0 # delete delay is enabled and delete_delay > 0 # delete delay is enabled
and channel_permissions.manage_messages # we can manage messages here and channel_permissions.manage_messages # we can manage messages here
): ):
# We need to wrap this in a task to not block after-sending-help interactions. # We need to wrap this in a task to not block after-sending-help interactions.
# The channel has to be TextChannel as we can't bulk-delete from DMs # The channel has to be TextChannel as we can't bulk-delete from DMs
async def _delete_delay_help( async def _delete_delay_help(

View File

@ -268,7 +268,6 @@ PermStateAllowedStates = (
def transition_permstate_to(prev: PermState, next_state: PermState) -> TransitionResult: def transition_permstate_to(prev: PermState, next_state: PermState) -> TransitionResult:
# Transforms here are used so that the # Transforms here are used so that the
# informational ALLOWED_BY_HOOK/DENIED_BY_HOOK # informational ALLOWED_BY_HOOK/DENIED_BY_HOOK
# remain, while retaining the behavior desired. # remain, while retaining the behavior desired.

View File

@ -645,7 +645,6 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
) )
async def get_serious_confirmation(self, ctx: commands.Context, prompt: str) -> bool: async def get_serious_confirmation(self, ctx: commands.Context, prompt: str) -> bool:
confirm_token = "".join(random.choices((*ascii_letters, *digits), k=8)) confirm_token = "".join(random.choices((*ascii_letters, *digits), k=8))
await ctx.send(f"{prompt}\n\n{confirm_token}") await ctx.send(f"{prompt}\n\n{confirm_token}")
@ -4002,9 +4001,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
) )
else: else:
successful = True successful = True
else: else:
msg_text = "{}\nMessage:\n\n{}\n{}".format(description, message, footer) msg_text = "{}\nMessage:\n\n{}\n{}".format(description, message, footer)
try: try:

View File

@ -198,7 +198,6 @@ def init_events(bot, cli_flags):
@bot.event @bot.event
async def on_command_error(ctx, error, unhandled_by_cog=False): async def on_command_error(ctx, error, unhandled_by_cog=False):
if not unhandled_by_cog: if not unhandled_by_cog:
if hasattr(ctx.command, "on_error"): if hasattr(ctx.command, "on_error"):
return return

View File

@ -98,7 +98,6 @@ async def _init(bot: Red):
await register_casetypes(all_generics) await register_casetypes(all_generics)
async def on_member_ban(guild: discord.Guild, member: discord.Member): async def on_member_ban(guild: discord.Guild, member: discord.Member):
if not guild.me.guild_permissions.view_audit_log: if not guild.me.guild_permissions.view_audit_log:
return return

View File

@ -178,7 +178,6 @@ class IgnoreManager:
async def set_ignored_channel( async def set_ignored_channel(
self, channel: Union[discord.TextChannel, discord.CategoryChannel], set_to: bool self, channel: Union[discord.TextChannel, discord.CategoryChannel], set_to: bool
): ):
cid: int = channel.id cid: int = channel.id
self._cached_channels[cid] = set_to self._cached_channels[cid] = set_to
if set_to: if set_to:
@ -200,7 +199,6 @@ class IgnoreManager:
return ret return ret
async def set_ignored_guild(self, guild: discord.Guild, set_to: bool): async def set_ignored_guild(self, guild: discord.Guild, set_to: bool):
gid: int = guild.id gid: int = guild.id
self._cached_guilds[gid] = set_to self._cached_guilds[gid] = set_to
if set_to: if set_to:
@ -221,9 +219,7 @@ class WhitelistBlacklistManager:
self._access_lock = asyncio.Lock() self._access_lock = asyncio.Lock()
async def discord_deleted_user(self, user_id: int): async def discord_deleted_user(self, user_id: int):
async with self._access_lock: async with self._access_lock:
async for guild_id_or_none, ids in AsyncIter( async for guild_id_or_none, ids in AsyncIter(
self._cached_whitelist.items(), steps=100 self._cached_whitelist.items(), steps=100
): ):