Skip to content

Commit 2d38751

Browse files
committed
use @dataclass instead of custom constructor
1 parent ab9c1c6 commit 2d38751

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/h2/events.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from __future__ import annotations
1212

1313
import binascii
14+
from dataclasses import dataclass
1415
from typing import TYPE_CHECKING
1516

1617
from .settings import ChangedSetting, SettingCodes, Settings, _setting_code_from_int
@@ -292,6 +293,7 @@ def __repr__(self) -> str:
292293
)
293294

294295

296+
@dataclass(kw_only=True)
295297
class WindowUpdated(Event):
296298
"""
297299
The WindowUpdated event is fired whenever a flow control window changes
@@ -307,15 +309,11 @@ class WindowUpdated(Event):
307309
May be ``0`` if the connection window was changed.
308310
"""
309311

310-
delta: int | None
312+
delta: int | None = None
311313
"""
312314
The window delta.
313315
"""
314316

315-
def __init__(self, *, stream_id: int, delta: int | None = None) -> None:
316-
self.stream_id = stream_id
317-
self.delta = delta
318-
319317
def __repr__(self) -> str:
320318
return f"<WindowUpdated stream_id:{self.stream_id}, delta:{self.delta}>"
321319

0 commit comments

Comments
 (0)