ó
    [hÑ  ã                   ó¬  • S r SSKJr  SSKrSSKrSSKrSSKrSSK	J
r
JrJrJr  \R                  " \5      r " S S\R"                  5      r " S S\R&                  5      r " S	 S
\R*                  5      r " S S5      r\" 5       =\R0                  \'   =\R0                  \R4                  '   =\R0                  \'   \R0                  \R8                  '   g)a·  
Plotting of string "category" data: ``plot(['d', 'f', 'a'], [1, 2, 3])`` will
plot three points with x-axis values of 'd', 'f', 'a'.

See :doc:`/gallery/lines_bars_and_markers/categorical_variables` for an
example.

The module uses Matplotlib's `matplotlib.units` mechanism to convert from
strings to integers and provides a tick locator, a tick formatter, and the
`.UnitData` class that creates and stores the string-to-integer mapping.
é    )ÚOrderedDictN)Ú_apiÚcbookÚtickerÚunitsc                   óT   • \ rS rSr\S 5       r\S 5       r\S 5       r\S 5       rSr	g)ÚStrCategoryConverteré   c                 óp  • Uc  [        S5      e[        R                  U5        [        R                  " [        R
                  " U [        S95      nUR                  U5        [        R                  " UR                  R                  [        /S9" U5      n[        R                  " U 5      (       d  U$ US   $ )a¡  
Convert strings in *value* to floats using mapping information stored
in the *unit* object.

Parameters
----------
value : str or iterable
    Value or list of values to be converted.
unit : `.UnitData`
    An object mapping strings to integers.
axis : `~matplotlib.axis.Axis`
    The axis on which the converted value is plotted.

    .. note:: *axis* is unused.

Returns
-------
float or `~numpy.ndarray` of float
zMissing category information for StrCategoryConverter; this might be caused by unintendedly mixing categorical and numeric data©Údtype)Úotypesr   )Ú
ValueErrorr	   Ú_validate_unitÚnpÚ
atleast_1dÚarrayÚobjectÚupdateÚ	vectorizeÚ_mappingÚ__getitem__Úfloatr   Úis_scalar_or_string)ÚvalueÚunitÚaxisÚvaluesÚss        Úb/home/gothic/public_html/Fooocus/fooocus_env/lib64/python3.13/site-packages/matplotlib/category.pyÚconvertÚStrCategoryConverter.convert   s�   € ð* ‰<Üðó ð  ô 	×+Ñ+¨DÔ1ä—’œrŸxšx¨´VÑ<Ó=ˆà�‰�FÔÜ�LŠL˜Ÿ™×2Ñ2¼E¸7ÒCÀFÓKˆÜ×1Ò1°%×8Ñ8ˆqÐB¸aÀ¹dÐBó    c                 ó¨   • [         R                  U 5        [        U R                  5      n[	        U R                  5      n[
        R                  " X#S9$ )aL  
Set the default axis ticks and labels.

Parameters
----------
unit : `.UnitData`
    object string unit information for value
axis : `~matplotlib.axis.Axis`
    axis for which information is being set

    .. note:: *axis* is not used

Returns
-------
`~matplotlib.units.AxisInfo`
    Information to support default tick labeling

)ÚmajlocÚmajfmt)r	   r   ÚStrCategoryLocatorr   ÚStrCategoryFormatterr   ÚAxisInfo)r   r   r%   r&   s       r    ÚaxisinfoÚStrCategoryConverter.axisinfo=   s?   € ô( 	×+Ñ+¨DÔ1ô $ D§M¡MÓ2ˆÜ% d§m¡mÓ4ˆÜ�~Š~ VÑ;Ð;r#   c                 ó¶   • UR                   c&  UR                  [        U 5      5        UR                   $ UR                   R                  U 5        UR                   $ )z÷
Set and update the `~matplotlib.axis.Axis` units.

Parameters
----------
data : str or iterable of str
axis : `~matplotlib.axis.Axis`
    axis on which the data is plotted

Returns
-------
`.UnitData`
    object storing string to integer mapping
)r   Ú	set_unitsÚUnitDatar   )Údatar   s     r    Údefault_unitsÚ"StrCategoryConverter.default_unitsX   sH   € ð" �:‰:ÑØ�N‰Nœ8 D›>Ô*ð �z‰zÐð �J‰J×Ñ˜dÔ#Ø�z‰zÐr#   c                 óD   • [        U S5      (       d  [        SU  S35      eg )Nr   zProvided unit "zU" is not valid for a categorical converter, as it does not have a _mapping attribute.)Úhasattrr   )r   s    r    r   Ú#StrCategoryConverter._validate_unito   s6   € ä�t˜Z×(Ñ(ÜØ! $ ð (Gð GóHð Hð )r#   © N)
Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ústaticmethodr!   r*   r0   r   Ú__static_attributes__r5   r#   r    r	   r	      sU   † ØñCó ðCðB ñ<ó ð<ð4 ñó ðð, ñHó óHr#   r	   c                   ó*   • \ rS rSrSrS rS rS rSrg)r'   éw   z1Tick at every integer mapping of the string data.c                 ó   • Xl         g©zb
Parameters
----------
units_mapping : dict
    Mapping of category names (str) to indices (int).
N©Ú_units©ÚselfÚunits_mappings     r    Ú__init__ÚStrCategoryLocator.__init__y   ó	   € ð $�r#   c                 óH   • [        U R                  R                  5       5      $ ©N)ÚlistrA   r   )rC   s    r    Ú__call__ÚStrCategoryLocator.__call__‚   s   € ä�D—K‘K×&Ñ&Ó(Ó)Ð)r#   c                 ó   • U " 5       $ rI   r5   )rC   ÚvminÚvmaxs      r    Útick_valuesÚStrCategoryLocator.tick_values†   s	   € á‹vˆr#   r@   N)	r6   r7   r8   r9   Ú__doc__rE   rK   rP   r;   r5   r#   r    r'   r'   w   s   † Ù;ò$ò*õr#   r'   c                   ó>   • \ rS rSrSrS rS	S jrS r\S 5       r	Sr
g)
r(   é‹   z0String representation of the data at every tick.c                 ó   • Xl         gr?   r@   rB   s     r    rE   ÚStrCategoryFormatter.__init__�   rG   r#   Nc                 ó,   • U R                  U/5      S   $ )Nr   )Úformat_ticks)rC   ÚxÚposs      r    rK   ÚStrCategoryFormatter.__call__–   s   € à× Ñ  ! Ó% aÑ(Ð(r#   c                 óè   • U R                   R                  5        VVs0 s H  u  p#X0R                  U5      _M     nnnU Vs/ s H  oTR                  [	        U5      S5      PM     sn$ s  snnf s  snf )NÚ )rA   ÚitemsÚ_textÚgetÚround)rC   r   ÚkÚvÚ	r_mappingÚvals         r    rX   Ú!StrCategoryFormatter.format_ticksš   s]   € à26·+±+×2CÑ2CÔ2EÔFÒ2E©$¨!�QŸ
™
 1›Ò%Ñ2Eˆ	ÑFÙ9?Ó@º°#—‘œe C›j¨"Ö-¹Ñ@Ð@ùó GùÚ@s   žA)Á$A/c                 ó’   • [        U [        5      (       a  U R                  SS9n U $ [        U [        5      (       d  [        U 5      n U $ )z0Convert text values into utf-8 or ascii strings.zutf-8)Úencoding)Ú
isinstanceÚbytesÚdecodeÚstr©r   s    r    r_   ÚStrCategoryFormatter._textŸ   sE   € ô �eœU×#Ñ#Ø—L‘L¨'�LÐ2ˆEð ˆô ˜E¤3×'Ñ'Ü˜“JˆEØˆr#   r@   rI   )r6   r7   r8   r9   rR   rE   rK   rX   r:   r_   r;   r5   r#   r    r(   r(   ‹   s)   † Ù:ò$ô)òAð
 ñó ór#   r(   c                   ó4   • \ rS rSrSS jr\S 5       rS rSrg)r.   é©   Nc                 ó€   • [        5       U l        [        R                  " 5       U l        Ub  U R                  U5        gg)zˆ
Create mapping between unique categorical values and integer ids.

Parameters
----------
data : iterable
    sequence of string values
N)r   r   Ú	itertoolsÚcountÚ_counterr   )rC   r/   s     r    rE   ÚUnitData.__init__ª   s2   € ô $›ˆŒÜ!ŸšÓ)ˆŒØÑØ�K‰K˜Õð r#   c                 óª   •  [        U 5        g! [         a:     [        R                  R	                  U 5         g! [        [
        4 a      gf = ff = f)zI
Helper method to check whether a string can be parsed as float or date.
FT)r   r   ÚdateutilÚparserÚparseÚ	TypeError)re   s    r    Ú_str_is_convertibleÚUnitData._str_is_convertible¸   sY   € ð
	Ü�#ŒJð øô ó 	ðÜ—‘×%Ñ% cÕ*ð øô ¤	Ð*ó âðúð	ús$   ‚ Ž
A™:ºAÁ
AÁAÁAc                 óÎ  • [         R                  " [         R                  " U[        S95      nSn[        R
                  " U5       Hm  n[        R                  " [        [        4US9  U(       a  U R                  U5      nX0R                  ;  d  MK  [        U R                  5      U R                  U'   Mo     UR                  (       a  U(       a  [        R!                  S5        ggg)z­
Map new values to integer identifiers.

Parameters
----------
data : iterable of str or bytes

Raises
------
TypeError
    If elements in *data* are neither str nor bytes.
r   Trm   z½Using categorical units to plot a list of strings that are all parsable as floats or dates. If these strings should be plotted as numbers, cast to the appropriate data type before plotting.N)r   r   r   r   r   Úfromkeysr   Úcheck_isinstancerl   rj   r{   r   Únextrt   ÚsizeÚ_logÚinfo)rC   r/   Úconvertiblere   s       r    r   ÚUnitData.updateÇ   s£   € ô �}Š}œRŸXšX d´&Ñ9Ó:ˆàˆÜ×'Ò'¨Ö-ˆCä×!Ò!¤3¬ ,°cÒ:Þà"×6Ñ6°sÓ;�ØŸ-™-Õ'Ü%)¨$¯-©-Ó%8�—‘˜cÓ"ñ .ð �9�9žÜ�I‰Ið ?õ @ð %ˆ9r#   )rt   r   rI   )	r6   r7   r8   r9   rE   r:   r{   r   r;   r5   r#   r    r.   r.   ©   s!   † ôð ñó ðõ@r#   r.   )rR   Úcollectionsr   Údateutil.parserrw   rr   ÚloggingÚnumpyr   Ú
matplotlibr   r   r   r   Ú	getLoggerr6   r‚   ÚConversionInterfacer	   ÚLocatorr'   Ú	Formatterr(   r.   Úregistryrl   Ústr_rj   Úbytes_r5   r#   r    Ú<module>r’      sÇ   ðñ
õ $Û Û Û ã ç 1Ó 1ð ×Ò˜Ó"€ôZH˜5×4Ñ4ô ZHôz˜Ÿ™ô ô(˜6×+Ñ+ô ÷<:@ñ :@ñD !5Ó 6ð7€‡�ˆsÑ ð 7Ø	‡N�N�2—7‘7Ñð7à	‡N�N�5ÑØ	‡N�N�2—9‘9Òr#   