Skip to content

Commit 9d9848f

Browse files
Fix restyle
1 parent 5619324 commit 9d9848f

File tree

3 files changed

+16
-36
lines changed

3 files changed

+16
-36
lines changed

src/python_testing/TC_SC_4_3.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
import chip.clusters as Clusters
2222
from matter_testing_support import MatterBaseTest, async_test_body, default_matter_test_main
23-
from mdns_discovery.mdns_discovery import MdnsDiscovery, MdnsServiceType, DNSRecordType
23+
from mdns_discovery.mdns_discovery import DNSRecordType, MdnsDiscovery, MdnsServiceType
2424
from mobly import asserts
2525

2626
'''
@@ -179,7 +179,6 @@ async def test_TC_SC_4_3(self):
179179
log_output=True,
180180
load_from_cache=False
181181
)
182-
183182

184183
# # *** STEP 9 ***
185184
# self.print_step("9", "TH verifies ICD, SII, SAI, SAT, and T TXT record keys/vales of the returned record.")
@@ -261,11 +260,9 @@ async def test_TC_SC_4_3(self):
261260
# asserts.assert_in(op_sub_type, service_types, f"No PTR record with DNS-SD instance name '{op_sub_type}'")
262261

263262
print("\n"*10)
264-
263+
265264
# input()
266265

267266

268267
if __name__ == "__main__":
269268
default_matter_test_main()
270-
271-

src/python_testing/mdns_discovery/mdns_async_service_info.py

+7-24
Original file line numberDiff line numberDiff line change
@@ -21,34 +21,16 @@
2121
from ipaddress import IPv4Address, IPv6Address
2222
from random import randint
2323
from typing import TYPE_CHECKING, Dict, List, Optional, Set, Union
24+
2425
from zeroconf import BadTypeInNameException, DNSQuestionType, ServiceInfo, Zeroconf, current_time_millis
25-
from zeroconf.const import (
26-
_DNS_HOST_TTL,
27-
_DNS_OTHER_TTL,
28-
_LISTENER_TIME,
29-
_MDNS_PORT,
30-
_DUPLICATE_QUESTION_INTERVAL,
31-
_FLAGS_QR_QUERY,
32-
_CLASS_IN,
33-
_TYPE_A,
34-
_TYPE_AAAA,
35-
_TYPE_SRV,
36-
_TYPE_TXT
37-
)
38-
from zeroconf._dns import (
39-
DNSQuestion,
40-
DNSAddress,
41-
DNSPointer,
42-
DNSQuestionType,
43-
DNSRecord,
44-
DNSService,
45-
DNSText
46-
)
26+
from zeroconf._cache import DNSCache
27+
from zeroconf._dns import DNSQuestion, DNSAddress, DNSPointer, DNSQuestionType, DNSRecord, DNSService, DNSText
28+
from zeroconf._history import QuestionHistory
4729
from zeroconf._protocol.outgoing import DNSOutgoing
4830
from zeroconf._utils.name import service_type_name
4931
from zeroconf._utils.net import _encode_address
50-
from zeroconf._cache import DNSCache
51-
from zeroconf._history import QuestionHistory
32+
from zeroconf.const import (_DNS_HOST_TTL, _DNS_OTHER_TTL, _LISTENER_TIME,
33+
_MDNS_PORT, _DUPLICATE_QUESTION_INTERVAL, _FLAGS_QR_QUERY, _CLASS_IN, _TYPE_A, _TYPE_AAAA, _TYPE_SRV, _TYPE_TXT)
5234

5335

5436
int_ = int
@@ -60,6 +42,7 @@
6042
QM_QUESTION = DNSQuestionType.QM
6143
_AVOID_SYNC_DELAY_RANDOM_INTERVAL = (20, 120)
6244

45+
6346
@enum.unique
6447
class DNSRecordType(enum.Enum):
6548
"""An MDNS record type.

src/python_testing/mdns_discovery/mdns_discovery.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@
2323
from time import sleep
2424
from typing import Dict, List, Optional
2525

26+
from mdns_discovery.mdns_async_service_info import DNSRecordType, MdnsAsyncServiceInfo
2627
from zeroconf import IPVersion, ServiceListener, ServiceStateChange, Zeroconf
2728
from zeroconf.asyncio import AsyncServiceBrowser, AsyncServiceInfo, AsyncZeroconfServiceTypes
2829

29-
from mdns_discovery.mdns_async_service_info import DNSRecordType, MdnsAsyncServiceInfo
3030

3131
@dataclass
3232
class MdnsServiceInfo:
@@ -226,12 +226,12 @@ async def get_service_types(self, log_output: bool = False) -> List[str]:
226226
return discovered_services
227227

228228
async def get_service_by_record_type(self, service_name: str,
229-
service_type: str,
230-
record_type: DNSRecordType,
231-
load_from_cache: bool = True,
232-
discovery_timeout_sec: float = DISCOVERY_TIMEOUT_SEC,
233-
log_output: bool = False
234-
) -> Optional[MdnsServiceInfo]:
229+
service_type: str,
230+
record_type: DNSRecordType,
231+
load_from_cache: bool = True,
232+
discovery_timeout_sec: float = DISCOVERY_TIMEOUT_SEC,
233+
log_output: bool = False
234+
) -> Optional[MdnsServiceInfo]:
235235
"""
236236
Asynchronously discovers an mDNS service within the network by service name, service type,
237237
and record type.

0 commit comments

Comments
 (0)