PYTHON-3375 Added docstrings to DatetimeConversionOpts (#1024)

* Added docstrings

* Fixed detail

* Fixed punctuation and links

Co-authored-by: Ben Warner <ben.warner@mongodb.com>
This commit is contained in:
Ben Warner 2022-07-29 15:53:38 -07:00 committed by GitHub
parent 1166bb96cd
commit fbb8dde826
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -200,10 +200,38 @@ class TypeRegistry(object):
class DatetimeConversionOpts(enum.IntEnum):
"""Options for decoding BSON datetimes."""
DATETIME = 1
"""Decode a BSON UTC datetime as a :class:`datetime.datetime`.
BSON UTC datetimes that cannot be represented as a
:class:`~datetime.datetime` will raise an :class:`OverflowError`
or a :class:`ValueError`.
.. versionadded 4.3
"""
DATETIME_CLAMP = 2
"""Decode a BSON UTC datetime as a :class:`datetime.datetime`, clamping
to :attr:`~datetime.datetime.min` and :attr:`~datetime.datetime.max`.
.. versionadded 4.3
"""
DATETIME_MS = 3
"""Decode a BSON UTC datetime as a :class:`~bson.datetime_ms.DatetimeMS`
object.
.. versionadded 4.3
"""
DATETIME_AUTO = 4
"""Decode a BSON UTC datetime as a :class:`datetime.datetime` if possible,
and a :class:`~bson.datetime_ms.DatetimeMS` if not.
.. versionadded 4.3
"""
class _BaseCodecOptions(NamedTuple):