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 c0d65ae

Browse filesBrowse files
authored
fix: reduce cast calls in service browser (#1164)
1 parent 26a4a92 commit c0d65ae
Copy full SHA for c0d65ae

File tree

1 file changed

+4
-6
lines changed
Filter options

1 file changed

+4
-6
lines changed

‎src/zeroconf/_services/browser.py

Copy file name to clipboardExpand all lines: src/zeroconf/_services/browser.py
+4-6Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -157,18 +157,16 @@ def generate_service_query(
157157
question = DNSQuestion(type_, _TYPE_PTR, _CLASS_IN)
158158
question.unicast = qu_question
159159
known_answers = {
160-
cast(DNSPointer, record)
160+
record
161161
for record in zc.cache.get_all_by_details(type_, _TYPE_PTR, _CLASS_IN)
162162
if not record.is_stale(now)
163163
}
164-
if not qu_question and zc.question_history.suppresses(
165-
question, now, cast(Set[DNSRecord], known_answers)
166-
):
164+
if not qu_question and zc.question_history.suppresses(question, now, known_answers):
167165
log.debug("Asking %s was suppressed by the question history", question)
168166
continue
169-
questions_with_known_answers[question] = known_answers
167+
questions_with_known_answers[question] = cast(Set[DNSPointer], known_answers)
170168
if not qu_question:
171-
zc.question_history.add_question_at_time(question, now, cast(Set[DNSRecord], known_answers))
169+
zc.question_history.add_question_at_time(question, now, known_answers)
172170

173171
return _group_ptr_queries_with_known_answers(now, multicast, questions_with_known_answers)
174172

0 commit comments

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