Skip to content

Commit

Permalink
Revert name change of zeroconf.asyncio to zeroconf.aio (#885)
Browse files Browse the repository at this point in the history
- Now that `__init__.py` no longer needs to import `asyncio`,
  the name conflict is not a concern.

Fixes #883
  • Loading branch information
bdraco authored Jun 29, 2021
1 parent be1d3bb commit b9eae5a
Show file tree
Hide file tree
Showing 16 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ python-zeroconf API reference
:undoc-members:
:show-inheritance:

.. automodule:: zeroconf.aio
.. automodule:: zeroconf.asyncio
:members:
:undoc-members:
:show-inheritance:
2 changes: 1 addition & 1 deletion examples/async_apple_scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from typing import Any, Optional, cast

from zeroconf import DNSQuestionType, IPVersion, ServiceStateChange, Zeroconf
from zeroconf.aio import AsyncServiceBrowser, AsyncServiceInfo, AsyncZeroconf
from zeroconf.asyncio import AsyncServiceBrowser, AsyncServiceInfo, AsyncZeroconf

HOMESHARING_SERVICE: str = "_appletv-v2._tcp.local."
DEVICE_SERVICE: str = "_touch-able._tcp.local."
Expand Down
2 changes: 1 addition & 1 deletion examples/async_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from typing import Any, Optional, cast

from zeroconf import IPVersion, ServiceStateChange, Zeroconf
from zeroconf.aio import AsyncServiceBrowser, AsyncServiceInfo, AsyncZeroconf, AsyncZeroconfServiceTypes
from zeroconf.asyncio import AsyncServiceBrowser, AsyncServiceInfo, AsyncZeroconf, AsyncZeroconfServiceTypes


def async_on_service_state_change(
Expand Down
2 changes: 1 addition & 1 deletion examples/async_registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from typing import List

from zeroconf import IPVersion
from zeroconf.aio import AsyncServiceInfo, AsyncZeroconf
from zeroconf.asyncio import AsyncServiceInfo, AsyncZeroconf


async def register_services(infos: List[AsyncServiceInfo]) -> None:
Expand Down
2 changes: 1 addition & 1 deletion examples/async_service_info_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@


from zeroconf import IPVersion, ServiceBrowser, ServiceStateChange, Zeroconf
from zeroconf.aio import AsyncServiceInfo, AsyncZeroconf
from zeroconf.asyncio import AsyncServiceInfo, AsyncZeroconf


HAP_TYPE = "_hap._tcp.local."
Expand Down
2 changes: 1 addition & 1 deletion tests/services/test_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from zeroconf._services import ServiceStateChange
from zeroconf._services.browser import ServiceBrowser
from zeroconf._services.info import ServiceInfo
from zeroconf.aio import AsyncZeroconf
from zeroconf.asyncio import AsyncZeroconf

from .. import has_working_ipv6, _inject_response, _wait_for_start

Expand Down
2 changes: 1 addition & 1 deletion tests/services/test_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import zeroconf as r
from zeroconf import DNSAddress, const
from zeroconf._services.info import ServiceInfo
from zeroconf.aio import AsyncZeroconf
from zeroconf.asyncio import AsyncZeroconf

from .. import has_working_ipv6, _inject_response

Expand Down
6 changes: 3 additions & 3 deletions tests/test_aio.py → tests/test_asyncio.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import pytest

from zeroconf.aio import AsyncServiceBrowser, AsyncServiceInfo, AsyncZeroconf, AsyncZeroconfServiceTypes
from zeroconf.asyncio import AsyncServiceBrowser, AsyncServiceInfo, AsyncZeroconf, AsyncZeroconfServiceTypes
from zeroconf import (
DNSIncoming,
DNSOutgoing,
Expand Down Expand Up @@ -422,7 +422,7 @@ async def test_service_info_async_request() -> None:
_clear_cache(aiozc.zeroconf)
# Generating the race condition is almost impossible
# without patching since its a TOCTOU race
with patch("zeroconf.aio.AsyncServiceInfo._is_complete", False):
with patch("zeroconf.asyncio.AsyncServiceInfo._is_complete", False):
await aiosinfo.async_request(aiozc.zeroconf, 3000)
assert aiosinfo is not None
assert aiosinfo.addresses == [socket.inet_aton("10.0.1.3")]
Expand Down Expand Up @@ -826,7 +826,7 @@ def send(out, addr=const._MDNS_ADDR, port=const._MDNS_PORT):
with patch.object(zeroconf_info, "async_send", send):
aiosinfo = AsyncServiceInfo(type_, registration_name)
# Patch _is_complete so we send multiple times
with patch("zeroconf.aio.AsyncServiceInfo._is_complete", False):
with patch("zeroconf.asyncio.AsyncServiceInfo._is_complete", False):
await aiosinfo.async_request(aiozc.zeroconf, 1200)
try:
assert first_outgoing.questions[0].unicast == True
Expand Down
2 changes: 1 addition & 1 deletion tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

import zeroconf as r
from zeroconf import _core, _protocol, const, Zeroconf, current_time_millis
from zeroconf.aio import AsyncZeroconf
from zeroconf.asyncio import AsyncZeroconf

from . import has_working_ipv6, _clear_cache, _inject_response, _wait_for_start

Expand Down
2 changes: 1 addition & 1 deletion tests/test_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from zeroconf import ServiceInfo, Zeroconf, current_time_millis
from zeroconf import const
from zeroconf._dns import DNSRRSet
from zeroconf.aio import AsyncZeroconf
from zeroconf.asyncio import AsyncZeroconf


from . import _clear_cache, _inject_response
Expand Down
6 changes: 3 additions & 3 deletions tests/utils/test_aio.py → tests/utils/test_asyncio.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-


"""Unit tests for zeroconf._utils.aio."""
"""Unit tests for zeroconf._utils.asyncio."""

import asyncio
import contextlib
Expand All @@ -12,7 +12,7 @@

import pytest

from zeroconf._utils import aio as aioutils
from zeroconf._utils import asyncio as aioutils


@pytest.mark.asyncio
Expand All @@ -25,7 +25,7 @@ async def test_async_get_all_tasks() -> None:
await aioutils._async_get_all_tasks(aioutils.get_running_loop())
if not hasattr(asyncio, 'all_tasks'):
return
with patch("zeroconf._utils.aio.asyncio.all_tasks", side_effect=RuntimeError):
with patch("zeroconf._utils.asyncio.asyncio.all_tasks", side_effect=RuntimeError):
await aioutils._async_get_all_tasks(aioutils.get_running_loop())


Expand Down
2 changes: 1 addition & 1 deletion zeroconf/_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
from ._services.info import ServiceInfo, instance_name_from_service_info
from ._services.registry import ServiceRegistry
from ._updates import RecordUpdate, RecordUpdateListener
from ._utils.aio import get_running_loop, shutdown_loop, wait_event_or_timeout
from ._utils.asyncio import get_running_loop, shutdown_loop, wait_event_or_timeout
from ._utils.name import service_type_name
from ._utils.net import (
IPVersion,
Expand Down
2 changes: 1 addition & 1 deletion zeroconf/_services/browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
SignalRegistrationInterface,
)
from .._updates import RecordUpdate, RecordUpdateListener
from .._utils.aio import get_best_available_queue
from .._utils.asyncio import get_best_available_queue
from .._utils.name import service_type_name
from .._utils.time import current_time_millis, millis_to_seconds
from ..const import (
Expand Down
2 changes: 1 addition & 1 deletion zeroconf/_services/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
from .._exceptions import BadTypeInNameException
from .._protocol import DNSOutgoing
from .._updates import RecordUpdate, RecordUpdateListener
from .._utils.aio import get_running_loop
from .._utils.asyncio import get_running_loop
from .._utils.name import service_type_name
from .._utils.net import (
IPVersion,
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit b9eae5a

Please sign in to comment.