
    -Phw                    h    d Z ddlmZ ddlZddlZddlZddlmZ erddlmZ dd
Z	ddddZ
ddZdS )z-Serialise objects to a stable representation.    )annotationsN)TYPE_CHECKING)Anyobjr   returnstrc                (   t          | t                    r4t          t          t          |                                                     } t          | t          t          z  t          z  t          z            r#t          t          t          |                     } n3t          | t          t          j        z            r| j         d| j         } t          j        t#          |                                           d                                          S )zReturn a stable hash for a Python data structure.

    We can't just use the md5 of str(obj) as the order of collections
    may be random.
    .F)usedforsecurity)
isinstancedictsortedmapstable_hashitemslisttupleset	frozensettypetypesFunctionType
__module____qualname__hashlibmd5r   encode	hexdigestr   s    V/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/sphinx/util/_serialise.pyr   r      s     #t 4Sciikk2233#te|c)I566 5Sc**++	C 22	3	3 5 44#"244;s3xx((%@@@JJLLL    indentr#   
int | Nonec               H    t          j        t          |           |          S )zReturn a stable string representation of a Python data structure.

    We can't just use ``str(obj)`` as the order of collections may be random.
    r"   )jsondumps_stable_str_prep)r   r#   s     r    
stable_strr)      s"    
 :&s++F;;;;r!    dict[str, Any] | list[Any] | strc                   t          | t                    rAd |                                 D             } |                                  t          |           S t          | t          t
          z  t          z  t          z            r)t          t          t          |           t                    S t          | t          t          j        z            r| j         d| j         S t          |           S )Nc                P    g | ]#\  }}t          |          t          |          f$S  )r(   ).0kvs      r    
<listcomp>z$_stable_str_prep.<locals>.<listcomp>*   s3    RRRda ##%5a%8%89RRRr!   )keyr
   )r   r   r   sortr   r   r   r   r   r   r(   r   r   r   r   r   r   r   s    r    r(   r(   '   s    #t RRciikkRRR


Cyy#te|c)I566 ;c*C00c::::#te0011 6 .553#3555s88Or!   )r   r   r   r   )r   r   r#   r$   r   r   )r   r   r   r*   )__doc__
__future__r   r   r&   r   typingr   r   r   r)   r(   r-   r!   r    <module>r7      s    3 3 " " " " " "                M M M M" 26 < < < < < <     r!   