From 26ba10f4e4bf162074e9e04cf3e428290638ecf2 Mon Sep 17 00:00:00 2001 From: Jan Bouwhuis Date: Fri, 29 Sep 2023 21:07:30 +0200 Subject: [PATCH] Use dataclass for stream segment Part (#101128) * Use data class for stream segement Part * use slots --- homeassistant/components/stream/core.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/stream/core.py b/homeassistant/components/stream/core.py index 6b8e6c44a1c..bf66ef729bd 100644 --- a/homeassistant/components/stream/core.py +++ b/homeassistant/components/stream/core.py @@ -4,6 +4,7 @@ from __future__ import annotations import asyncio from collections import deque from collections.abc import Callable, Coroutine, Iterable +from dataclasses import dataclass import datetime from enum import IntEnum import logging @@ -70,14 +71,14 @@ STREAM_SETTINGS_NON_LL_HLS = StreamSettings( ) -@attr.s(slots=True) +@dataclass(slots=True) class Part: """Represent a segment part.""" - duration: float = attr.ib() - has_keyframe: bool = attr.ib() + duration: float + has_keyframe: bool # video data (moof+mdat) - data: bytes = attr.ib() + data: bytes @attr.s(slots=True)