Passed
Pull Request — main (#329)
by
unknown
01:54
created

pincer.middleware.resumed.export()   A

Complexity

Conditions 1

Size

Total Lines 2
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 2
rs 10
c 0
b 0
f 0
cc 1
nop 0
1
# Copyright Pincer 2021-Present
2
# Full MIT License can be found in `LICENSE` at the project root.
3
4
"""
5
non-subscription event sent immediately after connecting,
6
contains server information
7
"""
8
from __future__ import annotations
9
10
from typing import TYPE_CHECKING
11
import logging
12
13
if TYPE_CHECKING:
14
    from typing import Tuple
0 ignored issues
show
introduced by
Imports from package typing are not grouped
Loading history...
15
    from ..utils.types import Coro
16
    from ..client import Client
17
    from ..core.gateway import Gateway
18
    from ..core.gateway import GatewayDispatch
19
20
_log = logging.getLogger(__package__)
21
22
23
async def on_resumed(
24
    self: Client,
0 ignored issues
show
Unused Code introduced by
The argument self seems to be unused.
Loading history...
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
25
    gateway: Gateway,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
26
    payload: GatewayDispatch
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
Unused Code introduced by
The argument payload seems to be unused.
Loading history...
27
) -> Tuple[str]:
28
    """|coro|
29
30
    Middleware for the ``on_resumed`` event.
31
32
    Parameters
33
    ----------
34
    payload : :class:`~pincer.core.gateway.GatewayDispatch`
35
        The data received from the stage instance create event
36
37
    Returns
38
    -------
39
    Tuple[:class:`str`]
40
        ``on_ready``
41
    """
42
43
    _log.debug(
44
        "%s Successfully reconnected to Discord gateway. Restarting heartbeat.",
45
        gateway.shard_key
46
    )
47
    gateway.start_heartbeat()
48
49
    return ("on_resumed",)
50
51
52
def export() -> Coro:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
53
    return on_resumed
54