Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions bson/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@
the microsecond field is truncated.
.. [#dt2] all datetime.datetime instances are encoded as UTC. By default, they
are decoded as *naive* but timezone aware datetimes are also supported.
See :doc:`/examples/datetimes` for examples.
See `Dates and Times <https://www.mongodb.com/docs/languages/python/pymongo-driver/current/data-formats/dates-and-times/#dates-and-times>`_ for examples.
.. [#dt3] To enable decoding a bson UTC datetime to a :class:`~bson.datetime_ms.DatetimeMS`
instance see :ref:`handling-out-of-range-datetimes`.
.. [#uuid] For :py:class:`uuid.UUID` encoding and decoding behavior see :doc:`/examples/uuid`.
instance see `handling out of range datetimes <https://www.mongodb.com/docs/languages/python/pymongo-driver/current/data-formats/dates-and-times/#handling-out-of-range-datetimes>`_.
.. [#uuid] For :py:class:`uuid.UUID` encoding and decoding behavior see `<https://www.mongodb.com/docs/languages/python/pymongo-driver/current/data-formats/uuid/#universally-unique-ids--uuids->`_.
.. [#re] :class:`~bson.regex.Regex` instances and regular expression
objects from ``re.compile()`` are both saved as BSON regular expressions.
BSON regular expressions are decoded as :class:`~bson.regex.Regex`
Expand Down
14 changes: 7 additions & 7 deletions bson/binary.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class UuidRepresentation:
:class:`~bson.binary.Binary` instance will be returned instead of a
:class:`uuid.UUID` instance.

See :ref:`unspecified-representation-details` for details.
See `unspecified representation details <https://www.mongodb.com/docs/languages/python/pymongo-driver/current/data-formats/uuid/#unspecified>`_ for details.

.. versionadded:: 3.11
"""
Expand All @@ -91,7 +91,7 @@ class UuidRepresentation:
and decoded from BSON binary, using RFC-4122 byte order with
binary subtype :data:`UUID_SUBTYPE`.

See :ref:`standard-representation-details` for details.
See `standard representation details <https://www.mongodb.com/docs/languages/python/pymongo-driver/current/data-formats/uuid/#standard>`_ for details.

.. versionadded:: 3.11
"""
Expand All @@ -103,7 +103,7 @@ class UuidRepresentation:
and decoded from BSON binary, using RFC-4122 byte order with
binary subtype :data:`OLD_UUID_SUBTYPE`.

See :ref:`python-legacy-representation-details` for details.
See `python legacy representation details <https://www.mongodb.com/docs/languages/python/pymongo-driver/current/data-formats/uuid/#python_legacy>`_ for details.

.. versionadded:: 3.11
"""
Expand All @@ -115,7 +115,7 @@ class UuidRepresentation:
and decoded from BSON binary subtype :data:`OLD_UUID_SUBTYPE`,
using the Java driver's legacy byte order.

See :ref:`java-legacy-representation-details` for details.
See `Java Legacy UUID <https://www.mongodb.com/docs/languages/python/pymongo-driver/current/data-formats/uuid/#java_legacy>`_ for details.

.. versionadded:: 3.11
"""
Expand All @@ -127,7 +127,7 @@ class UuidRepresentation:
and decoded from BSON binary subtype :data:`OLD_UUID_SUBTYPE`,
using the C# driver's legacy byte order.

See :ref:`csharp-legacy-representation-details` for details.
See `C# Legacy UUID <https://www.mongodb.com/docs/languages/python/pymongo-driver/current/data-formats/uuid/#csharp_legacy>`_ for details.

.. versionadded:: 3.11
"""
Expand Down Expand Up @@ -328,7 +328,7 @@ def from_uuid(
:param uuid_representation: A member of
:class:`~bson.binary.UuidRepresentation`. Default:
:const:`~bson.binary.UuidRepresentation.STANDARD`.
See :ref:`handling-uuid-data-example` for details.
See `UUID representations <https://www.mongodb.com/docs/languages/python/pymongo-driver/current/data-formats/uuid/#universally-unique-ids--uuids->`_ for details.

.. versionadded:: 3.11
"""
Expand Down Expand Up @@ -377,7 +377,7 @@ def as_uuid(self, uuid_representation: int = UuidRepresentation.STANDARD) -> UUI
:param uuid_representation: A member of
:class:`~bson.binary.UuidRepresentation`. Default:
:const:`~bson.binary.UuidRepresentation.STANDARD`.
See :ref:`handling-uuid-data-example` for details.
See `UUID representations <https://www.mongodb.com/docs/languages/python/pymongo-driver/current/data-formats/uuid/#universally-unique-ids--uuids->`_ for details.

.. versionadded:: 3.11
"""
Expand Down
16 changes: 8 additions & 8 deletions bson/codec_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class TypeEncoder(abc.ABC):
Codec classes must implement the ``python_type`` attribute, and the
``transform_python`` method to support encoding.

See :ref:`custom-type-type-codec` documentation for an example.
See `encode data with type codecs <https://www.mongodb.com/docs/languages/python/pymongo-driver/current/data-formats/custom-types/type-codecs/#encode-data-with-type-codecs>`_ documentation for an example.
"""

@abc.abstractproperty
Expand All @@ -76,7 +76,7 @@ class TypeDecoder(abc.ABC):
Codec classes must implement the ``bson_type`` attribute, and the
``transform_bson`` method to support decoding.

See :ref:`custom-type-type-codec` documentation for an example.
See `encode data with type codecs <https://www.mongodb.com/docs/languages/python/pymongo-driver/current/data-formats/custom-types/type-codecs/#encode-data-with-type-codecs>`_ documentation for an example.
"""

@abc.abstractproperty
Expand All @@ -98,7 +98,7 @@ class TypeCodec(TypeEncoder, TypeDecoder):
``bson_type`` attribute, and the ``transform_bson`` method to support
decoding.

See :ref:`custom-type-type-codec` documentation for an example.
See `encode data with type codecs <https://www.mongodb.com/docs/languages/python/pymongo-driver/current/data-formats/custom-types/type-codecs/#encode-data-with-type-codecs>`_ documentation for an example.
"""


Expand All @@ -118,7 +118,7 @@ class TypeRegistry:
>>> type_registry = TypeRegistry([Codec1, Codec2, Codec3, ...],
... fallback_encoder)

See :ref:`custom-type-type-registry` documentation for an example.
See `add codec to the type registry <https://www.mongodb.com/docs/languages/python/pymongo-driver/current/data-formats/custom-types/type-codecs/#add-codec-to-the-type-registry>`_ documentation for an example.

:param type_codecs: iterable of type codec instances. If
``type_codecs`` contains multiple codecs that transform a single
Expand All @@ -128,7 +128,7 @@ class TypeRegistry:
type.
:param fallback_encoder: callable that accepts a single,
unencodable python value and transforms it into a type that
:mod:`bson` can encode. See :ref:`fallback-encoder-callable`
:mod:`bson` can encode. See `define a fallback encoder <https://www.mongodb.com/docs/languages/python/pymongo-driver/current/data-formats/custom-types/type-codecs/#define-a-fallback-encoder>`_
documentation for an example.
"""

Expand Down Expand Up @@ -327,10 +327,10 @@ def __init__(self, *args, **kwargs):
>>> doc._id
ObjectId('5b3016359110ea14e8c58b93')

See :doc:`/examples/datetimes` for examples using the `tz_aware` and
See `Dates and Times <https://www.mongodb.com/docs/languages/python/pymongo-driver/current/data-formats/dates-and-times/#dates-and-times>`_ for examples using the `tz_aware` and
`tzinfo` options.

See :doc:`/examples/uuid` for examples using the `uuid_representation`
See `UUID <https://www.mongodb.com/docs/languages/python/pymongo-driver/current/data-formats/uuid/#universally-unique-ids--uuids->`_ for examples using the `uuid_representation`
option.

:param document_class: BSON documents returned in queries will be decoded
Expand All @@ -344,7 +344,7 @@ def __init__(self, *args, **kwargs):
:data:`~bson.binary.UuidRepresentation.UNSPECIFIED`. New
applications should consider setting this to
:data:`~bson.binary.UuidRepresentation.STANDARD` for cross language
compatibility. See :ref:`handling-uuid-data-example` for details.
compatibility. See `UUID representations <https://www.mongodb.com/docs/languages/python/pymongo-driver/current/data-formats/uuid/#universally-unique-ids--uuids->`_ for details.
:param unicode_decode_error_handler: The error handler to apply when
a Unicode-related error occurs during BSON decoding that would
otherwise raise :exc:`UnicodeDecodeError`. Valid options include
Expand Down
2 changes: 1 addition & 1 deletion bson/datetime_ms.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def __init__(self, value: Union[int, datetime.datetime]):

To decode UTC datetimes as a ``DatetimeMS``, `datetime_conversion` in
:class:`~bson.codec_options.CodecOptions` must be set to 'datetime_ms' or
'datetime_auto'. See :ref:`handling-out-of-range-datetimes` for
'datetime_auto'. See `handling out of range datetimes <https://www.mongodb.com/docs/languages/python/pymongo-driver/current/data-formats/dates-and-times/#handling-out-of-range-datetimes>`_ for
details.

:param value: An instance of :class:`datetime.datetime` to be
Expand Down
2 changes: 1 addition & 1 deletion bson/json_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ def __init__(self, *args: Any, **kwargs: Any):
return DatetimeMS objects when the underlying datetime is
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.
`handling out of range datetimes <https://www.mongodb.com/docs/languages/python/pymongo-driver/current/data-formats/dates-and-times/#handling-out-of-range-datetimes>`_ for details.
:param args: arguments to :class:`~bson.codec_options.CodecOptions`
:param kwargs: arguments to :class:`~bson.codec_options.CodecOptions`

Expand Down
Loading
Loading