Skip to content

Commit b6920f1

Browse files
committed
Refactor
1 parent 5c823fc commit b6920f1

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

pymongo/asynchronous/srv_resolver.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,9 @@ def __init__(
9090
raise ConfigurationError(_INVALID_HOST_MSG % ("an IP address",))
9191
except ValueError:
9292
pass
93-
9493
try:
95-
self.__plist = (
96-
self.__fqdn.split(".")[1:]
97-
if len(self.__fqdn.split(".")) > 2
98-
else self.__fqdn.split(".")
99-
)
94+
split_fqdn = self.__fqdn.split(".")
95+
self.__plist = split_fqdn[1:] if len(split_fqdn) > 2 else split_fqdn
10096
except Exception:
10197
raise ConfigurationError(_INVALID_HOST_MSG % (fqdn,)) from None
10298
self.__slen = len(self.__plist)

pymongo/synchronous/srv_resolver.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,9 @@ def __init__(
9090
raise ConfigurationError(_INVALID_HOST_MSG % ("an IP address",))
9191
except ValueError:
9292
pass
93-
9493
try:
95-
self.__plist = (
96-
self.__fqdn.split(".")[1:]
97-
if len(self.__fqdn.split(".")) > 2
98-
else self.__fqdn.split(".")
99-
)
94+
split_fqdn = self.__fqdn.split(".")
95+
self.__plist = split_fqdn[1:] if len(split_fqdn) > 2 else split_fqdn
10096
except Exception:
10197
raise ConfigurationError(_INVALID_HOST_MSG % (fqdn,)) from None
10298
self.__slen = len(self.__plist)

0 commit comments

Comments
 (0)