
    aVgl?                       d Z ddlmZ ddlZddlmZmZmZmZm	Z	m
Z
mZmZ ddlmZ ddlmZ ee	eef   ee   f   Z ed      Z ed      Zdd	Zddd
Z	 d	 	 	 	 	 	 	 ddZ	 d	 	 	 	 	 	 	 ddZ	 	 	 	 	 d	 	 	 	 	 	 	 	 	 	 	 	 	 ddZ	 d	 	 	 	 	 ddZddZd d!dZ	 	 	 	 d"	 	 	 	 	 	 	 	 	 	 	 d#dZ	 	 	 	 	 	 d$dZ G d deeef         Zy)%z
Printing tools.
    )annotationsN)AnyCallableDictIterableMappingSequenceTypeVarUnion)
get_option)is_sequence_KT_VTc           	     v   |j                  dt              }|j                  dt              }g }g }|dd D cg c]  }t        t	        ||            | z    }}|j                  t        t	        t        |d                      t        t	        t        |            }	t        |      D ]K  \  }
} ||||
   d      }|j                  d||
   z  g|	t        |      z
  z         |j                  |       M t        | }|D ]"  }|j                  dj                  |             $ d	j                  |      S c c}w )
a  
    Glues together two sets of strings using the amount of space requested.
    The idea is to prettify.

    ----------
    space : int
        number of spaces for padding
    lists : str
        list of str which being joined
    strlen : callable
        function used to calculate the length of each str. Needed for unicode
        handling.
    justfunc : callable
        function used to justify str. Needed for unicode handling.
    strlenjustfuncNleft)mode  
)
poplenjustifymaxmapappend	enumerateextendzipjoin)spacelistskwargsr   r   	out_linesnewListsxlengthsmaxLenilstnltoJoinliness                  [/var/www/html/hubwallet-dev/venv/lib/python3.12/site-packages/pandas/io/formats/printing.pyadjoinr1      s$     ZZ#&Fzz*g.HIH49#2J?qs3vq>"U*?G?NN3s3b	*+,S%!FE" 3c71:F3
		3#$S(9:; (^F )()99Y @s   D6c                    |dk(  r| D cg c]  }|j                  |       c}S |dk(  r| D cg c]  }|j                  |       c}S | D cg c]  }|j                  |       c}S c c}w c c}w c c}w )zB
    Perform ljust, center, rjust against string or list-like
    r   center)ljustr3   rjust)textsmax_lenr   r(   s       r0   r   r   >   sl     v~*/0Q 00		+01a!11*/0Q 00	 110s   A(A-A2c                   t        | t              rd}nt        | d      rdnd}|du rt        |       }n|xs t	        d      xs t        |       }t        |       }t        t        |t        |                   D cg c]  }t        t        |      |dz   fd|i| }}dj                  |      }	|t        |       k  r|	d	z  }	n#t        | t              rt        |       dk(  r|	d
z  }	|j                  |	      S c c}w )z
    internal. pprinter for iterables. you should probably use pprint_thing()
    rather than calling this directly.

    bounds length of printed sequence, depending on options
    z
{{{body}}}__setitem__z[{body}]z({body})Fmax_seq_items   , , ...,)body)
isinstancesethasattrr   r   iterrangeminpprint_thingnextr"   tupleformat)
seq	_nest_lvlr:   kwdsfmtnitemssr+   rr?   s
             r0   _pprint_seqrQ   b   s     #s#C7jZSI*_"=ISS	A s63s8,-	 	T!Wi!mQ=QDQ	A 	 99Q<DC	C	CHM::4:  	s   ;"C9c                   d}g }d}|du rt        |       }n|xs t        d      xs t        |       }t        | j                               d| D ]G  \  }}	|j	                  |j                  t        ||dz   fd|i|t        |	|dz   fd|i|             I |t        |       k  r$|j                  dj                  |      d	z   
      S |j                  dj                  |      
      S )zy
    internal. pprinter for iterables. you should probably use pprint_thing()
    rather than calling this directly.
    z{{{things}}}z{key}: {val}Fr:   Nr;   )keyvalr<   r=   )things)r   r   listitemsr   rI   rF   r"   )
rJ   rK   r:   rL   rM   pairspfmtrN   kvs
             r0   _pprint_dictr\      s     CEDSI*_"=ISSYY[!'6* 
1KK IMWWRVW IMWWRVW  	

 Czz5!1G!;z<<zz5!1z22    c                T   |f	 	 	 	 	 dfd}t        | d      rt        |       S t        | t              r|t	        d      k  rt        | |d|      }|S t        |       r |t	        d      k  rt        | ||||      }|S t        | t              r|rd ||        d}|S  ||       }|S )	a  
    This function is the sanctioned way of converting objects
    to a string representation and properly handles nested sequences.

    Parameters
    ----------
    thing : anything to be formatted
    _nest_lvl : internal use only. pprint_thing() is mutually-recursive
        with pprint_sequence, this argument is used to keep track of the
        current nesting level, and limit it.
    escape_chars : list or dict, optional
        Characters to escape. If a dict is passed the values are the
        replacements
    default_escapes : bool, default False
        Whether the input escape characters replaces or adds to the defaults
    max_seq_items : int or None, default None
        Pass through to other pretty printers to limit sequence printing

    Returns
    -------
    str
    c                    dddd}t        |t              r0r|j                  |       n|}t        |j	                               }n|xs d}t        |       }|D ]  }|j                  |||         } |S )Nz\tz\nz\r)	r    )r@   dictupdaterV   keysstrreplace)thingescape_chars	translateresultcdefault_escapess        r0   as_escaped_stringz'pprint_thing.<locals>.as_escaped_string   s     !U;	lD)  .(	 1 1 34L'-2LU 	5A^^Ay|4F	5r]   __next__zdisplay.pprint_nest_depthT)quote_stringsr:   ri   rp   r:   ')rh   r   ri   EscapeChars | Nonereturnrf   )rB   rf   r@   rc   r   r\   r   rQ   )rh   rK   ri   rm   rp   r:   rn   rk   s      `    r0   rF   rF      s    @ 8D"4	$ uj!5z	E4	 Y#2 & 9D
  M 
U		J7R,S S%''
 M 
E3	M&u-.a0 M #5)Mr]   c                <    t        |       }|j                  ||      S N)rF   encode)objectencodingerrorsvalues       r0   pprint_thing_encodedr|      s      E<<&))r]   c                   dt         j                  vry ddlm}  |       }|y |j                  j
                  }d}| r2||vr#ddlm} ddlm	  G fdd|      } |       ||<   d	||   _
        y ||v rd
||   _
        y y )NIPythonr   )get_ipythonz!application/vnd.dataresource+json)BaseFormatter
ObjectNamec                  &    e Zd Z W  d      ZefZy)<enable_data_resource_formatter.<locals>.TableSchemaFormatter_repr_data_resource_N)__name__
__module____qualname__print_methodrc   _return_typer   s   r0   TableSchemaFormatterr     s    )*@A !%wr]   r   TF)sysmodulesr~   r   display_formatter
formattersIPython.core.formattersr   	traitletsr   enabled)enabler   ipr   mimetyper   r   r   s          @r0   enable_data_resource_formatterr      s    ##	B	z%%00J2H:%=,'} ' $8#9Jx '+
8$ z!+0Jx ( "r]   c                     t        | dd|      S )N)r`   ra   r   Trq   rF   )rh   r:   s     r0   default_pprintr     s    '#	 r]   c                  ! ddl m} ddlm}  |       \  }}	|t	        d      xs d}|t        |       j                  }|r"t        |      }
dd|
d	z   z   }dd|
d
z   z   }nd}d}t        |       }|rddt        |      z  z   }nd}t	        d      xs |}||kD  } |       !	 	 	 	 	 	 	 	 	 	 	 	 d!fd}d!fd}d}|dk(  rd| }|S |d	k(  r|s || d         }d| d| }|S |d
k(  r%|s# || d         } || d         }d| d| d| }|S |d	k(  rg }| dd D cg c]
  } ||       }}n]||kD  rAt        |d
z  d      }| d| D cg c]
  } ||       }}| | d D cg c]
  } ||       }}ng }| D cg c]
  } ||       }}|r|rt        ||      \  }}n|s:t        dj                  |            |k  rt        dj                  |            |k  sTt         ||       ||            }|D cg c]  }|j                  |       }}|D cg c]  }|j                  |       }}|r|t        |      z
  }|d   }t        t        d	t        |      d	z               D ]  }t        ||      }t        |      |k  s n |D cg c]  }t        |       }}|D cg c]  }t        |       }}d}|}t        t        |            D ]  }||   |z   dz   }  |||| ||      \  }} |r||j!                         |z   dz   z  }|}t        t        |      d	z
        D ]  }||   |z   dz   }  |||| ||      \  }}  ||||d   |d
z
  |      \  }}||z  }d|j!                  d      z   }||z  }t        |      |kD  s|r||z  }n|dz  }d|t        |      d z   }|S c c}w c c}w c c}w c c}w c c}w c c}w c c}w c c}w )a  
    Return the formatted obj as a unicode string

    Parameters
    ----------
    obj : object
        must be iterable and support __getitem__
    formatter : callable
        string formatter for an element
    is_justify : bool
        should justify the display
    name : name, optional
        defaults to the class name of the obj
    indent_for_name : bool, default True
        Whether subsequent lines should be indented to
        align with the name.
    line_break_each_value : bool, default False
        If True, inserts a line break for each value of ``obj``.
        If False, only break lines when the a line of values gets wider
        than the display width.

        .. versionadded:: 0.25.0

    Returns
    -------
    summary string
    r   )get_console_size)get_adjustmentNzdisplay.widthP   r   r   r;      z
 z,
 r>   zdisplay.max_seq_itemsc                    j                  |j                               j                  |j                               z   |k\  r| |j                         z  } |}||z  }| |fS rv   )r   rstrip)rO   liner{   display_widthnext_line_prefixadjs        r0   _extend_linez+format_object_summary.<locals>._extend_linee  sW     774;;=!CGGELLN$;;}LA#D$wr]   c                2    | rt        fd| D              S y)Nc              3  @   K   | ]  }j                  |        y wrv   )r   ).0r(   r   s     r0   	<genexpr>z:format_object_summary.<locals>.best_len.<locals>.<genexpr>q  s     2aswwqz2s   r   )r   )valuesr   s    r0   best_lenz'format_object_summary.<locals>.best_leno  s    26222r]   r<   z[][]r   
   )r:   r   z...)rO   rf   r   rf   r{   rf   r   intr   rf   rt   ztuple[str, str])r   	list[str]rt   r   )pandas.io.formats.consoler   pandas.io.formats.formatr   r   typer   r   rE   _justifyr"   r   r5   reversedrD   rQ   r   )"obj	formatter
is_justifynameindent_for_nameline_break_each_valuer   r   r   _name_lenspace1space2nsepr:   is_truncatedr   r   closesummaryfirstlastheadr(   tail
max_length	max_spacer{   	max_itemspprinted_seqr   wordr   s"                                    @r0   format_object_summaryr   "  s   F ;7')M1"?39r|Cy!!t9shl+-.shl+-.CA sSY&67<1M }$L 
C"%69MP	 EAvug,n Nm 
a-#a&!eWAeW%h Ng 
a-#a&!R!eWBtfAeW-` N[ AD*-bc(3QIaL3D3MQ&+A*-bq'2QIaL2D2*-qbc(3QIaL3D3D*-.QIaL.D. $ &dD1
dDIIdO$}4		$(=8 !$$@
59:
+::59:
+:: !
 &F3IGE%eAs5zA~&>? 	*5	J|$y0 FJJK;JDJEIJK;JDJs4y) 	UI	?S(3.D($mVTMGT	U t{{}v-55GDs4y1}- 	UI	?S(3.D($mVTMGT	U
 %WdDHma>OQWX4 ell3''5w<=)-BvGsNG F..NU 4 33 / ;: KJs0   N(N-$N2<N79N<OO'Oc           
        | |z   }dgt        |d         z  }|D ]B  }|D cg c]  }t        |       }}t        ||      D cg c]  \  }}t        ||       }}}D | D 	cg c]  }	t        d t        |	|      D                } }	|D 	cg c]  }	t        d t        |	|      D                }}	| |fS c c}w c c}}w c c}	w c c}	w )a  
    Justify items in head and tail, so they are right-aligned when stacked.

    Parameters
    ----------
    head : list-like of list-likes of strings
    tail : list-like of list-likes of strings

    Returns
    -------
    tuple of list of tuples of strings
        Same as head and tail, but items are right aligned when stacked
        vertically.

    Examples
    --------
    >>> _justify([['a', 'b']], [['abc', 'abcd']])
    ([('  a', '   b')], [('abc', 'abcd')])
    r   c              3  D   K   | ]  \  }}|j                  |        y wrv   r5   r   r(   r7   s      r0   r   z_justify.<locals>.<genexpr>       F:1gagggF    c              3  D   K   | ]  \  }}|j                  |        y wrv   r   r   s      r0   r   z_justify.<locals>.<genexpr>  r   r   )r   r!   r   rH   )
r   r   combinedr   	inner_seqitemlengthr(   yrJ   s
             r0   r   r     s    , d{H s8A;''J E	(12#d)22,/
F,CDDAqc!QiD
DE SWKNFS*1EFFD  SWKNFS*1EFFD  : 3Ds   B5B:##C #Cc                      e Zd ZdZddZy)
PrettyDictz.Dict extension to support abbreviated __repr__c                    t        |       S rv   r   )selfs    r0   __repr__zPrettyDict.__repr__  s    D!!r]   N)rt   rf   )r   r   r   __doc__r   rb   r]   r0   r   r     s
    8"r]   r   )r#   r   r$   r   rt   rf   )right)r6   zIterable[str]r7   r   r   rf   rt   r   )r   N)rJ   r	   rK   r   r:   
int | Nonert   rf   )rJ   r   rK   r   r:   r   rt   rf   )r   NFFN)rh   r   rK   r   ri   rs   rm   boolrp   r   r:   r   rt   rf   )zutf-8rg   )ry   rf   rz   rf   rt   bytes)r   r   rt   Nonerv   )rh   r   r:   r   rt   rf   )TNTF)r   r   r   r   r   z
str | Noner   r   r   r   rt   rf   )r   list[Sequence[str]]r   r   rt   z3tuple[list[tuple[str, ...]], list[tuple[str, ...]]]) r   
__future__r   r   typingr   r   r   r   r   r	   r
   r   pandas._configr   pandas.core.dtypes.inferencer   rf   EscapeCharsr   r   r1   r   rQ   r\   rF   r|   r   r   r   r   r   rb   r]   r0   <module>r      s   # 
	 	 	 & 4GCH%x}45enen  F	1J DH !	 !! !6@ ! !H CG3	3 35?33B '+! $FFF %F 	F
 F F 	FT 4=**-0*
*"1J  "'mm m 	m
 m  m 	m`*
*%8*8*Z"c3h "r]   