| Conditions | 1 |
| Total Lines | 11 |
| Code Lines | 2 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | # Copyright Pincer 2021-Present |
||
| 4 | def calculate_shard_id(guild_id: Union[Snowflake, int], num_shards: int) -> int: |
||
| 5 | """Calculates the shard receiving the events for a specified guild |
||
| 6 | |||
| 7 | Parameters |
||
| 8 | ---------- |
||
| 9 | guild_id : Optional[~pincer.utils.snowflake.Snowflake] |
||
| 10 | The guild_id of the shard to look for |
||
| 11 | num_shards : Optional[int] |
||
| 12 | The number of shards. |
||
| 13 | """ |
||
| 14 | return (guild_id >> 22) % num_shards |
||
| 15 |