From 65246f6b7b1e91bdb04f0e3e22013b30137cfa12 Mon Sep 17 00:00:00 2001 From: Casey Clements Date: Thu, 6 Feb 2025 11:56:41 -0500 Subject: [PATCH 1/4] MongoClients docstring change: Moved datetime_conversion to kwarg and cleaned up formatting of last param --- pymongo/asynchronous/mongo_client.py | 9 +++++---- pymongo/synchronous/mongo_client.py | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/pymongo/asynchronous/mongo_client.py b/pymongo/asynchronous/mongo_client.py index 365fc62100..699e23771c 100644 --- a/pymongo/asynchronous/mongo_client.py +++ b/pymongo/asynchronous/mongo_client.py @@ -276,7 +276,11 @@ def __init__( :param type_registry: instance of :class:`~bson.codec_options.TypeRegistry` to enable encoding and decoding of custom types. - :param datetime_conversion: Specifies how UTC datetimes should be decoded + :param kwargs: ... + + | **Other optional parameters can be passed as keyword arguments:** + + - `datetime_conversion` (optional): Specifies how UTC datetimes should be decoded within BSON. Valid options include 'datetime_ms' to return as a DatetimeMS, 'datetime' to return as a datetime.datetime and raising a ValueError for out-of-range values, 'datetime_auto' to @@ -284,9 +288,6 @@ def __init__( out-of-range and 'datetime_clamp' to clamp to the minimum and maximum possible datetimes. Defaults to 'datetime'. See :ref:`handling-out-of-range-datetimes` for details. - - | **Other optional parameters can be passed as keyword arguments:** - - `directConnection` (optional): if ``True``, forces this client to connect directly to the specified MongoDB host as a standalone. If ``false``, the client connects to the entire replica set of diff --git a/pymongo/synchronous/mongo_client.py b/pymongo/synchronous/mongo_client.py index 8cd08ab725..da4933afbd 100644 --- a/pymongo/synchronous/mongo_client.py +++ b/pymongo/synchronous/mongo_client.py @@ -274,7 +274,11 @@ def __init__( :param type_registry: instance of :class:`~bson.codec_options.TypeRegistry` to enable encoding and decoding of custom types. - :param datetime_conversion: Specifies how UTC datetimes should be decoded + :param kwargs: ... + + | **Other optional parameters can be passed as keyword arguments:** + + - `datetime_conversion` (optional): Specifies how UTC datetimes should be decoded within BSON. Valid options include 'datetime_ms' to return as a DatetimeMS, 'datetime' to return as a datetime.datetime and raising a ValueError for out-of-range values, 'datetime_auto' to @@ -282,9 +286,6 @@ def __init__( out-of-range and 'datetime_clamp' to clamp to the minimum and maximum possible datetimes. Defaults to 'datetime'. See :ref:`handling-out-of-range-datetimes` for details. - - | **Other optional parameters can be passed as keyword arguments:** - - `directConnection` (optional): if ``True``, forces this client to connect directly to the specified MongoDB host as a standalone. If ``false``, the client connects to the entire replica set of From 98ae9e0cad58078094f97a4030d654c9f3f6cca0 Mon Sep 17 00:00:00 2001 From: Casey Clements Date: Thu, 6 Feb 2025 12:10:16 -0500 Subject: [PATCH 2/4] Cleaner looking output --- pymongo/asynchronous/mongo_client.py | 4 +--- pymongo/synchronous/mongo_client.py | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/pymongo/asynchronous/mongo_client.py b/pymongo/asynchronous/mongo_client.py index 699e23771c..7ae84ed358 100644 --- a/pymongo/asynchronous/mongo_client.py +++ b/pymongo/asynchronous/mongo_client.py @@ -276,9 +276,7 @@ def __init__( :param type_registry: instance of :class:`~bson.codec_options.TypeRegistry` to enable encoding and decoding of custom types. - :param kwargs: ... - - | **Other optional parameters can be passed as keyword arguments:** + :param kwargs: Additional optional parameters available as keyword arguments - `datetime_conversion` (optional): Specifies how UTC datetimes should be decoded within BSON. Valid options include 'datetime_ms' to return as a diff --git a/pymongo/synchronous/mongo_client.py b/pymongo/synchronous/mongo_client.py index da4933afbd..6502bab886 100644 --- a/pymongo/synchronous/mongo_client.py +++ b/pymongo/synchronous/mongo_client.py @@ -274,9 +274,7 @@ def __init__( :param type_registry: instance of :class:`~bson.codec_options.TypeRegistry` to enable encoding and decoding of custom types. - :param kwargs: ... - - | **Other optional parameters can be passed as keyword arguments:** + :param kwargs: Additional optional parameters available as keyword arguments - `datetime_conversion` (optional): Specifies how UTC datetimes should be decoded within BSON. Valid options include 'datetime_ms' to return as a From 4b5b59f55938627d8c3d1aa6b1ff9e6f4efa2200 Mon Sep 17 00:00:00 2001 From: Casey Clements Date: Thu, 6 Feb 2025 12:12:19 -0500 Subject: [PATCH 3/4] Updates just docs command to match justfile --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 536110fcfc..c1fd27a67d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -178,7 +178,7 @@ documentation including narrative docs, and the [Sphinx docstring format](https: You can build the documentation locally by running: ```bash -just docs-build +just docs ``` When updating docs, it can be helpful to run the live docs server as: From 3883cecd9eb93aaaa2cb0000aa3a7e3136b52baa Mon Sep 17 00:00:00 2001 From: Casey Clements Date: Mon, 10 Feb 2025 14:49:12 -0500 Subject: [PATCH 4/4] Bolds description of kwargs in mongo_client and ends in colon. --- pymongo/asynchronous/mongo_client.py | 2 +- pymongo/synchronous/mongo_client.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pymongo/asynchronous/mongo_client.py b/pymongo/asynchronous/mongo_client.py index 7ae84ed358..d0be6ee21e 100644 --- a/pymongo/asynchronous/mongo_client.py +++ b/pymongo/asynchronous/mongo_client.py @@ -276,7 +276,7 @@ def __init__( :param type_registry: instance of :class:`~bson.codec_options.TypeRegistry` to enable encoding and decoding of custom types. - :param kwargs: Additional optional parameters available as keyword arguments + :param kwargs: **Additional optional parameters available as keyword arguments:** - `datetime_conversion` (optional): Specifies how UTC datetimes should be decoded within BSON. Valid options include 'datetime_ms' to return as a diff --git a/pymongo/synchronous/mongo_client.py b/pymongo/synchronous/mongo_client.py index 6502bab886..3ed5a49ac0 100644 --- a/pymongo/synchronous/mongo_client.py +++ b/pymongo/synchronous/mongo_client.py @@ -274,7 +274,7 @@ def __init__( :param type_registry: instance of :class:`~bson.codec_options.TypeRegistry` to enable encoding and decoding of custom types. - :param kwargs: Additional optional parameters available as keyword arguments + :param kwargs: **Additional optional parameters available as keyword arguments:** - `datetime_conversion` (optional): Specifies how UTC datetimes should be decoded within BSON. Valid options include 'datetime_ms' to return as a