
    4Ysh                        d Z ddlZddlZddlZddlZej                  r
ddlmc m	Z n	 ddl
mZ 	 ej                  ZddZd Zd ZeZd Z ej,                  d	      Zd
 ZdZ	  ed       erd Zd Zd Z	 ddlmZm Z  y# e$ r ddlmc m	Z Y aw xY w# e$ r ddlmc m	Z d ZY kw xY w# e$ r dZY Iw xY w#  ddl!mZm Z  Y yxY w)zn
Utility functions and objects to ease Python 2/3 compatibility,
and different versions of support libraries.
    N)etreec                 *    | t         j                  |<   y N)etreenative_namespace_map)prefixuris     m/var/www/sten-cake5-migrate2.hellocrow.space/lexinfo-master/env/lib/python3.12/site-packages/rdflib/compat.pyetree_register_namespacer      s    *0""3'    c                 H    t        | t              r| j                  |      S | S r   )
isinstancestrencode)sencs     r
   
cast_bytesr      s    !Sxx}Hr   c                 8     t        j                  d      |       S )Nascii)codecs	getreader)streams    r
   r   r   $   s    $6G$V,,r   c                      t        | ddi|S )Nmoderb)open)argskwargss     r
   bopenr   (   s    +D+F++r   c                     | dk  ry| dkD  ryy)Nr       )ns    r
   signr%   /   s    1u1ur   z%(\\u[0-9A-Fa-f]{4}|\\U[0-9A-Fa-f]{8})c                 0    t         j                  d |       S )Nc                 P    t        t        | j                  d      dd  d            S Nr         chrintgroupms    r
   <lambda>z _unicodeExpand.<locals>.<lambda>;   s     SAB-D)E r   )r_unicodeEscapesubr   s    r
   _unicodeExpandr5   :   s    EqIIr   Fi Tc                     	 t         j                  d |       S # t        $ r2 t        j                  d| z         t         j                  d |       cY S w xY w)Nc                 P    t        t        | j                  d      dd  d            S r(   r+   r/   s    r
   r1   z _unicodeExpand.<locals>.<lambda>H   s     SAB5L1M r   zEncountered a unicode char > 0xFFFF in a narrow python build. Trying to degrade gracefully, but this can cause problems later when working with the string:
%sc                 L    t        j                  | j                  d      d      S )Nr   unicode_escape)r   decoder.   r/   s    r
   r1   z _unicodeExpand.<locals>.<lambda>P   s    &--
4DE r   )r2   r3   
ValueErrorwarningswarnr4   s    r
   r5   r5   F   s]    
	"&&'MqQQ 	MM:<=>
 #&&Eq 	s    8AAc                 &   | j                  dd      } | j                  dd      } | j                  dd      } | j                  dd      } | j                  d	d
      } | j                  dd      } | j                  dd      } | j                  dd      } | S )z8
    s is byte-string - replace \ escapes in string
    \t	\n
\r\b\f\""\''\\\)replacer4   s    r
   decodeStringEscaperP   T   s    
 	
		%A			%A			%A			%A			%A			%A			%A			&$AHr   c                 H   d| vr| S | j                  dd      } | j                  dd      } | j                  dd      } | j                  dd	      } | j                  d
d      } | j                  dd      } | j                  dd      } | j                  dd      } t        |       } | S )zQ
    s is a unicode string
    replace ``\n`` and ``\u00AC`` unicode escapes
    rN   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   rI   rJ   rK   rL   rM   )rO   r5   r4   s    r
   decodeUnicodeEscaperR   f   s    
 1} 			%A			%A			%A			%A			%A			%A			%A			&$AqAHr   )MappingMutableMapping)zutf-8)"__doc__rer   r<   typingtTYPE_CHECKINGxml.etree.ElementTreer   ElementTreelxmlImportErrorregister_namespacer   AttributeErrorr   r   r   r   r-   	long_typer%   compiler2   r5   narrow_buildr,   r;   rP   rR   collections.abcrS   rT   collectionsr#   r   r
   <module>re      s   
 
   ??)).
1$77-, 	 "**EFJ M $2477a  .--.  1//1	1V  L@433s@   B B $B, 8B9 BBB)(B),B65B69
C