Passed
Pull Request — main (#329)
by
unknown
01:46
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
from asyncio.tasks import ensure_future
0 ignored issues
show
Unused Code introduced by
Unused ensure_future imported from asyncio.tasks
Loading history...
10
11
from typing import TYPE_CHECKING
12
import logging
13
14
if TYPE_CHECKING:
15
    from typing import Tuple
0 ignored issues
show
introduced by
Imports from package typing are not grouped
Loading history...
16
    from ..utils.types import Coro
17
    from ..client import Client
18
    from ..core.gateway import Gateway
19
    from ..core.gateway import GatewayDispatch
20
21
_log = logging.getLogger(__package__)
22
23
24
async def on_resumed(
25
    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...
26
    gateway: Gateway,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
27
    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...
28
) -> Tuple[str]:
29
    """|coro|
30
31
    Middleware for the ``on_resumed`` event.
32
33
    Parameters
34
    ----------
35
    payload : :class:`~pincer.core.gateway.GatewayDispatch`
36
        The data received from the stage instance create event
37
38
    Returns
39
    -------
40
    Tuple[:class:`str`]
41
        ``on_ready``
42
    """
43
44
    _log.debug(
45
        "%s Sucessfully reconnected to Discord gateway. Restarting heartbeat.",
46
        gateway.shard_key
47
    )
48
    gateway.start_heartbeat()
49
50
    return ("on_resumed",)
51
52
53
def export() -> Coro:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
54
    return on_resumed
55