
    01i@                        S SK Jr  S SKJr  S SKJrJrJrJr  S SK	J
r
  S SKJr  S SKJrJrJrJr        SS jr " S S	\5      rg
)    )annotations)StringIO)IOListOptionalUnion)NamespaceManager)ResultSerializer)BNodeLiteralURIRefVariablec                ,   U c  gU(       az  [        U [        5      (       a  UR                  U 5      $ [        U [        5      (       a  U R	                  5       $ [        U [
        5      (       a  U R                  UR                  S9$ g U R	                  5       $ )N-)qname_callback)
isinstancer   normalizeUrir   n3r   _literal_n3)tnamespace_managers     b/home/james-whalen/.local/lib/python3.13/site-packages/rdflib/plugins/sparql/results/txtresults.py_termStringr      s|     	ya  $11!445!!446M7##==0A0N0N=OO $ ttv    c                  >    \ rS rSrSr SSS.       SS jjjrSrg)	TXTResultSerializer   z;
A write-only QueryResult serializer for text/ascii tables
N)r   c                  S nU R                   R                  S:w  a  [        S5      e[        5       nU R                   (       d  UR	                  S5        GOzU R                   R
                  nS/[        U5      -  nU R                    V	V
s/ s H"  n	U V
s/ s H  n
[        X   U5      PM     sn
PM$     nn	n
U H9  n	[        [        U5      5       H  n[        X   [        X   5      5      X'   M      M;     UR	                  SR                  [        U5       VV
s/ s H  u  pU" XU   5      PM     sn
n5      S-   5        UR	                  S[        U5      [        U5      -   -  S-   5        [        U5       HV  n	UR	                  SR                  [        X5       VVs/ s H  u  pUS	U[        U5      -
  -  -   PM     snn5      S-   5        MX     UR                  5       n UR	                  UR!                  U5      5        g
s  sn
f s  sn
n	f s  sn
nf s  snnf ! ["        [$        4 a    UR	                  U5         g
f = f)z&
return a text table of query results
c                d    U[        U 5      -  nUS-  =p#US-  (       a  US-  nSU-  U -   SU-  -   $ )z&
center the string s in w wide string
       )len)swh1h2s       r   c(TXTResultSerializer.serialize.<locals>.c-   sD     QKA1fB1ua8a<#(**r   SELECTz%Can only pretty print SELECT results!z(no results)
r   |
r   r"   N)resulttype	Exceptionr   writevarsr#   r   rangemaxjoin	enumeratesumsortedzipgetvalueencode	TypeError
ValueError)selfstreamencodingr   kwargsr(   string_streamkeysmaxlenrkbir   text_vals                  r   	serializeTXTResultSerializer.serialize!   s   	+ ;;x'CDD 
{{ 01#';;#3#3DS3t9_F  %A @DDt!QT#45tD$   s4y)A #FIs14y 9FI *  ioFoda!Aay/oFG$N s6{S['@ AD HIAY##HHVPa#SV"44PQTXX  !))+	#LL23! E G
 Q
 :& 	#LL"	#s6   
HH-HH H" H H!H>=H> )zutf-8)r>   r   r?   strr   Optional[NamespaceManager]returnNone)__name__
__module____qualname____firstlineno____doc__rI   __static_attributes__rK   r   r   r   r      sF      5#
 9=5#5# 5#
 65# 
5# 5#r   r   N)r   z'Optional[Union[URIRef, Literal, BNode]]r   rM   rN   rL   )
__future__r   ior   typingr   r   r   r   rdflib.namespacer	   rdflib.queryr
   rdflib.termr   r   r   r   r   r   rK   r   r   <module>r\      sI    "  , , - ) 8 8.1 	":#* :#r   