Passed
Pull Request — main (#384)
by
unknown
01:41
created

pincer.utils.shards.calculate_shard_id()   A

Complexity

Conditions 1

Size

Total Lines 9
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 9
rs 10
c 0
b 0
f 0
cc 1
nop 2
1
# Copyright Pincer 2021-Present
0 ignored issues
show
introduced by
Missing module docstring
Loading history...
2
# Full MIT License can be found in `LICENSE` at the project root.
3
4
def calculate_shard_id(guild_id, num_shards):
5
    """Calculates the shard recieving the events for a specified guild
6
7
    guild_id : Optional[~pincer.utils.snowflake.Snowflake]
8
        The guild_id of the shard to look for
9
    num_shards : Optional[int]
10
        The number of shards.
11
    """
12
    return (guild_id >> 22) % num_shards
13