mirror of https://gitlab.com/litecord/litecord.git
black run
This commit is contained in:
parent
2492d55f30
commit
1d2df14527
|
|
@ -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(
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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},
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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(
|
||||||
|
|
|
||||||
|
|
@ -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(
|
||||||
|
|
|
||||||
|
|
@ -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."""
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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.
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue