Skip to content

Commit

Permalink
fix(stats): framestats is actually ommitable
Browse files Browse the repository at this point in the history
  • Loading branch information
ooliver1 committed Feb 4, 2023
1 parent 736c268 commit 4c96b70
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion mafic/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,5 +118,5 @@ def __init__(self, data: Stats) -> None:
self.memory: MemoryStats = MemoryStats(data["memory"])
self.cpu: CPUStats = CPUStats(data["cpu"])
self.frame_stats: FrameStats | None = (
FrameStats(data["frameStats"]) if data["frameStats"] is not None else None
FrameStats(data["frameStats"]) if "frameStats" in data else None
)
7 changes: 5 additions & 2 deletions mafic/typings/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@

from __future__ import annotations

from typing import Literal, TypedDict
from typing import TYPE_CHECKING, Literal, TypedDict

from .misc import PayloadWithGuild

if TYPE_CHECKING:
from typing_extensions import NotRequired

__all__ = (
"Filters",
"ChannelMix",
Expand Down Expand Up @@ -165,4 +168,4 @@ class Stats(TypedDict):
uptime: int
memory: Memory
cpu: CPU
frameStats: FrameStats | None
frameStats: NotRequired[FrameStats]
11 changes: 10 additions & 1 deletion mafic/warnings.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: MIT


__all__ = ("UnsupportedVersionWarning",)
__all__ = ("UnsupportedVersionWarning", "UnknownVersionWarning")


class UnsupportedVersionWarning(UserWarning):
Expand All @@ -11,3 +11,12 @@ class UnsupportedVersionWarning(UserWarning):
"The version of Lavalink you are using is not supported by Mafic. "
"It should still work but not all features are supported."
)


class UnknownVersionWarning(UserWarning):
"""Represents a warning for an unknown version of Lavalink."""

message: str = (
"The version of Lavalink you are using is unknown to Mafic. "
"It should still work but not all features are supported."
)

0 comments on commit 4c96b70

Please sign in to comment.