Skip to content

Navigation Menu

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 0058c03

Browse filesBrowse files
committed
fix: tweaks for cython compat
1 parent 4c3e859 commit 0058c03
Copy full SHA for 0058c03

File tree

1 file changed

+23
-8
lines changed
Filter options

1 file changed

+23
-8
lines changed

‎src/zeroconf/_core.py

Copy file name to clipboardExpand all lines: src/zeroconf/_core.py
+23-8Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
import socket
2828
import sys
2929
import threading
30-
from dataclasses import dataclass
3130
from types import TracebackType # noqa # used in type hints
3231
from typing import Any, Awaitable, Dict, List, Optional, Tuple, Type, Union, cast
3332

@@ -106,15 +105,31 @@
106105
_REGISTER_BROADCASTS = 3
107106

108107

109-
@dataclass
110108
class _WrappedTransport:
111109
"""A wrapper for transports."""
112110

113-
transport: asyncio.DatagramTransport
114-
is_ipv6: bool
115-
socket: socket.socket
116-
fileno: int
117-
sock_name: Any
111+
__slots__ = (
112+
'transport',
113+
'is_ipv6',
114+
'sock',
115+
'fileno',
116+
'sock_name',
117+
)
118+
119+
def __init__(
120+
self,
121+
transport: asyncio.DatagramTransport,
122+
is_ipv6: bool,
123+
sock: socket.socket,
124+
fileno: int,
125+
sock_name: Any,
126+
) -> None:
127+
"""Initialize the wrapped transport."""
128+
self.transport = transport
129+
self.is_ipv6 = is_ipv6
130+
self.sock = sock
131+
self.fileno = fileno
132+
self.sock_name = sock_name
118133

119134

120135
def _make_wrapped_transport(transport: asyncio.DatagramTransport) -> _WrappedTransport:
@@ -123,7 +138,7 @@ def _make_wrapped_transport(transport: asyncio.DatagramTransport) -> _WrappedTra
123138
return _WrappedTransport(
124139
transport=transport,
125140
is_ipv6=sock.family == socket.AF_INET6,
126-
socket=sock,
141+
sock=sock,
127142
fileno=sock.fileno(),
128143
sock_name=sock.getsockname(),
129144
)

0 commit comments

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