feat: migrate to native types · python-zeroconf/python-zeroconf@3d24643

@@ -6,8 +6,9 @@

66

import socket

77

import time

88

import unittest

9+

from collections.abc import Iterable

910

from threading import Event

10-

from typing import Iterable, List, Set, cast

11+

from typing import cast

1112

from unittest.mock import patch

12131314

import pytest

@@ -580,7 +581,7 @@ def on_service_state_change(zeroconf, service_type, state_change, name):

580581

old_send = zeroconf_browser.async_send

581582582583

expected_ttl = const._DNS_OTHER_TTL

583-

questions: List[List[DNSQuestion]] = []

584+

questions: list[list[DNSQuestion]] = []

584585585586

def send(out, addr=const._MDNS_ADDR, port=const._MDNS_PORT, v6_flow_scope=()):

586587

"""Sends an outgoing packet."""

@@ -1151,7 +1152,7 @@ async def test_generate_service_query_suppress_duplicate_questions():

11511152

10000,

11521153

f"known-to-other.{name}",

11531154

)

1154-

other_known_answers: Set[r.DNSRecord] = {answer}

1155+

other_known_answers: set[r.DNSRecord] = {answer}

11551156

zc.question_history.add_question_at_time(question, now, other_known_answers)

11561157

assert zc.question_history.suppresses(question, now, other_known_answers)

11571158

@@ -1196,7 +1197,7 @@ async def test_query_scheduler():

11961197

aiozc = AsyncZeroconf(interfaces=["127.0.0.1"])

11971198

await aiozc.zeroconf.async_wait_for_start()

11981199

zc = aiozc.zeroconf

1199-

sends: List[r.DNSIncoming] = []

1200+

sends: list[r.DNSIncoming] = []

1200120112011202

def send(out, addr=const._MDNS_ADDR, port=const._MDNS_PORT, v6_flow_scope=()):

12021203

"""Sends an outgoing packet."""

@@ -1289,7 +1290,7 @@ async def test_query_scheduler_rescue_records():

12891290

aiozc = AsyncZeroconf(interfaces=["127.0.0.1"])

12901291

await aiozc.zeroconf.async_wait_for_start()

12911292

zc = aiozc.zeroconf

1292-

sends: List[r.DNSIncoming] = []

1293+

sends: list[r.DNSIncoming] = []

1293129412941295

def send(out, addr=const._MDNS_ADDR, port=const._MDNS_PORT, v6_flow_scope=()):

12951296

"""Sends an outgoing packet."""