black run

This commit is contained in:
Luna 2021-06-25 15:19:38 -03:00
parent 2492d55f30
commit 1d2df14527
7 changed files with 20 additions and 9 deletions

View File

@ -131,8 +131,8 @@ async def remove_ban(guild_id, banned_id):
async def get_prune(guild_id: int, days: int) -> list: async def get_prune(guild_id: int, days: int) -> list:
"""Get all members in a guild that: """Get all members in a guild that:
- did not login in ``days`` days. - did not login in ``days`` days.
- don't have any roles. - don't have any roles.
""" """
# a good solution would be in pure sql. # a good solution would be in pure sql.
member_ids = await app.db.fetch( member_ids = await app.db.fetch(

View File

@ -307,7 +307,10 @@ async def delete_guild_role(guild_id, role_id):
await app.dispatcher.guild.dispatch( await app.dispatcher.guild.dispatch(
guild_id, guild_id,
("GUILD_ROLE_DELETE", {"guild_id": str(guild_id), "role_id": str(role_id)},), (
"GUILD_ROLE_DELETE",
{"guild_id": str(guild_id), "role_id": str(role_id)},
),
) )
return "", 204 return "", 204

View File

@ -54,7 +54,11 @@ async def remove_member(guild_id: int, member_id: int):
await app.dispatcher.guild.unsub(guild_id, member_id) await app.dispatcher.guild.unsub(guild_id, member_id)
await app.lazy_guild.remove_member(guild_id, user["id"]) await app.lazy_guild.remove_member(guild_id, user["id"])
await app.dispatcher.guild.dispatch( await app.dispatcher.guild.dispatch(
guild_id, ("GUILD_MEMBER_REMOVE", {"guild_id": str(guild_id), "user": user},), guild_id,
(
"GUILD_MEMBER_REMOVE",
{"guild_id": str(guild_id), "user": user},
),
) )

View File

@ -382,8 +382,7 @@ class GatewayWebsocket:
app.sched.spawn(self._guild_dispatch(guilds)) app.sched.spawn(self._guild_dispatch(guilds))
async def _check_shards(self, shard, user_id): async def _check_shards(self, shard, user_id):
"""Check if the given `shard` value in IDENTIFY has good enough values. """Check if the given `shard` value in IDENTIFY has good enough values."""
"""
current_shard, shard_count = shard current_shard, shard_count = shard
guilds = await self.app.db.fetchval( guilds = await self.app.db.fetchval(

View File

@ -206,7 +206,8 @@ class PresenceManager:
user = await self.storage.get_user(user_id) user = await self.storage.get_user(user_id)
await app.dispatcher.friend.dispatch( await app.dispatcher.friend.dispatch(
user_id, ("PRESENCE_UPDATE", {**presence.partial_dict, **{"user": user}}), user_id,
("PRESENCE_UPDATE", {**presence.partial_dict, **{"user": user}}),
) )
async def dispatch_friends_pres_filter( async def dispatch_friends_pres_filter(

View File

@ -126,7 +126,8 @@ class DispatcherWithState(Dispatcher[K, V, EventType, DispatchType]):
class DispatcherWithFlags( class DispatcherWithFlags(
DispatcherWithState, Generic[K, V, EventType, DispatchType, F], DispatcherWithState,
Generic[K, V, EventType, DispatchType, F],
): ):
"""Pub/Sub backend with both a state and a flags store.""" """Pub/Sub backend with both a state and a flags store."""

View File

@ -167,7 +167,10 @@ class LitecordValidator(Validator):
return isinstance(value, str) and (len(value) < 32) return isinstance(value, str) and (len(value) < 32)
def validate(reqjson: Optional[Union[Dict, List]], schema: Dict,) -> Dict: def validate(
reqjson: Optional[Union[Dict, List]],
schema: Dict,
) -> Dict:
"""Validate the given user-given data against a schema, giving the """Validate the given user-given data against a schema, giving the
"correct" version of the document, with all defaults applied. "correct" version of the document, with all defaults applied.