Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 502c30d

Browse filesBrowse files
committed
fix: cython compat
1 parent 5bbd49d commit 502c30d
Copy full SHA for 502c30d

File tree

1 file changed

+23
-10
lines changed
Filter options

1 file changed

+23
-10
lines changed

‎src/zeroconf/_handlers.py

Copy file name to clipboardExpand all lines: src/zeroconf/_handlers.py
+23-10Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import itertools
2424
import random
2525
from collections import deque
26-
from dataclasses import dataclass
2726
from typing import (
2827
TYPE_CHECKING,
2928
Dict,
@@ -75,21 +74,35 @@
7574
_RESPOND_IMMEDIATE_TYPES = {_TYPE_NSEC, _TYPE_SRV, *_ADDRESS_RECORD_TYPES}
7675

7776

78-
@dataclass
7977
class QuestionAnswers:
80-
ucast: _AnswerWithAdditionalsType
81-
mcast_now: _AnswerWithAdditionalsType
82-
mcast_aggregate: _AnswerWithAdditionalsType
83-
mcast_aggregate_last_second: _AnswerWithAdditionalsType
78+
"""A group of answers for a question."""
79+
80+
__slots__ = ("ucast", "mcast_now", "mcast_aggregate", "mcast_aggregate_last_second")
81+
82+
def __init__(
83+
self,
84+
ucast: _AnswerWithAdditionalsType,
85+
mcast_now: _AnswerWithAdditionalsType,
86+
mcast_aggregate: _AnswerWithAdditionalsType,
87+
mcast_aggregate_last_second: _AnswerWithAdditionalsType,
88+
) -> None:
89+
"""Initialize the question answers."""
90+
self.ucast = ucast
91+
self.mcast_now = mcast_now
92+
self.mcast_aggregate = mcast_aggregate
93+
self.mcast_aggregate_last_second = mcast_aggregate_last_second
8494

8595

86-
@dataclass
8796
class AnswerGroup:
8897
"""A group of answers scheduled to be sent at the same time."""
8998

90-
send_after: float # Must be sent after this time
91-
send_before: float # Must be sent before this time
92-
answers: _AnswerWithAdditionalsType
99+
__slots__ = ("send_after", "send_before", "answers")
100+
101+
def __init__(self, send_after: float, send_before: float, answers: _AnswerWithAdditionalsType) -> None:
102+
"""Initialize the answer group."""
103+
self.send_after = send_after # Must be sent after this time
104+
self.send_before = send_before # Must be sent before this time
105+
self.answers = answers
93106

94107

95108
def _message_is_probe(msg: DNSIncoming) -> bool:

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.