8000 chore(pre-commit): reenable codespell and disable false positives (#1… · python-zeroconf/python-zeroconf@06637f4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 06637f4

Browse files
authored
chore(pre-commit): reenable codespell and disable false positives (#1432)
1 parent 857e742 commit 06637f4

File tree

9 files changed

+31
-33
lines changed

9 files changed

+31
-33
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ jobs:
1414
lint:
1515
runs-on: ubuntu-latest
1616
steps:
17-
- uses: actions/checkout@v3
17+
- uses: actions/checkout@v4
1818
- uses: actions/setup-python@v5
1919
with:
20-
python-version: "3.9"
21-
- uses: pre-commit/action@v2.0.3
20+
python-version: "3.12"
21+
- uses: pre-commit/action@v3.0.1
2222

2323
# Make sure commit messages follow the conventional commits convention:
2424
# https://www.conventionalcommits.org

.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ repos:
4444
- id: ruff
4545
args: [--fix, --exit-non-zero-on-fix]
4646
- id: ruff-format
47-
# - repo: https://github.com/codespell-project/codespell
48-
# rev: v2.2.1
49-
# hooks:
50-
# - id: codespell
47+
- repo: https://github.com/codespell-project/codespell
48+
rev: v2.3.0
49+
hooks:
50+
- id: codespell
5151
- repo: https://github.com/PyCQA/flake8
5252
rev: 7.1.1
5353
hooks:

pyproject.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,4 @@ requires = ['setuptools>=65.4.1', 'wheel', 'Cython>=3.0.8', "poetry-core>=1.5.2"
193193
build-backend = "poetry.core.masonry.api"
194194

195195
[tool.codespell]
196-
skip = '*.po,*.ts,./tests,./bench'
197-
count = ''
198-
quiet-level = 3
196+
ignore-words-list = ["additionals", "HASS"]

tests/services/test_browser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -770,7 +770,7 @@ def send(out, addr=const._MDNS_ADDR, port=const._MDNS_PORT, v6_flow_scope=()):
770770

771771
@pytest.mark.asyncio
772772
async def test_asking_qm_questions():
773-
"""Verify explictly asking QM questions."""
773+
"""Verify explicitly asking QM questions."""
774774
type_ = "_quservice._tcp.local."
775775
aiozc = AsyncZeroconf(interfaces=["127.0.0.1"])
776776
zeroconf_browser = aiozc.zeroconf

tests/services/test_info.py

Lines changed: 5 additions & 5 deletions
Ori B422 ginal file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def test_service_info_rejects_non_matching_updates(self):
8282
service_server,
8383
addresses=[service_address],
8484
)
85-
# Verify backwards compatiblity with calling with None
85+
# Verify backwards compatibility with calling with None
8686
info.async_update_records(zc, now, [])
8787
# Matching updates
8888
info.async_update_records(
@@ -572,7 +572,7 @@ def get_service_info_helper(zc, type, name):
572572
helper_thread.start()
573573
wait_time = 1
574574

575-
# Expext query for SRV, TXT, A, AAAA
575+
# Expect query for SRV, TXT, A, AAAA
576576
send_event.wait(wait_time)
577577
assert last_sent is not None
578578
assert len(last_sent.questions) == 4
@@ -582,7 +582,7 @@ def get_service_info_helper(zc, type, name):
582582
assert r.DNSQuestion(service_name, const._TYPE_AAAA, const._CLASS_IN) in last_sent.questions
583583
assert service_info is None
584584

585-
# Expext no further queries
585+
# Expect no further queries
586586
last_sent = None
587587
send_event.clear()
588588
_inject_response(
@@ -1006,7 +1006,7 @@ def test_serviceinfo_accepts_bytes_or_string_dict():
10061006

10071007

10081008
def test_asking_qu_questions():
1009-
"""Verify explictly asking QU questions."""
1009+
"""Verify explicitly asking QU questions."""
10101010
type_ = "_quservice._tcp.local."
10111011
zeroconf = r.Zeroconf(interfaces=["127.0.0.1"])
10121012

@@ -1030,7 +1030,7 @@ def send(out, addr=const._MDNS_ADDR, port=const._MDNS_PORT):
10301030

10311031

10321032
def test_asking_qm_questions():
1033-
"""Verify explictly asking QM questions."""
1033+
"""Verify explicitly asking QM questions."""
10341034
type_ = "_quservice._tcp.local."
10351035
zeroconf = r.Zeroconf(interfaces=["127.0.0.1"])
10361036

tests/test_asyncio.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1331,7 +1331,7 @@ async def test_legacy_unicast_response(run_isolated):
13311331
protocol.datagram_received(query.packets()[0], ("127.0.0.1", 6503))
13321332

13331333
calls = send_mock.mock_calls
1334-
# Verify the response is sent back on the socket it was recieved from
1334+
# Verify the response is sent back on the socket it was received from
13351335
assert calls == [call(ANY, "127.0.0.1", 6503, (), protocol.transport)]
13361336
outgoing = send_mock.call_args[0][0]
13371337
assert isinstance(outgoing, DNSOutgoing)

tests/test_core.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ def test_goodbye_all_services():
348348
second_packet = out.packets()
349349
assert second_packet == first_packet
350350

351-
# Verify the registery is empty
351+
# Verify the registry is empty
352352
out3 = zc.generate_unregister_all_services()
353353
assert out3 is None
354354
assert zc.registry.async_get_service_infos() == []
@@ -676,7 +676,7 @@ async def test_open_close_twice_from_async() -> None:
676676
"""Test we can close twice from a coroutine when using Zeroconf.
677677
678678
Ideally callers switch to using AsyncZeroconf, however there will
679-
be a peroid where they still call the sync wrapper that we want
679+
be a period where they still call the sync wrapper that we want
680680
to ensure will not deadlock on shutdown.
681681
682682
This test is expected to throw warnings about tasks being destroyed

tests/test_handlers.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def _process_outgoing_packet(out):
110110
assert question_answers
111111
_process_outgoing_packet(construct_outgoing_multicast_answers(question_answers.mcast_aggregate))
112112

113-
# The additonals should all be suppresed since they are all in the answers section
113+
# The additonals should all be suppressed since they are all in the answers section
114114
# There will be one NSEC additional to indicate the lack of AAAA record
115115
#
116116
assert nbr_answers == 4 and nbr_additionals == 1 and nbr_authorities == 0
@@ -685,7 +685,7 @@ def _validate_complete_response(answers):
685685
assert not question_answers.mcast_aggregate
686686
_validate_complete_response(question_answers.mcast_now)
687687

688-
# With QU set and an authorative answer (probe) should respond to both unitcast
688+
# With QU set and an authoritative answer (probe) should respond to both unitcast
689689
# and multicast since the response hasn't been seen since 75% of the ttl
690690
query = r.DNSOutgoing(const._FLAGS_QR_QUERY)
691691
question = r.DNSQuestion(info.type, const._TYPE_PTR, const._CLASS_IN)
@@ -744,7 +744,7 @@ def test_known_answer_supression():
744744

745745
now = current_time_millis()
746746
_clear_cache(zc)
747-
# Test PTR supression
747+
# Test PTR suppression
748748
generated = r.DNSOutgoing(const._FLAGS_QR_QUERY)
749749
question = r.DNSQuestion(type_, const._TYPE_PTR, const._CLASS_IN)
750750
generated.add_question(question)
@@ -768,7 +768,7 @@ def test_known_answer_supression():
768768
assert not question_answers.mcast_aggregate
769769
assert not question_answers.mcast_aggregate_last_second
770770

771-
# Test A supression
771+
# Test A suppression
772772
generated = r.DNSOutgoing(const._FLAGS_QR_QUERY)
773773
question = r.DNSQuestion(server_name, const._TYPE_A, const._CLASS_IN)
774774
generated.add_question(question)
@@ -809,7 +809,7 @@ def test_known_answer_supression():
809809
assert not question_answers.mcast_aggregate
810810
assert not question_answers.mcast_aggregate_last_second
811811

812-
# Test SRV supression
812+
# Test SRV suppression
813813
generated = r.DNSOutgoing(const._FLAGS_QR_QUERY)
814814
question = r.DNSQuestion(registration_name, const._TYPE_SRV, const._CLASS_IN)
815815
generated.add_question(question)
@@ -833,7 +833,7 @@ def test_known_answer_supression():
833833
assert not question_answers.mcast_aggregate
834834
assert not question_answers.mcast_aggregate_last_second
835835

836-
# Test TXT supression
836+
# Test TXT suppression
837837
generated = r.DNSOutgoing(const._FLAGS_QR_QUERY)
838838
question = r.DNSQuestion(registration_name, const._TYPE_TXT, const._CLASS_IN)
839839
generated.add_question(question)
@@ -914,7 +914,7 @@ def test_multi_packet_known_answer_supression():
914914

915915
now = current_time_millis()
916916
_clear_cache(zc)
917-
# Test PTR supression
917+
# Test PTR suppression
918918
generated = r.DNSOutgoing(const._FLAGS_QR_QUERY)
919919
question = r.DNSQuestion(type_, const._TYPE_PTR, const._CLASS_IN)
920920
generated.add_question(question)
@@ -976,7 +976,7 @@ def test_known_answer_supression_service_type_enumeration_query():
976976
now = current_time_millis()
977977
_clear_cache(zc)
978978

979-
# Test PTR supression
979+
# Test PTR suppression
980980
generated = r.DNSOutgoing(const._FLAGS_QR_QUERY)
981981
question = r.DNSQuestion(const._SERVICE_TYPE_ENUMERATION_NAME, const._TYPE_PTR, const._CLASS_IN)
982982
generated.add_question(question)
@@ -1062,7 +1062,7 @@ def test_upper_case_enumeration_query():
10621062
zc.registry.async_add(info2)
10631063
_clear_cache(zc)
10641064

1065-
# Test PTR supression
1065+
# Test PTR suppression
10661066
generated = r.DNSOutgoing(const._FLAGS_QR_QUERY)
10671067
question = r.DNSQuestion(const._SERVICE_TYPE_ENUMERATION_NAME.upper(), const._TYPE_PTR, const._CLASS_IN)
10681068
generated.add_question(question)
@@ -1579,7 +1579,7 @@ async def test_duplicate_goodbye_answers_in_packet():
15791579

15801580
@pytest.mark.asyncio
15811581
async def test_response_aggregation_timings(run_isolated):
1582-
"""Verify multicast respones are aggregated."""
1582+
"""Verify multicast responses are aggregated."""
15831583
type_ = "_mservice._tcp.local."
15841584
type_2 = "_mservice2._tcp.local."
15851585
type_3 = "_mservice3._tcp.local."
@@ -1949,7 +1949,7 @@ async def test_future_answers_are_removed_on_send():
19491949
# The answer should get removed because we just sent it
19501950
assert info.dns_pointer() not in outgoing_queue.queue[0].answers
19511951

1952-
# But the one we have not sent yet shoudl still go out later
1952+
# But the one we have not sent yet should still go out later
19531953
assert info2.dns_pointer() in outgoing_queue.queue[0].answers
19541954

19551955

tests/test_protocol.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ def test_dns_hinfo(self):
261261
self.assertRaises(r.NamePartTooLongException, generated.packets)
262262

263263
def test_many_questions(self):
264-
"""Test many questions get seperated into multiple packets."""
264+
"""Test many questions get separated into multiple packets."""
265265
generated = r.DNSOutgoing(const._FLAGS_QR_QUERY)
266266
questions = []
267267
for i in range(100):
@@ -281,7 +281,7 @@ def test_many_questions(self):
281281
assert len(parsed2.questions) == 15
282282

283283
def test_many_questions_with_many_known_answers(self):
284-
"""Test many questions and known answers get seperated into multiple packets."""
284+
"""Test many questions and known answers get separated into multiple packets."""
285285
generated = r.DNSOutgoing(const._FLAGS_QR_QUERY)
286286
questions = []
287287
for _ in range(30):
@@ -319,7 +319,7 @@ def test_many_questions_with_many_known_answers(self):
319319
assert not parsed3.truncated
320320

321321
de 5CB8 f test_massive_probe_packet_split(self):
322-
"""Test probe with many authorative answers."""
322+
"""Test probe with many authoritative answers."""
323323
generated = r.DNSOutgoing(const._FLAGS_QR_QUERY | const._FLAGS_AA)
324324
questions = []
325325
for _ in range(30):

0 commit comments

Comments
 (0)
0