Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ repos:
hooks:
- id: codespell
- repo: https://github.com/PyCQA/flake8
rev: 7.1.2
rev: 7.2.0
hooks:
- id: flake8
- repo: https://github.com/pre-commit/mirrors-mypy
Expand Down
13 changes: 0 additions & 13 deletions tests/services/test_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -866,7 +866,6 @@ class LegacyRecordUpdateListener(r.RecordUpdateListener):
"""A RecordUpdateListener that does not implement update_records."""

def update_record(self, zc: Zeroconf, now: float, record: r.DNSRecord) -> None:
nonlocal updates
updates.append(record)

listener = LegacyRecordUpdateListener()
Expand Down Expand Up @@ -923,7 +922,6 @@ def test_service_browser_is_aware_of_port_changes():
# dummy service callback
def on_service_state_change(zeroconf, service_type, state_change, name):
"""Dummy callback."""
nonlocal callbacks
if name == registration_name:
callbacks.append((service_type, state_change, name))

Expand Down Expand Up @@ -985,17 +983,14 @@ def test_service_browser_listeners_update_service():

class MyServiceListener(r.ServiceListener):
def add_service(self, zc, type_, name) -> None: # type: ignore[no-untyped-def]
nonlocal callbacks
if name == registration_name:
callbacks.append(("add", type_, name))

def remove_service(self, zc, type_, name) -> None: # type: ignore[no-untyped-def]
nonlocal callbacks
if name == registration_name:
callbacks.append(("remove", type_, name))

def update_service(self, zc, type_, name) -> None: # type: ignore[no-untyped-def]
nonlocal callbacks
if name == registration_name:
callbacks.append(("update", type_, name))

Expand Down Expand Up @@ -1050,12 +1045,10 @@ def test_service_browser_listeners_no_update_service():

class MyServiceListener(r.ServiceListener):
def add_service(self, zc, type_, name) -> None: # type: ignore[no-untyped-def]
nonlocal callbacks
if name == registration_name:
callbacks.append(("add", type_, name))

def remove_service(self, zc, type_, name) -> None: # type: ignore[no-untyped-def]
nonlocal callbacks
if name == registration_name:
callbacks.append(("remove", type_, name))

Expand Down Expand Up @@ -1374,17 +1367,14 @@ def test_service_browser_matching():

class MyServiceListener(r.ServiceListener):
def add_service(self, zc, type_, name) -> None: # type: ignore[no-untyped-def]
nonlocal callbacks
if name == registration_name:
callbacks.append(("add", type_, name))

def remove_service(self, zc, type_, name) -> None: # type: ignore[no-untyped-def]
nonlocal callbacks
if name == registration_name:
callbacks.append(("remove", type_, name))

def update_service(self, zc, type_, name) -> None: # type: ignore[no-untyped-def]
nonlocal callbacks
if name == registration_name:
callbacks.append(("update", type_, name))

Expand Down Expand Up @@ -1465,17 +1455,14 @@ def test_service_browser_expire_callbacks():

class MyServiceListener(r.ServiceListener):
def add_service(self, zc, type_, name) -> None: # type: ignore[no-untyped-def]
nonlocal callbacks
if name == registration_name:
callbacks.append(("add", type_, name))

def remove_service(self, zc, type_, name) -> None: # type: ignore[no-untyped-def]
nonlocal callbacks
if name == registration_name:
callbacks.append(("remove", type_, name))

def update_service(self, zc, type_, name) -> None: # type: ignore[no-untyped-def]
nonlocal callbacks
if name == registration_name:
callbacks.append(("update", type_, name))

Expand Down
9 changes: 0 additions & 9 deletions tests/test_asyncio.py
Original file line number Diff line number Diff line change
Expand Up @@ -940,17 +940,14 @@ async def test_service_browser_instantiation_generates_add_events_from_cache():

class MyServiceListener(ServiceListener):
def add_service(self, zc, type_, name) -> None: # type: ignore[no-untyped-def]
nonlocal callbacks
if name == registration_name:
callbacks.append(("add", type_, name))

def remove_service(self, zc, type_, name) -> None: # type: ignore[no-untyped-def]
nonlocal callbacks
if name == registration_name:
callbacks.append(("remove", type_, name))

def update_service(self, zc, type_, name) -> None: # type: ignore[no-untyped-def]
nonlocal callbacks
if name == registration_name:
callbacks.append(("update", type_, name))

Expand Down Expand Up @@ -1191,17 +1188,14 @@ async def test_service_browser_ignores_unrelated_updates():

class MyServiceListener(ServiceListener):
def add_service(self, zc, type_, name) -> None: # type: ignore[no-untyped-def]
nonlocal callbacks
if name == registration_name:
callbacks.append(("add", type_, name))

def remove_service(self, zc, type_, name) -> None: # type: ignore[no-untyped-def]
nonlocal callbacks
if name == registration_name:
callbacks.append(("remove", type_, name))

def update_service(self, zc, type_, name) -> None: # type: ignore[no-untyped-def]
nonlocal callbacks
if name == registration_name:
callbacks.append(("update", type_, name))

Expand Down Expand Up @@ -1349,15 +1343,12 @@ async def test_update_with_uppercase_names(run_isolated):

class MyServiceListener(ServiceListener):
def add_service(self, zc, type_, name) -> None: # type: ignore[no-untyped-def]
nonlocal callbacks
callbacks.append(("add", type_, name))

def remove_service(self, zc, type_, name) -> None: # type: ignore[no-untyped-def]
nonlocal callbacks
callbacks.append(("remove", type_, name))

def update_service(self, zc, type_, name) -> None: # type: ignore[no-untyped-def]
nonlocal callbacks
callbacks.append(("update", type_, name))

listener = MyServiceListener()
Expand Down
1 change: 0 additions & 1 deletion tests/test_updates.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ class LegacyRecordUpdateListener(r.RecordUpdateListener):
"""A RecordUpdateListener that does not implement update_records."""

def update_record(self, zc: Zeroconf, now: float, record: r.DNSRecord) -> None:
nonlocal updates
updates.append(record)

listener = LegacyRecordUpdateListener()
Expand Down
1 change: 0 additions & 1 deletion tests/utils/test_net.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ def test_disable_ipv6_only_or_raise():
errors_logged = []

def _log_error(*args):
nonlocal errors_logged
errors_logged.append(args)

sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
Expand Down
Loading