3
O6b                 @   s  d Z ddlZddlZddlZddlZddlZddlZddlmZ ddl	Z	ddl	m
Z
mZmZ ddlmZmZmZmZ ddlmZ ddlmZ ddlmZ dd	lmZ dd
lmZ ddlmZ ddlmZ ddl m!Z! ddl"m#Z#m$Z$m%Z%m&Z&m'Z' ddl(m)Z) ddl*m+Z+ ddl,m-Z- ej.ej/ej0ej1ej2ej3dZ4e5dddgZ6G dd dZ7G dd dZ8G dd deZ9e9e8j:dZ;e;Z<e9e8j=dZ>e9e8j?dZ@e9de7jAddZBdd  ZCd!d" ZDe<fd#d$ZEe<fd%d&ZFe<fd'd(ZGd)d* ZHd+d, ZId-d. ZJd/d0 ZKd1d2 ZLd3d4 ZMd5d6 ZNd7d8 ZOd9d: ZPd;d< ZQd=d> ZRd?d@ ZSdAdB ZTdCdD ZUdEdF ZVdGdH ZWdIdJ ZXdKdL ZYdMdN ZZe<fdOdPZ[dS )Qa  Tools for using Python's :mod:`json` module with BSON documents.

This module provides two helper methods `dumps` and `loads` that wrap the
native :mod:`json` methods and provide explicit BSON conversion to and from
JSON. :class:`~bson.json_util.JSONOptions` provides a way to control how JSON
is emitted and parsed, with the default being the legacy PyMongo format.
:mod:`~bson.json_util` can also generate Canonical or Relaxed `Extended JSON`_
when :const:`CANONICAL_JSON_OPTIONS` or :const:`RELAXED_JSON_OPTIONS` is
provided, respectively.

.. _Extended JSON: https://github.com/mongodb/specifications/blob/master/source/extended-json.rst

Example usage (deserialization):

.. doctest::

   >>> from bson.json_util import loads
   >>> loads('[{"foo": [1, 2]}, {"bar": {"hello": "world"}}, {"code": {"$scope": {}, "$code": "function x() { return 1; }"}}, {"bin": {"$type": "80", "$binary": "AQIDBA=="}}]')
   [{u'foo': [1, 2]}, {u'bar': {u'hello': u'world'}}, {u'code': Code('function x() { return 1; }', {})}, {u'bin': Binary('...', 128)}]

Example usage (serialization):

.. doctest::

   >>> from bson import Binary, Code
   >>> from bson.json_util import dumps
   >>> dumps([{'foo': [1, 2]},
   ...        {'bar': {'hello': 'world'}},
   ...        {'code': Code("function x() { return 1; }", {})},
   ...        {'bin': Binary(b"")}])
   '[{"foo": [1, 2]}, {"bar": {"hello": "world"}}, {"code": {"$code": "function x() { return 1; }", "$scope": {}}}, {"bin": {"$binary": "AQIDBA==", "$type": "00"}}]'

Example usage (with :const:`CANONICAL_JSON_OPTIONS`):

.. doctest::

   >>> from bson import Binary, Code
   >>> from bson.json_util import dumps, CANONICAL_JSON_OPTIONS
   >>> dumps([{'foo': [1, 2]},
   ...        {'bar': {'hello': 'world'}},
   ...        {'code': Code("function x() { return 1; }")},
   ...        {'bin': Binary(b"")}],
   ...       json_options=CANONICAL_JSON_OPTIONS)
   '[{"foo": [{"$numberInt": "1"}, {"$numberInt": "2"}]}, {"bar": {"hello": "world"}}, {"code": {"$code": "function x() { return 1; }"}}, {"bin": {"$binary": {"base64": "AQIDBA==", "subType": "00"}}}]'

Example usage (with :const:`RELAXED_JSON_OPTIONS`):

.. doctest::

   >>> from bson import Binary, Code
   >>> from bson.json_util import dumps, RELAXED_JSON_OPTIONS
   >>> dumps([{'foo': [1, 2]},
   ...        {'bar': {'hello': 'world'}},
   ...        {'code': Code("function x() { return 1; }")},
   ...        {'bin': Binary(b"")}],
   ...       json_options=RELAXED_JSON_OPTIONS)
   '[{"foo": [1, 2]}, {"bar": {"hello": "world"}}, {"code": {"$code": "function x() { return 1; }"}}, {"bin": {"$binary": {"base64": "AQIDBA==", "subType": "00"}}}]'

Alternatively, you can manually pass the `default` to :func:`json.dumps`.
It won't handle :class:`~bson.binary.Binary` and :class:`~bson.code.Code`
instances (as they are extended strings you can't provide custom defaults),
but it will be faster as there is less recursion.

.. note::
   If your application does not need the flexibility offered by
   :class:`JSONOptions` and spends a large amount of time in the `json_util`
   module, look to
   `python-bsonjs <https://pypi.python.org/pypi/python-bsonjs>`_ for a nice
   performance improvement. `python-bsonjs` is a fast BSON to MongoDB
   Extended JSON converter for Python built on top of
   `libbson <https://github.com/mongodb/libbson>`_. `python-bsonjs` works best
   with PyMongo when using :class:`~bson.raw_bson.RawBSONDocument`.

.. versionchanged:: 2.8
   The output format for :class:`~bson.timestamp.Timestamp` has changed from
   '{"t": <int>, "i": <int>}' to '{"$timestamp": {"t": <int>, "i": <int>}}'.
   This new format will be decoded to an instance of
   :class:`~bson.timestamp.Timestamp`. The old format will continue to be
   decoded to a python dict as before. Encoding to the old format is no longer
   supported as it was never correct and loses type information.
   Added support for $numberLong and $undefined - new in MongoDB 2.6 - and
   parsing $date in ISO-8601 format.

.. versionchanged:: 2.7
   Preserves order when rendering SON, Timestamp, Code, Binary, and DBRef
   instances.

.. versionchanged:: 2.3
   Added dumps and loads helpers to automatically handle conversion to and
   from json and supports :class:`~bson.binary.Binary` and
   :class:`~bson.code.Code`
    N)ConfigurationError)EPOCH_AWARERE_TYPESON)BinaryUuidRepresentationALL_UUID_SUBTYPESUUID_SUBTYPE)Code)CodecOptions)DBRef)
Decimal128)Int64)MaxKey)MinKey)ObjectId)PY3	iteritemsinteger_typesstring_type	text_type)Regex)	Timestamp)utc)ilmsuxz$idz$refz$dbc               @   s   e Zd ZdZdZdZdS )DatetimeRepresentationr         N)__name__
__module____qualname__LEGACY
NUMBERLONGISO8601 r)   r)   M/var/www/html/sandeepIITI/myenv/lib/python3.6/site-packages/bson/json_util.pyr       s   
r    c               @   s   e Zd ZdZdZdZdS )JSONModer   r!   r"   N)r#   r$   r%   r&   RELAXED	CANONICALr)   r)   r)   r*   r+      s   r+   c                   sN   e Zd ZdZdejdejf fdd	Z fddZ fddZ	d	d
 Z
  ZS )JSONOptionsaR  Encapsulates JSON options for :func:`dumps` and :func:`loads`.

    :Parameters:
      - `strict_number_long`: If ``True``, :class:`~bson.int64.Int64` objects
        are encoded to MongoDB Extended JSON's *Strict mode* type
        `NumberLong`, ie ``'{"$numberLong": "<number>" }'``. Otherwise they
        will be encoded as an `int`. Defaults to ``False``.
      - `datetime_representation`: The representation to use when encoding
        instances of :class:`datetime.datetime`. Defaults to
        :const:`~DatetimeRepresentation.LEGACY`.
      - `strict_uuid`: If ``True``, :class:`uuid.UUID` object are encoded to
        MongoDB Extended JSON's *Strict mode* type `Binary`. Otherwise it
        will be encoded as ``'{"$uuid": "<hex>" }'``. Defaults to ``False``.
      - `json_mode`: The :class:`JSONMode` to use when encoding BSON types to
        Extended JSON. Defaults to :const:`~JSONMode.LEGACY`.
      - `document_class`: BSON documents returned by :func:`loads` will be
        decoded to an instance of this class. Must be a subclass of
        :class:`collections.MutableMapping`. Defaults to :class:`dict`.
      - `uuid_representation`: The :class:`~bson.binary.UuidRepresentation`
        to use when encoding and decoding instances of :class:`uuid.UUID`.
        Defaults to :const:`~bson.binary.UuidRepresentation.PYTHON_LEGACY`.
      - `tz_aware`: If ``True``, MongoDB Extended JSON's *Strict mode* type
        `Date` will be decoded to timezone aware instances of
        :class:`datetime.datetime`. Otherwise they will be naive. Defaults
        to ``True``.
      - `tzinfo`: A :class:`datetime.tzinfo` subclass that specifies the
        timezone from which :class:`~datetime.datetime` objects should be
        decoded. Defaults to :const:`~bson.tz_util.utc`.
      - `args`: arguments to :class:`~bson.codec_options.CodecOptions`
      - `kwargs`: arguments to :class:`~bson.codec_options.CodecOptions`

    .. seealso:: The specification for Relaxed and Canonical `Extended JSON`_.

    .. versionadded:: 3.4

    .. versionchanged:: 3.5
       Accepts the optional parameter `json_mode`.

    Fc                s   |j dd|d< |d r(|j dt|d< |tjtjtjfkrDtdtt| j	| f||}|t
jt
jt
jfkrxtd||_|jt
jkrd|_tj|_d|_n4|jt
jkrd|_tj|_d|_n||_||_||_|S )Ntz_awareTtzinfoznJSONOptions.datetime_representation must be one of LEGACY, NUMBERLONG, or ISO8601 from DatetimeRepresentation.zQJSONOptions.json_mode must be one of LEGACY, RELAXED, or CANONICAL from JSONMode.F)getr   r    r&   r'   r(   r   superr.   __new__r+   r,   r-   	json_modestrict_number_longdatetime_representationstrict_uuid)clsr5   r6   r7   r4   argskwargsself)	__class__r)   r*   r3     s6    

zJSONOptions.__new__c                s$   d| j | j| j| jtt| j f S )NzSstrict_number_long=%r, datetime_representation=%r, strict_uuid=%r, json_mode=%r, %s)r5   r6   r7   r4   r2   r.   _arguments_repr)r;   )r<   r)   r*   r=   0  s    zJSONOptions._arguments_reprc                s.   t t| j }|j| j| j| j| jd |S )N)r5   r6   r7   r4   )r2   r.   _options_dictupdater5   r6   r7   r4   )r;   Zoptions_dict)r<   r)   r*   r>   :  s    zJSONOptions._options_dictc             K   s@   | j  }x"dD ]}|j|t| |||< qW |j| tf |S )a{  
        Make a copy of this JSONOptions, overriding some options::

            >>> from bson.json_util import CANONICAL_JSON_OPTIONS
            >>> CANONICAL_JSON_OPTIONS.tz_aware
            True
            >>> json_options = CANONICAL_JSON_OPTIONS.with_options(tz_aware=False)
            >>> json_options.tz_aware
            False

        .. versionadded:: 3.12
        r5   r6   r7   r4   )r5   r6   r7   r4   )r>   r1   getattrr?   r.   )r;   r:   optsoptr)   r)   r*   with_optionsD  s    
zJSONOptions.with_options)r#   r$   r%   __doc__r    r&   r+   r3   r=   r>   rC   __classcell__r)   r)   )r<   r*   r.      s   '!

r.   )r4   T)r5   r6   r7   c             O   s$   |j dt}tjt| |f||S )aW  Helper function that wraps :func:`json.dumps`.

    Recursive function that handles all BSON types including
    :class:`~bson.binary.Binary` and :class:`~bson.code.Code`.

    :Parameters:
      - `json_options`: A :class:`JSONOptions` instance used to modify the
        encoding of MongoDB Extended JSON types. Defaults to
        :const:`DEFAULT_JSON_OPTIONS`.

    .. versionchanged:: 3.4
       Accepts optional parameter `json_options`. See :class:`JSONOptions`.

    .. versionchanged:: 2.7
       Preserves order when rendering SON, Timestamp, Code, Binary, and DBRef
       instances.
    json_options)popDEFAULT_JSON_OPTIONSjsondumps_json_convert)objr9   r:   rF   r)   r)   r*   rJ     s    rJ   c                s.   |j dt  fdd|d< tj| f||S )a  Helper function that wraps :func:`json.loads`.

    Automatically passes the object_hook for BSON type conversion.

    Raises ``TypeError``, ``ValueError``, ``KeyError``, or
    :exc:`~bson.errors.InvalidId` on invalid MongoDB Extended JSON.

    :Parameters:
      - `json_options`: A :class:`JSONOptions` instance used to modify the
        decoding of MongoDB Extended JSON types. Defaults to
        :const:`DEFAULT_JSON_OPTIONS`.

    .. versionchanged:: 3.5
       Parses Relaxed and Canonical Extended JSON as well as PyMongo's legacy
       format. Now raises ``TypeError`` or ``ValueError`` when parsing JSON
       type wrappers with values of the wrong type or any extra keys.

    .. versionchanged:: 3.4
       Accepts optional parameter `json_options`. See :class:`JSONOptions`.
    rF   c                s
   t |  S )N)object_pairs_hook)pairs)rF   r)   r*   <lambda>  s   zloads.<locals>.<lambda>rM   )rG   rH   rI   loads)r   r9   r:   r)   )rF   r*   rP     s    rP   c                s   t | dst | dr.t fddt| D S t | dr^t| ttf r^t fdd| D S y
t|  S  tk
r|   | S X dS )z]Recursive helper method that converts BSON types so they can be
    converted into json.
    r   itemsc             3   s    | ]\}}|t | fV  qd S )N)rK   ).0kv)rF   r)   r*   	<genexpr>  s   z _json_convert.<locals>.<genexpr>__iter__c             3   s   | ]}t | V  qd S )N)rK   )rR   rT   )rF   r)   r*   rU     s    N)	hasattrr   r   
isinstancer   byteslistdefault	TypeError)rL   rF   r)   )rF   r*   rK     s    
rK   c             C   s   t |j| |S )N)object_hookZdocument_class)rN   rF   r)   r)   r*   rM     s    rM   c             C   sT  d| krt | S d| kr t| S d| kr2t| |S d| krBt| S d| krRt| S d| krbt| S d| krd| kr|t| |S t| |S d	| krt| S d
| krt	| |S d| krd S d| krt
| S d| kr| d }t|d |d S d| krt| S d| krt| S d| krt| S d| kr,t| S d| kr>t| S d| krPt| S | S )Nz$oidz$refz$datez$regexz$minKeyz$maxKeyz$binaryz$typez$codez$uuidz
$undefinedz$numberLongz
$timestamptr   z$numberDecimalz
$dbPointerz$regularExpressionz$symbolz
$numberIntz$numberDouble)_parse_canonical_oid_parse_canonical_dbref_parse_canonical_datetime_parse_legacy_regex_parse_canonical_minkey_parse_canonical_maxkey_parse_legacy_binary_parse_canonical_binary_parse_canonical_code_parse_legacy_uuid_parse_canonical_int64r   _parse_canonical_decimal128_parse_canonical_dbpointer_parse_canonical_regex_parse_canonical_symbol_parse_canonical_int32_parse_canonical_double)dctrF   Ztspr)   r)   r*   r]     sP    








r]   c             C   sJ   | d }t |tr| S d}x$| jddD ]}|tj|dO }q(W t||S )Nz$regexr   z$options )rX   r   r1   _RE_OPT_TABLE)docpatternflagsrB   r)   r)   r*   rb     s    
rb   c             C   sh   t | dkrtd| f t| d ts6td| f |jtjkrVtjt	j
| d S t	j
| d S dS )z*Decode a JSON legacy $uuid to Python UUID.r!   zBad $uuid, extra field(s): %sz$uuidz$uuid must be a string: %sN)lenr\   rX   r   uuid_representationr   UNSPECIFIEDr   	from_uuiduuidUUID)rs   rF   r)   r)   r*   rh     s    rh   c             C   sj   |t krP|j}t| |}|tjkr&|S |tkr6tj}n|tjkrFtj}|j|S t	r`|dkr`| S t| |S )Nr   )
r   rw   r   r   rx   r	   ZSTANDARDZPYTHON_LEGACYZas_uuidr   )datasubtyperF   rw   Zbinary_valuer)   r)   r*   _binary_or_uuid  s    



r~   c             C   sh   t | d trd| d  | d< t| d d}|dkrJt| d dd  d}tj| d j }t|||S )Nz$typez%02x   l       z$binary)rX   intbase64	b64decodeencoder~   )rs   rF   r}   r|   r)   r)   r*   re   &  s    re   c             C   s   | d }|d }|d }t |ts0td| f t |t sHt|dkrVtd| f t|dkrptd| f tj|j }t|t|d|S )	Nz$binaryr   subTypez#$binary base64 must be a string: %sr"   z9$binary subType must be a string at most 2 characters: %sz?$binary must include only "base64" and "subType" components: %sr   )	rX   r   r\   rv   r   r   r   r~   r   )rs   rF   binaryZb64r}   r|   r)   r)   r*   rf   0  s    


rf   c             C   s0  | d }t | dkr"td| f t|tr |d dkrL|dd }d}n|d dkr~|d d
kr~|dd }|dd }nT|d dkr|dd }|d d }n.|d! d"kr|dd# }|d$d }n|}d}|jd}d}|d%krtt||d d }|d| }tjj|dj	|t
d}|r|dkrt |dkrt|dd jd
\}}	t|d t|	d  }
nZt |dkrt|dd	 d t|d	d d  }
n"t |d	krt|dd	 d }
|d dkr|
d&9 }
|tj|
d }|jr|jr|j|j}|S |j	ddS tjt||S )'z3Decode a JSON datetime to python datetime.datetime.z$dater!   zBad $date, extra field(s): %sZNr   +-   :   rq   .r   i@B z%Y-%m-%dT%H:%M:%S)microsecondr0   i  <   )seconds)r0   r   i)r   r   ii)r   r   r   r   r   )r   r   r   r   r   r   )rv   r\   rX   r   rfindr   floatdatetimestrptimereplacer   split	timedeltar/   r0   
astimezonebsonZ_millis_to_datetime)rs   rF   ZdtmdtoffsetZ	dot_indexr   ZawarehoursminutesZsecsr)   r)   r*   ra   A  sV    


*ra   c             C   s&   t | dkrtd| f t| d S )z1Decode a JSON ObjectId to bson.objectid.ObjectId.r!   zBad $oid, extra field(s): %sz$oid)rv   r\   r   )rs   r)   r)   r*   r_   |  s    r_   c             C   s*   | d }t | dkr"td| f t|S )z&Decode a JSON symbol to Python string.z$symbolr!   zBad $symbol, extra field(s): %s)rv   r\   r   )rs   symbolr)   r)   r*   rm     s    rm   c             C   s:   x"| D ]}|dkrt d| f qW t| d | jddS )z%Decode a JSON code to bson.code.Code.$code$scopezBad $code, extra field(s): %s)scope)r   r   )r\   r
   r1   )rs   keyr)   r)   r*   rg     s    
rg   c             C   sN   | d }t | dkr"td| f t |dkr<td| f t|d |d S )z(Decode a JSON regex to bson.regex.Regex.z$regularExpressionr!   z*Bad $regularExpression, extra field(s): %sr"   zNBad $regularExpression must include only "pattern"and "options" components: %srt   options)rv   r\   r   )rs   regexr)   r)   r*   rl     s    
rl   c             C   sN   x"| D ]}|j dr|tkr| S qW t| jd| jdfd| jddi| S )z(Decode a JSON DBRef to bson.dbref.DBRef.$z$refz$iddatabasez$dbN)
startswith_DBREF_KEYSr   rG   )rs   r   r)   r)   r*   r`     s
    
r`   c             C   s   | d }t | dkr"td| f t|tr|j }|jdk	rLtd|f t|jtsftd|f t |dkrtd|f |S td	| f dS )
z9Decode a JSON (deprecated) DBPointer to bson.dbref.DBRef.z
$dbPointerr!   z"Bad $dbPointer, extra field(s): %sNz#Bad $dbPointer, extra field $db: %sz+Bad $dbPointer, $id must be an ObjectId: %sr"   z+Bad $dbPointer, extra field(s) in DBRef: %sz$Bad $dbPointer, expected a DBRef: %s)rv   r\   rX   r   as_docr   idr   )rs   ZdbrefZ	dbref_docr)   r)   r*   rk     s     

rk   c             C   sB   | d }t | dkr"td| f t|ts:td| f t|S )z"Decode a JSON int32 to python int.z
$numberIntr!   z"Bad $numberInt, extra field(s): %sz$numberInt must be string: %s)rv   r\   rX   r   r   )rs   Zi_strr)   r)   r*   rn     s    
rn   c             C   s*   | d }t | dkr"td| f t|S )z(Decode a JSON int64 to bson.int64.Int64.z$numberLongr!   z#Bad $numberLong, extra field(s): %s)rv   r\   r   )rs   Zl_strr)   r)   r*   ri     s    ri   c             C   sB   | d }t | dkr"td| f t|ts:td| f t|S )z%Decode a JSON double to python float.z$numberDoubler!   z%Bad $numberDouble, extra field(s): %sz $numberDouble must be string: %s)rv   r\   rX   r   r   )rs   d_strr)   r)   r*   ro     s    
ro   c             C   sB   | d }t | dkr"td| f t|ts:td| f t|S )z7Decode a JSON decimal128 to bson.decimal128.Decimal128.z$numberDecimalr!   z&Bad $numberDecimal, extra field(s): %sz!$numberDecimal must be string: %s)rv   r\   rX   r   r   )rs   r   r)   r)   r*   rj     s    
rj   c             C   sJ   t | d tk	s| d dkr*td| f t| dkrDtd| f t S )z,Decode a JSON MinKey to bson.min_key.MinKey.z$minKeyr!   z$minKey value must be 1: %szBad $minKey, extra field(s): %s)typer   r\   rv   r   )rs   r)   r)   r*   rc     s
    rc   c             C   sH   t | d tk	s| d dkr(td| ft| dkrBtd| f t S )z,Decode a JSON MaxKey to bson.max_key.MaxKey.z$maxKeyr!   z$maxKey value must be 1: %szBad $minKey, extra field(s): %s)r   r   r\   rv   r   )rs   r)   r)   r*   rd     s
    rd   c             C   sT   |j tjkr.tdtj| j fdd| fgS dtdtj| j fdd| fgiS )Nz$binaryz$typez%02xr   r   )r4   r+   r&   r   r   	b64encodedecode)r|   r}   rF   r)   r)   r*   _encode_binary  s    r   c       
      C   s  t | trdt| iS t | tr0t| j |dS t | tj r|jtj	kr| j
s\| jtd} | tkr| j
j| }|j|j|jfd,krd}n
| jd}t| jd }|rd|f nd	}d
d| jd||f iS tj| }|jtjkrd
|iS d
dt|iiS |jrt | trdt| iS t | ttfrd	}| jtj@ rD|d7 }| jtj@ rZ|d7 }| jtj @ rp|d7 }| jtj!@ r|d7 }| jtj"@ r|d7 }| jtj#@ r|d7 }t | j$t%r| j$}n| j$j&d}|j't(jkrt)d|fd|fgS dt)d|fd|fgiS t | t*r"ddiS t | t+r6ddiS t | t,r^dt)d| j-fd| j.fgiS t | t/r| j0d krdt| iS t)dt| fd t| j0|fgS t | t1rt2| | j3|S t4rt | t5rt2| d|S t | t6j7r|j8rt1j9| |j:d!}t2||j3|S d"| j;iS t | t<r0d#t| iS t | t=r@| S |j't(j>krt | t?rd.|   kond/k n  rd&t%| iS dt%| iS |j't(jkr t | t@r tAjB| rd'd(iS tAjC| r| dkrd)nd*}	d'|	iS |j't(j>kr d't%tD| iS tEd+|  d S )0Nz$oid)rF   )r0   r   r   z%zi  z.%03drq   z$datez%s%s%sz%Y-%m-%dT%H:%M:%Sz$numberLongr   r   r   r   r   r   zutf-8z$regexz$optionsz$regularExpressionrt   r   z$minKeyr!   z$maxKeyz
$timestampr^   z$codez$scope)rw   z$uuidz$numberDecimalr"      z
$numberIntz$numberDoubleNaNInfinityz	-Infinityz%r is not JSON serializable)r   r   r   l        i   l        )FrX   r   strr   rK   r   r   r6   r    r(   r0   r   r   r   	utcoffsetdaysr   microsecondsstrftimer   r   r   Z_datetime_to_millisr&   r5   r   r   r   ru   re
IGNORECASELOCALE	MULTILINEDOTALLUNICODEVERBOSErt   r   r   r4   r+   r   r   r   r   timeincr
   r   r   r   r}   r   rY   rz   r{   r7   ry   rw   hexr   boolr-   r   r   mathisnanisinfreprr\   )
rL   rF   offZ	tz_stringZmillisZfracsecsru   rt   ZbinvalZrepresentationr)   r)   r*   r[      s    






r[   )\rD   r   r   rI   r   r   rz   Zpymongo.errorsr   r   r   r   r   Zbson.binaryr   r   r   r	   Z	bson.coder
   Zbson.codec_optionsr   Z
bson.dbrefr   Zbson.decimal128r   Z
bson.int64r   Zbson.max_keyr   Zbson.min_keyr   Zbson.objectidr   Zbson.py3compatr   r   r   r   r   Z
bson.regexr   Zbson.timestampr   Zbson.tz_utilr   ILMSUXrr   	frozensetr   r    r+   r.   r&   ZLEGACY_JSON_OPTIONSrH   r-   ZCANONICAL_JSON_OPTIONSr,   ZRELAXED_JSON_OPTIONSr(   ZSTRICT_JSON_OPTIONSrJ   rP   rK   rM   r]   rb   rh   r~   re   rf   ra   r_   rm   rg   rl   r`   rk   rn   ri   ro   rj   rc   rd   r   r[   r)   r)   r)   r*   <module>j   s   
$+u	,
;



		
