Skip to content

Commit 8028eb2

Browse files
committed
add method to convert case insensitive dict to plain dict
1 parent 578c6c2 commit 8028eb2

File tree

4 files changed

+6
-3
lines changed

4 files changed

+6
-3
lines changed

pymongo/asynchronous/uri_parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,5 +184,5 @@ async def _parse_srv(
184184

185185
return {
186186
"nodelist": nodes,
187-
"options": options,
187+
"options": options.as_dict(),
188188
}

pymongo/common.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1083,6 +1083,9 @@ def update(self, other: Mapping[str, Any]) -> None: # type: ignore[override]
10831083
def cased_key(self, key: str) -> Any:
10841084
return self.__casedkeys[key.lower()]
10851085

1086+
def as_dict(self) -> dict[str, Any]:
1087+
return {self.__casedkeys[k]: self.__data[k] for k in self}
1088+
10861089

10871090
def has_c() -> bool:
10881091
"""Is the C extension installed?"""

pymongo/synchronous/uri_parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,5 +184,5 @@ def _parse_srv(
184184

185185
return {
186186
"nodelist": nodes,
187-
"options": options,
187+
"options": options.as_dict(),
188188
}

pymongo/uri_parser_shared.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,6 @@ def _validate_uri(
547547
"password": passwd,
548548
"database": dbase,
549549
"collection": collection,
550-
"options": options,
550+
"options": options.as_dict(),
551551
"fqdn": fqdn,
552552
}

0 commit comments

Comments
 (0)