Skip to content

Commit

Permalink
fix(stats); check if frame stats is None (#71)
Browse files Browse the repository at this point in the history
  • Loading branch information
ooliver1 committed May 3, 2023
1 parent 1f78c7c commit 978918e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion mafic/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,5 +119,7 @@ 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 "frameStats" in data else None
FrameStats(data["frameStats"])
if "frameStats" in data and data["frameStats"] is not None
else None
)
3 changes: 2 additions & 1 deletion mafic/typings/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,4 +171,5 @@ class Stats(TypedDict):
uptime: int
memory: Memory
cpu: CPU
frameStats: NotRequired[FrameStats]
# V3 is NotRequired, V4 is None
frameStats: NotRequired[FrameStats | None]

0 comments on commit 978918e

Please sign in to comment.