Passed
Pull Request — main (#321)
by
unknown
04:13
created

pincer.commands.components.component_handler   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 7
dl 0
loc 22
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A ComponentHandler.register_id() 0 2 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 typing import Callable, Dict
5
6
from ...utils.types import Singleton
7
8
9
class ComponentHandler(metaclass=Singleton):
10
    """Handles registered components
11
12
    Attributes
13
    ----------
14
    register : Dict[:class:`str`, :class:`Callable`]
15
        Dictionary of registered buttons.
16
    """
17
18
    register: Dict[str, Callable] = {}
19
20
    def register_id(self, _id: str, func: Callable):
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
21
        self.register[_id] = func
22