Skip to content

Commit fbb8dde

Browse files
bcwarnerBen Warner
andauthored
PYTHON-3375 Added docstrings to DatetimeConversionOpts (#1024)
* Added docstrings * Fixed detail * Fixed punctuation and links Co-authored-by: Ben Warner <[email protected]>
1 parent 1166bb9 commit fbb8dde

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

bson/codec_options.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,10 +200,38 @@ def __eq__(self, other: Any) -> Any:
200200

201201

202202
class DatetimeConversionOpts(enum.IntEnum):
203+
"""Options for decoding BSON datetimes."""
204+
203205
DATETIME = 1
206+
"""Decode a BSON UTC datetime as a :class:`datetime.datetime`.
207+
208+
BSON UTC datetimes that cannot be represented as a
209+
:class:`~datetime.datetime` will raise an :class:`OverflowError`
210+
or a :class:`ValueError`.
211+
212+
.. versionadded 4.3
213+
"""
214+
204215
DATETIME_CLAMP = 2
216+
"""Decode a BSON UTC datetime as a :class:`datetime.datetime`, clamping
217+
to :attr:`~datetime.datetime.min` and :attr:`~datetime.datetime.max`.
218+
219+
.. versionadded 4.3
220+
"""
221+
205222
DATETIME_MS = 3
223+
"""Decode a BSON UTC datetime as a :class:`~bson.datetime_ms.DatetimeMS`
224+
object.
225+
226+
.. versionadded 4.3
227+
"""
228+
206229
DATETIME_AUTO = 4
230+
"""Decode a BSON UTC datetime as a :class:`datetime.datetime` if possible,
231+
and a :class:`~bson.datetime_ms.DatetimeMS` if not.
232+
233+
.. versionadded 4.3
234+
"""
207235

208236

209237
class _BaseCodecOptions(NamedTuple):

0 commit comments

Comments
 (0)