
    01if	              	          S r SSKJr  SSKrSSKrSSKrSSKJr  SS jrS r	S r
\rS r\R                  " S	5      rS
 rS rSSSSSSSSS.rSS jr\R                  " S5      rSS jrg)zn
Utility functions and objects to ease Python 2/3 compatibility,
and different versions of support libraries.
    )annotationsN)Matchc                R    [        U [        5      (       a  U R                  U5      $ U $ )N)
isinstancestrencode)sencs     G/home/james-whalen/.local/lib/python3.13/site-packages/rdflib/compat.py
cast_bytesr      s"    !Sxx}H    c                :    [         R                  " S5      " U 5      $ )Nascii)codecs	getreader)streams    r   r   r      s    G$V,,r   c                     [        U SS0UD6$ )Nmoderb)open)argskwargss     r   bopenr      s    +D+F++r   c                     U S:  a  gU S:  a  gg)Nr       )ns    r   signr       s    1u1ur   z%(\\u[0-9A-Fa-f]{4}|\\U[0-9A-Fa-f]{8})c                0    [         R                  S U 5      $ )Nc                P    [        [        U R                  S5      SS  S5      5      $ )Nr         )chrintgroup)ms    r   <lambda> _unicodeExpand.<locals>.<lambda>,   s    SAB-D)Er   )r_unicodeEscapesubr	   s    r   _unicodeExpandr-   +   s    EqIIr   c                f   [         R                  " [        S5      5         U R                  SS5      n U R                  SS5      n U R                  SS5      n U R                  SS	5      n U R                  S
S5      n U R                  SS5      n U R                  SS5      n U R                  SS5      n U $ )Nzrdflib.compat.decodeStringEscape() is deprecated, it will be removed in rdflib 7.0.0. This function is not used anywhere in rdflib anymore and the utility that it does provide is not implemented correctly.z\t	z\n
z\rz\bz\fz\""z\''z\\\)warningswarnDeprecationWarningreplacer,   s    r   decodeStringEscaper;   /   s    MMQ	
 	
		%A			%A			%A			%A			%A			%A			%A			&$AHr   r/   r2   r0   r1   r3   r4   r5   r6   )tbr   rfr4   r5   r6   c                n    U R                  5       u  pUb	  [        U   $ [        [        USS  S5      5      $ )Nr   r#   )groups_string_escape_mapr$   r%   )matchsmatchumatchs      r   _turtle_escape_subberrF   U   s8    \\^NF!&))3vabz2&''r   z5\\(?:([tbnrf"'\\])|(u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8}))c                F    SU ;  a  U $ [         R                  [        U 5      $ )Nr6   )_turtle_escape_patternr+   rF   )escapeds    r   decodeUnicodeEscaperJ   b   s#    7!%%&;WEEr   )zutf-8)rC   z
Match[str]returnr   )rI   r   rK   r   )__doc__
__future__r   r   rer7   typingr   r   r   r   r%   	long_typer   compiler*   r-   r;   rB   rF   rH   rJ   r   r   r   <module>rR      s   
 #  	  -,
 	 **EFJ6 
						
	 ( @ 
Fr   