Skip to content

Commit 0a73bbe

Browse files
committed
use more efficient loop pattern
1 parent 478f238 commit 0a73bbe

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pymongo/common.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,7 @@ def get_validated_options(options, warn=True):
690690
691691
:Parameters:
692692
- `opts`: A dict of MongoDB URI options.
693-
- `warn` (optional): If ``True`` then warnigns will be logged and
693+
- `warn` (optional): If ``True`` then warnings will be logged and
694694
invalid options will be ignored. Otherwise, invalid options will
695695
cause errors.
696696
"""
@@ -716,11 +716,12 @@ def _handle_option_deprecations(options):
716716
options dictionary. Removes deprecated option key, value pairs if the
717717
options dictionary is found to also have the renamed option."""
718718
undeprecated_options = {}
719+
lc_optnames = [n.lower() for n in options]
719720
for key, value in iteritems(options):
720721
optname = str(key).lower()
721722
if optname in URI_OPTIONS_DEPRECATION_MAP:
722723
renamed_key = URI_OPTIONS_DEPRECATION_MAP[optname]
723-
if any(renamed_key.lower() == n.lower() for n in options):
724+
if renamed_key.lower() in lc_optnames:
724725
warnings.warn("Deprecated option '%s' ignored in favor of "
725726
"'%s'." % (str(key), renamed_key))
726727
continue

0 commit comments

Comments
 (0)