Passed
Pull Request — main (#378)
by
unknown
01:52
created

Overwrite.permissions()   A

Complexity

Conditions 1

Size

Total Lines 4
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nop 1
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
from __future__ import annotations
5
6
from dataclasses import dataclass
7
from typing import TYPE_CHECKING
8
9
from .permissions import Permissions
10
from ...utils import APIObject
11
12
if TYPE_CHECKING:
13
    from ...utils.snowflake import Snowflake
14
15
16
@dataclass(repr=False)
17
class Overwrite(APIObject):
18
    """Represents a Discord Overwrite object
19
20
    Attributes
21
    ----------
22
    id: :class:`~pincer.utils.snowflake.Snowflake`
23
        Role or user id
24
    type: :class:`int`
25
        Either 0 (role) or 1 (member)
26
    allow: :class:`str`
27
        Permission bit set
28
    deny: :class:`str`
29
        Permission bit set
30
    """
31
    id: Snowflake
0 ignored issues
show
introduced by
The variable Snowflake does not seem to be defined in case TYPE_CHECKING on line 12 is False. Are you sure this can never be the case?
Loading history...
32
    type: int
33
    allow: str
34
    deny: str
35
36
    @property
37
    def permissions(self) -> Permissions:
38
        """Returns the permissions for this overwrite"""
39
        return Permissions.from_ints(int(self.allow), int(self.deny))
0 ignored issues
show
Coding Style introduced by
Final newline missing
Loading history...