pincer.middleware.payload   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 16
dl 0
loc 41
rs 10
c 0
b 0
f 0

2 Functions

Rating   Name   Duplication   Size   Complexity  
A payload_middleware() 0 21 1
A export() 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 __future__ import annotations
5
6
from typing import TYPE_CHECKING
7
8
if TYPE_CHECKING:
9
    from typing import Tuple
10
11
    from ..client import Client
12
    from ..core.gateway import Gateway
13
    from ..core.gateway import GatewayDispatch
14
15
16
async def payload_middleware(
17
    self: Client,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
Unused Code introduced by
The argument self seems to be unused.
Loading history...
18
    gateway: Gateway,
0 ignored issues
show
Unused Code introduced by
The argument gateway seems to be unused.
Loading history...
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
19
    payload: GatewayDispatch,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
20
) -> Tuple[str, GatewayDispatch]:
21
    """Invoked when anything is received from gateway.
22
23
24
    Parameters
25
    ----------
26
    payload : :class:`pincer.core.gateway.GatewayDispatch`
27
        The data received from the ready event.
28
    gateway : :class:`~pincer.core.gateway.Gateway`
29
        The gateway for the current shard.
30
31
    Returns
32
    -------
33
    Tuple[:class:`str`, :class:`~pincer.core.gateway.GatewayDispatch`]
34
        ``on_payload`` and a ``payload``
35
    """
36
    return "on_payload", payload
37
38
39
def export():
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
40
    return payload_middleware
41