Skip to content
Open
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
9 changes: 0 additions & 9 deletions pymongo/asynchronous/srv_resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,6 @@
_IS_SYNC = False


def _have_dnspython() -> bool:
try:
import dns # noqa: F401

return True
except ImportError:
return False


# dnspython can return bytes or str from various parts
# of its API depending on version. We always want str.
def maybe_decode(text: Union[str, bytes]) -> str:
Expand Down
9 changes: 0 additions & 9 deletions pymongo/synchronous/srv_resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,6 @@
_IS_SYNC = True


def _have_dnspython() -> bool:
try:
import dns # noqa: F401

return True
except ImportError:
return False


# dnspython can return bytes or str from various parts
# of its API depending on version. We always want str.
def maybe_decode(text: Union[str, bytes]) -> str:
Expand Down
11 changes: 10 additions & 1 deletion pymongo/uri_parser_shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
)
from urllib.parse import unquote_plus

from pymongo.asynchronous.srv_resolver import _have_dnspython
from pymongo.client_options import _parse_ssl_options
from pymongo.common import (
INTERNAL_URI_OPTION_NAME_MAP,
Expand All @@ -47,6 +46,16 @@
if TYPE_CHECKING:
from pymongo.pyopenssl_context import SSLContext


def _have_dnspython() -> bool:
try:
import dns # noqa: F401

return True
except ImportError:
return False


SCHEME = "mongodb://"
SCHEME_LEN = len(SCHEME)
SRV_SCHEME = "mongodb+srv://"
Expand Down
2 changes: 1 addition & 1 deletion test/asynchronous/test_srv_polling.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@

import pymongo
from pymongo import common
from pymongo.asynchronous.srv_resolver import _have_dnspython
from pymongo.errors import ConfigurationError
from pymongo.uri_parser_shared import _have_dnspython
from test.asynchronous import AsyncPyMongoTestCase, client_knobs, unittest
from test.asynchronous.utils import async_wait_until

Expand Down
2 changes: 1 addition & 1 deletion test/test_srv_polling.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import pymongo
from pymongo import common
from pymongo.errors import ConfigurationError
from pymongo.synchronous.srv_resolver import _have_dnspython
from pymongo.uri_parser_shared import _have_dnspython
from test import PyMongoTestCase, client_knobs, unittest
from test.utils import wait_until

Expand Down
Loading