Passed
Pull Request — main (#253)
by
unknown
01:34
created

pincer.objects.app.mentionable   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 15
dl 0
loc 32
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A Mentionable.is_role() 0 3 1
A Mentionable.is_user() 0 3 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 dataclasses import dataclass
5
from typing import Optional
6
7
8
from ...objects.guild.role import Role
9
from ...objects.user.user import User
10
11
12
@dataclass
13
class Mentionable:
14
    """
15
    Represents the Mentionable type
16
17
    user : Optional[:class:`~pincer.objects.user.user.User`]
18
        User object returned from a discord interaction
19
    role: Optional[:class:`~pincer.objects.guild.role.Role`]
20
        Role object returned from a discord interaction
21
    """
22
    user: Optional[User] = None
23
    role: Optional[Role] = None
24
25
    @property
26
    def is_user(self):
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
27
        return self.user is not None
28
29
    @property
30
    def is_role(self):
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
31
        return self.role is not None
32