Skip to content

Commit 241700a

Browse files
authored
Mark zeroconf.exceptions as protected by renaming to zeroconf._exceptions (#580)
- The public API should only access zeroconf and zeroconf.aio as internals may be relocated between releases
1 parent dd9ada7 commit 241700a

10 files changed

Lines changed: 9 additions & 11 deletions

File tree

tests/test_aio.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from zeroconf.aio import AsyncServiceInfo, AsyncServiceListener, AsyncZeroconf
1515
from zeroconf import Zeroconf
1616
from zeroconf.const import _LISTENER_TIME
17-
from zeroconf.exceptions import BadTypeInNameException, NonUniqueNameException, ServiceNameAlreadyRegistered
17+
from zeroconf._exceptions import BadTypeInNameException, NonUniqueNameException, ServiceNameAlreadyRegistered
1818
from zeroconf.services import ServiceInfo, ServiceListener
1919
from zeroconf.utils.time import current_time_millis
2020

tests/test_exceptions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# -*- coding: utf-8 -*-
33

44

5-
""" Unit tests for zeroconf.exceptions """
5+
""" Unit tests for zeroconf._exceptions """
66

77
import logging
88
import unittest

zeroconf/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
DNSText,
3838
)
3939
from ._logger import QuietLogger, log # noqa # import needed for backwards compat
40-
from .exceptions import ( # noqa # import needed for backwards compat
40+
from ._exceptions import ( # noqa # import needed for backwards compat
4141
AbstractMethodException,
4242
BadTypeInNameException,
4343
Error,

zeroconf/_core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
from typing import Dict, List, Optional, Type, Union, cast
3030

3131
from ._dns import DNSIncoming, DNSOutgoing, DNSQuestion
32+
from ._exceptions import NonUniqueNameException
3233
from ._handlers import QueryHandler, RecordManager
3334
from ._logger import QuietLogger, log
3435
from .cache import DNSCache
@@ -48,7 +49,6 @@
4849
_TYPE_PTR,
4950
_UNREGISTER_TIME,
5051
)
51-
from .exceptions import NonUniqueNameException
5252
from .services import (
5353
RecordUpdateListener,
5454
ServiceBrowser,

zeroconf/_dns.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import struct
2626
from typing import Any, Dict, List, Optional, TYPE_CHECKING, Tuple, Union, cast
2727

28+
from ._exceptions import AbstractMethodException, IncomingDecodeError, NamePartTooLongException
2829
from ._logger import QuietLogger, log
2930
from .const import (
3031
_CLASSES,
@@ -48,7 +49,6 @@
4849
_TYPE_SRV,
4950
_TYPE_TXT,
5051
)
51-
from .exceptions import AbstractMethodException, IncomingDecodeError, NamePartTooLongException
5252
from .utils.net import _is_v6_address
5353
from .utils.struct import int2byte
5454
from .utils.time import current_time_millis, millis_to_seconds
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
USA
2121
"""
2222

23-
# Exceptions
24-
2523

2624
class Error(Exception):
2725
pass

zeroconf/aio.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828

2929
from ._core import NotifyListener, Zeroconf
3030
from ._dns import DNSOutgoing
31+
from ._exceptions import NonUniqueNameException
3132
from .const import _BROWSER_TIME, _CHECK_TIME, _LISTENER_TIME, _MDNS_PORT, _REGISTER_TIME, _UNREGISTER_TIME
32-
from .exceptions import NonUniqueNameException
3333
from .services import ServiceInfo, _ServiceBrowserBase, instance_name_from_service_info
3434
from .utils.aio import wait_condition_or_timeout
3535
from .utils.net import IPVersion, InterfaceChoice, InterfacesType

zeroconf/services/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
from typing import Any, Callable, Dict, List, Optional, Set, TYPE_CHECKING, Tuple, Union, cast
2929

3030
from .._dns import DNSAddress, DNSOutgoing, DNSPointer, DNSQuestion, DNSRecord, DNSService, DNSText
31+
from .._exceptions import BadTypeInNameException
3132
from ..const import (
3233
_BROWSER_BACKOFF_LIMIT,
3334
_BROWSER_TIME,
@@ -47,7 +48,6 @@
4748
_TYPE_SRV,
4849
_TYPE_TXT,
4950
)
50-
from ..exceptions import BadTypeInNameException
5151
from ..utils.name import service_type_name
5252
from ..utils.net import (
5353
IPVersion,

zeroconf/services/registry.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
from typing import Dict, List, Optional
2525

2626

27-
from ..exceptions import ServiceNameAlreadyRegistered
27+
from .._exceptions import ServiceNameAlreadyRegistered
2828
from ..services import ServiceInfo
2929

3030

zeroconf/utils/name.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
USA
2121
"""
2222

23+
from .._exceptions import BadTypeInNameException
2324
from ..const import (
2425
_HAS_ASCII_CONTROL_CHARS,
2526
_HAS_A_TO_Z,
@@ -29,7 +30,6 @@
2930
_NONTCP_PROTOCOL_LOCAL_TRAILER,
3031
_TCP_PROTOCOL_LOCAL_TRAILER,
3132
)
32-
from ..exceptions import BadTypeInNameException
3333

3434

3535
def service_type_name(type_: str, *, strict: bool = True) -> str: # pylint: disable=too-many-branches

0 commit comments

Comments
 (0)