§
    µ³Ùg˜d  ã                   óÔ  — d dl Z d dlZd dlZd dlZd dlZ	 g d¢Z e j        d¦  «        Z e j        d¦  «        Z	 e j        d¦  «        Z
 e j        d¦  «        Z e j        d¦  «        Z e j        d¦  «        Z e j        d	¦  «        Z e j        d
¦  «        Z e j        d¦  «        Z e j        d¦  «        Z e j        d¦  «        Z G d„ de¦  «        Z G d„ de¦  «        Z G d„ d¦  «        Z G d„ de¦  «        Z G d„ de¦  «        Z G d„ de¦  «        Z G d„ de¦  «        Z G d„ de¦  «        Zd„ Zd„ Zd „ Zd+d!„Zd"„ Z d#„ Z!d$„ Z"d%„ Z#d&„ Z$ G d'„ d(¦  «        Z%d)„ Z&d*„ Z'dS ),é    N)ÚMetaDataÚloadarffÚ	ArffErrorÚParseArffErrorz^\s*@z^%z^\s+$z^\s*@\S*z^@[Dd][Aa][Tt][Aa]z*^@[Rr][Ee][Ll][Aa][Tt][Ii][Oo][Nn]\s*(\S*)z2^\s*@[Aa][Tt][Tt][Rr][Ii][Bb][Uu][Tt][Ee]\s*(..*$)z{(.+)}z%[Dd][Aa][Tt][Ee]\s+[\"']?(.+?)[\"']?$z'(..+)'\s+(..+$)z(\S+)\s+(..+$)c                   ó   — e Zd ZdS )r   N©Ú__name__Ú
__module__Ú__qualname__© ó    úM/granary/edev/quantum/lib/python3.11/site-packages/scipy/io/arff/_arffread.pyr   r   6   ó   € € € € € Ø€Dr   r   c                   ó   — e Zd ZdS )r   Nr   r   r   r   r   r   :   r   r   r   c                   ó:   — e Zd ZdZd„ Zed„ ¦   «         Zd„ Zd„ ZdS )Ú	AttributeNc                 óD   — || _         d | _        t          j        | _        d S ©N)ÚnameÚrangeÚnpÚobject_Údtype)Úselfr   s     r   Ú__init__zAttribute.__init__E   s   € ØˆŒ	ØˆŒ
Ý”ZˆŒ
ˆ
ˆ
r   c                 ó   — dS )zj
        Parse the attribute line if it knows how. Returns the parsed
        attribute, or None.
        Nr   ©Úclsr   Úattr_strings      r   Úparse_attributezAttribute.parse_attributeJ   s	   € ð ˆtr   c                 ó   — dS )ú-
        Parse a value of this type.
        Nr   ©r   Údata_strs     r   Ú
parse_datazAttribute.parse_dataR   s	   € ð ˆtr   c                 ó&   — | j         dz   | j        z   S )r"   ú,)r   Ú	type_name©r   s    r   Ú__str__zAttribute.__str__X   s   € ð Œy˜3‰ ¤Ñ/Ð/r   )	r	   r
   r   r(   r   Úclassmethodr    r%   r*   r   r   r   r   r   A   sa   € € € € € à€Ið ð  ð  ð
 ðð ñ „[ððð ð ð0ð 0ð 0ð 0ð 0r   r   c                   óZ   ‡ — e Zd ZdZˆ fd„Zed„ ¦   «         Zed„ ¦   «         Zd„ Z	d„ Z
ˆ xZS )ÚNominalAttributeÚnominalc                 óº   •— t          ¦   «                              |¦  «         || _        || _        t          j        t          d„ |D ¦   «         ¦  «        f| _        d S )Nc              3   ó4   K  — | ]}t          |¦  «        V — Œd S r   )Úlen)Ú.0Úis     r   ú	<genexpr>z,NominalAttribute.__init__.<locals>.<genexpr>g   s(   è è € Ð$<Ð$<°¥S¨¡V¤VÐ$<Ð$<Ð$<Ð$<Ð$<Ð$<r   )Úsuperr   Úvaluesr   r   Úbytes_Úmaxr   )r   r   r6   Ú	__class__s      €r   r   zNominalAttribute.__init__c   sR   ø€ Ý‰Œ×Ò˜ÑÔÐØˆŒØˆŒ
Ý”i¥Ð$<Ð$<°VÐ$<Ñ$<Ô$<Ñ!<Ô!<Ð=ˆŒ
ˆ
ˆ
r   c                 óÀ   — t                                | ¦  «        }|r4t          |                     d¦  «        ¦  «        \  }}t	          |¦  «        S t          d¦  «        ‚)a8  Given a string containing a nominal type, returns a tuple of the
        possible values.

        A nominal type is defined as something framed between braces ({}).

        Parameters
        ----------
        atrv : str
           Nominal type definition

        Returns
        -------
        poss_vals : tuple
           possible values

        Examples
        --------
        >>> from scipy.io.arff._arffread import NominalAttribute
        >>> NominalAttribute._get_nom_val("{floup, bouga, fl, ratata}")
        ('floup', 'bouga', 'fl', 'ratata')
        é   z(This does not look like a nominal string)Ú	r_nominalÚmatchÚsplit_data_lineÚgroupÚtupleÚ
ValueError)ÚatrvÚmÚattrsÚ_s       r   Ú_get_nom_valzNominalAttribute._get_nom_vali   sT   € õ. �OŠO˜DÑ!Ô!ˆØð 	IÝ& q§w¢w¨q¡z¤zÑ2Ô2‰HˆE�1Ý˜‘<”<ÐåÐGÑHÔHÐHr   c                 ó`   — |d         dk    r!|                       |¦  «        } | ||¦  «        S dS )zØ
        Parse the attribute line if it knows how. Returns the parsed
        attribute, or None.

        For nominal attributes, the attribute string would be like '{<attr_1>,
         <attr2>, <attr_3>}'.
        r   Ú{N)rF   )r   r   r   r6   s       r   r    z NominalAttribute.parse_attribute‡   s=   € ð �qŒ>˜SÒ Ð Ø×%Ò% kÑ2Ô2ˆFØ�3�t˜VÑ$Ô$Ð$à�4r   c                 óŽ   — || j         v r|S |dk    r|S t          t          |¦  «        › dt          | j         ¦  «        › �¦  «        ‚)r"   ú?z value not in )r6   rA   Ústrr#   s     r   r%   zNominalAttribute.parse_data–   sP   € ð �t”{Ð"Ð"ØˆOØ˜Š_ˆ_ØˆOå¥ H¡¤ÐOÐO½SÀÄÑ=MÔ=MÐOÐOÑPÔPÐPr   c                 ó¸   — | j         dz   }t          t          | j        ¦  «        dz
  ¦  «        D ]}|| j        |         dz   z  }Œ|| j        d         z  }|dz  }|S )Nz,{r;   r'   éÿÿÿÿÚ})r   r   r1   r6   ©r   Úmsgr3   s      r   r*   zNominalAttribute.__str__¡   si   € ØŒi˜$ÑˆÝ•s˜4œ;Ñ'Ô'¨Ñ)Ñ*Ô*ð 	(ð 	(ˆAØ�4”;˜q”> CÑ'Ñ'ˆCˆCØˆtŒ{˜2ŒÑˆØˆs‰
ˆØˆ
r   )r	   r
   r   r(   r   ÚstaticmethodrF   r+   r    r%   r*   Ú__classcell__©r9   s   @r   r-   r-   _   s—   ø€ € € € € à€Ið>ð >ð >ð >ð >ð ðIð Iñ „\ðIð: ðð ñ „[ðð	Qð 	Qð 	Qðð ð ð ð ð ð r   r-   c                   ó@   ‡ — e Zd Zˆ fd„Zed„ ¦   «         Zd„ Zd„ Zˆ xZS )ÚNumericAttributec                 óz   •— t          ¦   «                              |¦  «         d| _        t          j        | _        d S )NÚnumeric)r5   r   r(   r   Úfloat64r   ©r   r   r9   s     €r   r   zNumericAttribute.__init__¬   s/   ø€ Ý‰Œ×Ò˜ÑÔÐØ"ˆŒÝ”ZˆŒ
ˆ
ˆ
r   c                 ó
  — |                      ¦   «                              ¦   «         }|dt          d¦  «        …         dk    s6|dt          d¦  «        …         dk    s|dt          d¦  «        …         dk    r | |¦  «        S dS )zÔ
        Parse the attribute line if it knows how. Returns the parsed
        attribute, or None.

        For numeric attributes, the attribute string would be like
        'numeric' or 'int' or 'real'.
        NrW   ÚintÚreal©ÚlowerÚstripr1   r   s      r   r    z NumericAttribute.parse_attribute±   s‚   € ð "×'Ò'Ñ)Ô)×/Ò/Ñ1Ô1ˆà˜�˜Y™œ˜Ô(¨IÒ5Ð5Ø�{�˜E™
œ
�{Ô# uÒ,Ð,Ø�|�˜F™œ�|Ô$¨Ò.Ð.Ø�3�t‘9”9Ðà�4r   c                 ó@   — d|v rt           j        S t          |¦  «        S )aó  
        Parse a value of this type.

        Parameters
        ----------
        data_str : str
           string to convert

        Returns
        -------
        f : float
           where float can be nan

        Examples
        --------
        >>> from scipy.io.arff._arffread import NumericAttribute
        >>> atr = NumericAttribute('atr')
        >>> atr.parse_data('1')
        1.0
        >>> atr.parse_data('1\n')
        1.0
        >>> atr.parse_data('?\n')
        nan
        rJ   )r   ÚnanÚfloatr#   s     r   r%   zNumericAttribute.parse_dataÄ   s    € ð2 �(ˆ?ˆ?Ý”6ˆMå˜‘?”?Ð"r   c                 óÎ   — |j         dz  |j         dz
  z  }t          j        |¦  «        t          j        |¦  «        t          j        |¦  «        t          j        |¦  «        |z  fS )Ng      ð?r;   )Úsizer   ÚnanminÚnanmaxÚmeanÚstd)r   ÚdataÚnbfacs      r   Ú_basic_statszNumericAttribute._basic_statsâ   sQ   € Ø”	˜B‘ $¤)¨a¡-Ñ0ˆÝ”	˜$‘”¥¤¨4¡¤Ý”˜‘”�rœv d™|œ|¨eÑ3ð5ð 	5r   )	r	   r
   r   r   r+   r    r%   rk   rR   rS   s   @r   rU   rU   ª   sq   ø€ € € € € ð ð  ð  ð  ð  ð
 ðð ñ „[ðð$#ð #ð #ð<5ð 5ð 5ð 5ð 5ð 5ð 5r   rU   c                   ó4   ‡ — e Zd Zˆ fd„Zed„ ¦   «         Zˆ xZS )ÚStringAttributec                 óX   •— t          ¦   «                              |¦  «         d| _        d S )NÚstring)r5   r   r(   rY   s     €r   r   zStringAttribute.__init__ê   s&   ø€ Ý‰Œ×Ò˜ÑÔÐØ!ˆŒˆˆr   c                 óž   — |                      ¦   «                              ¦   «         }|dt          d¦  «        …         dk    r | |¦  «        S dS )z¿
        Parse the attribute line if it knows how. Returns the parsed
        attribute, or None.

        For string attributes, the attribute string would be like
        'string'.
        Nro   r]   r   s      r   r    zStringAttribute.parse_attributeî   sN   € ð "×'Ò'Ñ)Ô)×/Ò/Ñ1Ô1ˆà�~�˜H™œ�~Ô&¨(Ò2Ð2Ø�3�t‘9”9Ðà�4r   )r	   r
   r   r   r+   r    rR   rS   s   @r   rm   rm   è   sS   ø€ € € € € ð"ð "ð "ð "ð "ð ðð ñ „[ðð ð ð ð r   rm   c                   óZ   ‡ — e Zd Zˆ fd„Zed„ ¦   «         Zed„ ¦   «         Zd„ Zˆ fd„Z	ˆ xZ
S )ÚDateAttributec                 óÀ   •— t          ¦   «                              |¦  «         || _        || _        d| _        || _        t          j        d| j        ¦  «        | _        d S )NÚdater   )	r5   r   Údate_formatÚdatetime_unitr(   r   r   Ú
datetime64r   )r   r   ru   rv   r9   s       €r   r   zDateAttribute.__init__  sS   ø€ Ý‰Œ×Ò˜ÑÔÐØ&ˆÔØ*ˆÔØˆŒØ ˆŒ
Ý”] 1 dÔ&8Ñ9Ô9ˆŒ
ˆ
ˆ
r   c                 óˆ  — t                                | ¦  «        }|�r|                     d¦  «                             ¦   «         }d }d|v r|                     dd¦  «        }d}n	 |                     dd¦  «        }d}d|v r|                     dd¦  «        }d	}d
|v r|                     d
d¦  «        }d}d|v r|                     dd¦  «        }d}d|v r|                     dd¦  «        }d}d|v r|                     dd¦  «        }d}d|v sd|v rt          d¦  «        ‚|€t          d¦  «        ‚||fS t          d¦  «        ‚)Nr;   Úyyyyz%YÚYÚyyz%yÚMMz%mÚMÚddz%dÚDÚHHz%HÚhÚmmz%MrC   Ússz%SÚsÚzÚZz6Date type attributes with time zone not supported, yetz"Invalid or unsupported date formatzInvalid or no date format)Úr_dater=   r?   r_   ÚreplacerA   )rB   rC   Úpatternrv   s       r   Ú_get_date_formatzDateAttribute._get_date_format
  s{  € å�LŠL˜ÑÔˆØñ "	:Ø—g’g˜a‘j”j×&Ò&Ñ(Ô(ˆGà ˆMØ˜Ð Ð Ø!Ÿ/š/¨&°$Ñ7Ô7�Ø #��ð$Ø!Ÿ/š/¨$°Ñ5Ô5�Ø #�Ø�wˆˆØ!Ÿ/š/¨$°Ñ5Ô5�Ø #�Ø�wˆˆØ!Ÿ/š/¨$°Ñ5Ô5�Ø #�Ø�wˆˆØ!Ÿ/š/¨$°Ñ5Ô5�Ø #�Ø�wˆˆØ!Ÿ/š/¨$°Ñ5Ô5�Ø #�Ø�wˆˆØ!Ÿ/š/¨$°Ñ5Ô5�Ø #�Ø�gˆ~ˆ~ ¨  Ý ð "2ñ 3ô 3ð 3ð Ð$Ý Ð!EÑFÔFÐFà˜MÐ)Ð)åÐ8Ñ9Ô9Ð9r   c                 óÒ   — |                      ¦   «                              ¦   «         }|dt          d¦  «        …         dk    r%|                      |¦  «        \  }} | |||¦  «        S dS )úÄ
        Parse the attribute line if it knows how. Returns the parsed
        attribute, or None.

        For date attributes, the attribute string would be like
        'date <format>'.
        Nrt   )r^   r_   r1   rŠ   )r   r   r   Úattr_string_lowerru   rv   s         r   r    zDateAttribute.parse_attribute1  sm   € ð (×-Ò-Ñ/Ô/×5Ò5Ñ7Ô7Ðà˜\�c &™kœk˜\Ô*¨fÒ4Ð4Ø),×)=Ò)=¸kÑ)JÔ)JÑ&ˆK˜Ø�3�t˜[¨-Ñ8Ô8Ð8à�4r   c                 ó`  — |                      ¦   «                               d¦  «                              d¦  «        }|dk    rt          j        d| j        ¦  «        S t          j                             || j        ¦  «        }t          j        |¦  «                             d| j        › d�¦  «        S )r"   ú'ú"rJ   ÚNaTzdatetime64[ú])r_   r   rw   rv   ÚdatetimeÚstrptimeru   Úastype)r   r$   Údate_strÚdts       r   r%   zDateAttribute.parse_dataC  s›   € ð —>’>Ñ#Ô#×)Ò)¨#Ñ.Ô.×4Ò4°SÑ9Ô9ˆØ�sŠ?ˆ?Ý”= ¨Ô(:Ñ;Ô;Ð;åÔ"×+Ò+¨H°dÔ6FÑGÔGˆBÝ”= Ñ$Ô$×+Ò+Ø3˜dÔ0Ð3Ð3Ð3ñ5ô 5ð 5r   c                 óZ   •— t          ¦   «                              ¦   «         dz   | j        z   S )Nr'   )r5   r*   ru   ©r   r9   s    €r   r*   zDateAttribute.__str__O  s$   ø€ Ý‰wŒw�ŠÑ Ô  3Ñ&¨Ô)9Ñ9Ð9r   )r	   r
   r   r   rQ   rŠ   r+   r    r%   r*   rR   rS   s   @r   rr   rr      s—   ø€ € € € € ð:ð :ð :ð :ð :ð ð$:ð $:ñ „\ð$:ðL ðð ñ „[ðð"
5ð 
5ð 
5ð:ð :ð :ð :ð :ð :ð :ð :ð :r   rr   c                   óD   ‡ — e Zd Zˆ fd„Zed„ ¦   «         Zd„ Zˆ fd„Zˆ xZS )ÚRelationalAttributec                 ó–   •— t          ¦   «                              |¦  «         d| _        t          j        | _        g | _        d | _        d S )NÚ
relational)r5   r   r(   r   r   r   Ú
attributesÚdialectrY   s     €r   r   zRelationalAttribute.__init__U  s=   ø€ Ý‰Œ×Ò˜ÑÔÐØ%ˆŒÝ”ZˆŒ
ØˆŒØˆŒˆˆr   c                 óž   — |                      ¦   «                              ¦   «         }|dt          d¦  «        …         dk    r | |¦  «        S dS )rŒ   Nr�   r]   )r   r   r   r�   s       r   r    z#RelationalAttribute.parse_attribute\  sS   € ð (×-Ò-Ñ/Ô/×5Ò5Ñ7Ô7ÐàÐ/�c ,Ñ/Ô/Ð/Ô0°LÒ@Ð@Ø�3�t‘9”9Ðà�4r   c                 óÄ  ‡ ‡— t          t          t          ‰ j        ¦  «        ¦  «        ¦  «        }|                     ¦   «                              d¦  «        }g }|                     d¦  «        D ]N}t          |‰ j        ¦  «        \  Š‰ _        | 	                    t          ˆˆ fd„|D ¦   «         ¦  «        ¦  «         ŒOt          j        |d„ ‰ j        D ¦   «         ¦  «        S )Nzunicode-escapeú
c                 ó\   •— g | ](}‰j         |                              ‰|         ¦  «        ‘Œ)S r   )rž   r%   )r2   r3   Úrowr   s     €€r   ú
<listcomp>z2RelationalAttribute.parse_data.<locals>.<listcomp>y  s2   ø€ ÐFÐFÐF¸1�” Ô#×.Ò.¨s°1¬vÑ6Ô6ÐFÐFÐFr   c                 ó*   — g | ]}|j         |j        f‘ŒS r   ©r   r   ©r2   Úas     r   r¥   z2RelationalAttribute.parse_data.<locals>.<listcomp>|  s!   € ÐDÐDÐD¨q˜!œ& !¤'Ð*ÐDÐDÐDr   )Úlistr   r1   rž   ÚencodeÚdecodeÚsplitr>   rŸ   Úappendr@   r   Úarray)r   r$   ÚelemsÚescaped_stringÚ
row_tuplesÚrawr¤   s   `     @r   r%   zRelationalAttribute.parse_datam  sô   øø€ å•U�3˜tœÑ/Ô/Ñ0Ô0Ñ1Ô1ˆà!ŸšÑ*Ô*×1Ò1Ð2BÑCÔCˆàˆ
à!×'Ò'¨Ñ-Ô-ð 	Ið 	IˆCÝ /°°T´\Ñ BÔ BÑˆC�”à×Ò�eØFÐFÐFÐFÐFÀÐFÑFÔFñHô Hñ Iô Ið Ið Iõ Œx˜
ØDÐD°D´OÐDÑDÔDñFô Fð 	Fr   c                 ó”   •— t          ¦   «                              ¦   «         dz   d                     d„ | j        D ¦   «         ¦  «        z   S )Nz
	c              3   ó4   K  — | ]}t          |¦  «        V — Œd S r   )rK   r¨   s     r   r4   z.RelationalAttribute.__str__.<locals>.<genexpr>€  s(   è è € Ð<Ð< q�C ™FœFÐ<Ð<Ð<Ð<Ð<Ð<r   )r5   r*   Újoinrž   r™   s    €r   r*   zRelationalAttribute.__str__~  sC   ø€ Ý‘”—’Ñ!Ô! FÑ*Ø—’Ð<Ð<¨D¬OÐ<Ñ<Ô<Ñ<Ô<ñ=ð 	>r   )	r	   r
   r   r   r+   r    r%   r*   rR   rS   s   @r   r›   r›   S  s~   ø€ € € € € ðð ð ð ð ð ðð ñ „[ðð Fð Fð Fð">ð >ð >ð >ð >ð >ð >ð >ð >r   r›   c                 ó¨   — t           t          t          t          t          f}|D ]}|                     | |¦  «        }|�|c S Œt          d|› �¦  «        ‚)Nzunknown attribute )r-   rU   rr   rm   r›   r    r   )r   r   Úattr_classesr   Úattrs        r   Úto_attributerº   †  sj   € Ý$Õ&6½Ý#Õ%8ð:€Lð ð ð ˆØ×"Ò" 4¨Ñ5Ô5ˆØÐØˆKˆKˆKð õ Ð;¨kÐ;Ð;Ñ
<Ô
<Ð<r   c                  óÄ   — t          t          dd¦  «        } | €Gt          j        ¦   «                              d¦  «        }|j        dk    t          _        t          j        } | S )zL
    Checks if the bug https://bugs.python.org/issue30157 is unpatched.
    Úhas_bugNz3, 'a'r�   )ÚgetattrÚcsv_sniffer_has_bug_last_fieldÚcsvÚSnifferÚsniffÚ	quotecharr¼   )r¼   rŸ   s     r   r¾   r¾   ’  sR   € õ Õ4°iÀÑFÔF€Gà€Ý”+‘-”-×%Ò% hÑ/Ô/ˆØ18Ô1BÀcÒ1IÕ&Ô.Ý0Ô8ˆà€Nr   c                 ó*  — t          ¦   «         �rƒd}dd|dfD ]G}t          j        |t          j        t          j        z  ¦  «        }|                     | ¦  «        }|r nŒH||k    rdS |j        }t          |¦  «        dk    sJ ‚|d         }|d         dz
  }	||	         }
|d	         dz
  }	||	         }|d
         dz
  }	t          ||	         ¦  «        }t          j        dt          j	        |¦  «        › d|
› dt          j	        |¦  «        › d|
› dt          j	        |¦  «        › d|
› dt          j	        |¦  «        › d�t          j        ¦  «        }t          | 
                    | ¦  «        ¦  «        }|
|_        ||v r||_        ||_        ||_        dS dS )zT
    Workaround for the bug https://bugs.python.org/issue30157 if is unpatched.
    zG(?P<delim>[^\w\n"\'])(?P<space> ?)(?P<quote>["\']).*?(?P=quote)(?:$|\n)zI(?P<delim>[^\w\n"\'])(?P<space> ?)(?P<quote>["\']).*?(?P=quote)(?P=delim)zG(?:^|\n)(?P<quote>["\']).*?(?P=quote)(?P<delim>[^\w\n"\'])(?P<space> ?)z-(?:^|\n)(?P<quote>["\']).*?(?P=quote)(?:$|\n)Nr;   r   ÚquoteÚdelimÚspacez((z)|^)\W*z[^z\n]*z\W*((z)|$))r¾   ÚreÚcompileÚDOTALLÚ	MULTILINEÚfindallÚ
groupindexr1   ÚboolÚescapeÚsearchrÂ   Ú	delimiterÚdoublequoteÚskipinitialspace)Ú
sniff_linerŸ   Ú
delimitersÚright_regexÚrestrÚregexpÚmatchesrÌ   rC   ÚnrÄ   rÅ   rÆ   Ú	dq_regexprÑ   s                  r   Ú%workaround_csv_sniffer_bug_last_fieldrÛ   ¢  s  € õ &Ñ'Ô'ñ +)à`ˆàbØ`Ø!ØFðHð 	ð 	ˆEõ ”Z ¥r¤yµ2´<Ñ'?Ñ@Ô@ˆFØ—n’n ZÑ0Ô0ˆGØð Ø�ðð
 �KÒÐØˆFàÔ&ˆ
õ �7‰|Œ|˜qÒ Ð Ð Ð Ø�AŒJˆà�wÔ !Ñ#ˆØ�!”ˆà�wÔ !Ñ#ˆØ�!”ˆà�wÔ !Ñ#ˆÝ�Q�q”T‘
”
ˆå”Jð L•"”)˜EÑ"Ô"ð  Lð  L¨5ð  Lð  LµB´I¸eÑ4DÔ4Dð  Lð  LÈ%ð  Lð  LÕSUÔS\Ð]bÑScÔScð  Lð  LÐinð  Lð  LÕuwÔu~ð  @Eñ  vFô  vFð  Lð  Lð  Lõ  NPô  NZñ
ô 
ˆ	õ ˜9×+Ò+¨JÑ7Ô7Ñ8Ô8ˆà!ˆÔØ�JÐÐØ %ˆGÔØ)ˆÔØ#(ˆÔ Ð Ð ðW+)ð +)r   c                 óÜ  ‡ — d}t          j        t          t          j        d¦  «        j        dz  ¦  «        ¦  «         ‰ d         dk    r
‰ d d…         Š ‰                      ¦   «         Š ‰ }t          ˆ fd„|D ¦   «         ¦  «        s|dz  }|€:t          j        ¦   «          	                    ||¬¦  «        }t          |||¬¦  «         t          t          j        ‰ g|¦  «        ¦  «        }||fS )	Nz,	rM   é   r¢   c              3   ó    •K  — | ]}|‰v V — Œ	d S r   r   )r2   ÚdÚlines     €r   r4   z"split_data_line.<locals>.<genexpr>æ  s'   øè è € Ð-Ð-˜Qˆq�DˆyÐ-Ð-Ð-Ð-Ð-Ð-r   r'   )rÔ   )rÓ   rŸ   rÔ   )r¿   Úfield_size_limitr[   ÚctypesÚc_ulongÚvaluer_   ÚanyrÀ   rÁ   rÛ   ÚnextÚreader)rà   rŸ   rÔ   rÓ   r¤   s   `    r   r>   r>   Ô  s  ø€ Ø€Jõ Ô��Vœ^¨BÑ/Ô/Ô5¸Ñ:Ñ;Ô;Ñ<Ô<Ð<ð ˆB„x�4ÒÐØ�C�R�CŒyˆð �:Š:‰<Œ<€Dà€Jõ Ð-Ð-Ð-Ð- *Ð-Ñ-Ô-Ñ-Ô-ð Ø�cÑˆ
à€Ý”+‘-”-×%Ò% j¸ZÐ%ÑHÔHˆÝ-¸Ø6=Ø9Cð	Eñ 	Eô 	Eð 	Eõ �sŒz˜4˜& 'Ñ*Ô*Ñ
+Ô
+€Cà�ˆ<Ðr   c                 ó8  — |                      ¦   «         }t                               |¦  «        }|rœ|                     d¦  «        }t                               |¦  «        r"t          |¦  «        \  }}t          | ¦  «        }n]t                               |¦  «        r"t          |¦  «        \  }}t          | ¦  «        }n!t          d¦  «        ‚t          d|› �¦  «        ‚t          ||¦  «        }|                     ¦   «         dk    rt          | ||¦  «        }||fS )aª  Parse a raw string in header (e.g., starts by @attribute).

    Given a raw string attribute, try to get the name and type of the
    attribute. Constraints:

    * The first line must start with @attribute (case insensitive, and
      space like characters before @attribute are allowed)
    * Works also if the attribute is spread on multilines.
    * Works if empty lines or comments are in between

    Parameters
    ----------
    attribute : str
       the attribute string.

    Returns
    -------
    name : str
       name of the attribute
    value : str
       value of the attribute
    next : str
       next line to be parsed

    Examples
    --------
    If attribute is a string defined in python as r"floupi real", will
    return floupi as name, and real as value.

    >>> from scipy.io.arff._arffread import tokenize_attribute
    >>> iterable = iter([0] * 10) # dummy iterator
    >>> tokenize_attribute(iterable, r"@attribute floupi real")
    ('floupi', 'real', 0)

    If attribute is r"'floupi 2' real", will return 'floupi 2' as name,
    and real as value.

    >>> tokenize_attribute(iterable, r"  @attribute 'floupi 2' real   ")
    ('floupi 2', 'real', 0)

    r;   zmulti line not supported yetzFirst line unparsable: r�   )r_   Úr_attributer=   r?   Úr_comattrvalÚtokenize_single_commaræ   Úr_wcomattrvalÚtokenize_single_wcommarA   rº   r^   Úread_relational_attribute)ÚiterableÚ	attributeÚsattrÚmattrrB   r   ÚtypeÚ	next_items           r   Útokenize_attributerõ   ÷  s  € ðT �OŠOÑÔ€EÝ×Ò˜eÑ$Ô$€EØð <à�{Š{˜1‰~Œ~ˆÝ×Ò˜dÑ#Ô#ð 		=Ý.¨tÑ4Ô4‰JˆD�$Ý˜X™œˆIˆIÝ× Ò  Ñ&Ô&ð 	=Ý/°Ñ5Ô5‰JˆD�$Ý˜X™œˆIˆIõ Ð;Ñ<Ô<Ð<åÐ:°5Ð:Ð:Ñ;Ô;Ð;å˜T 4Ñ(Ô(€Ià‡z‚z�|„|�|Ò#Ð#Ý-¨h¸	À9ÑMÔMˆ	ð �iÐÐr   c                 óJ  — t                                | ¦  «        }|rr	 |                     d¦  «                             ¦   «         }|                     d¦  «                             ¦   «         }n4# t          $ r}t          d¦  «        |‚d }~ww xY wt          d| › �¦  «        ‚||fS ©Nr;   rÝ   z Error while tokenizing attributezError while tokenizing single )rê   r=   r?   r_   Ú
IndexErrorrA   ©ÚvalrC   r   ró   Úes        r   rë   rë   <  sµ   € õ 	×Ò˜3ÑÔ€AØð Að	HØ—7’7˜1‘:”:×#Ò#Ñ%Ô%ˆDØ—7’7˜1‘:”:×#Ò#Ñ%Ô%ˆDˆDøÝð 	Hð 	Hð 	HÝÐ?Ñ@Ô@ÀaÐGøøøøð	Høøøõ Ð?¸#Ð?Ð?Ñ@Ô@Ð@Ø�ˆ:Ðó   žAA- Á-
BÁ7BÂBc                 óJ  — t                                | ¦  «        }|rr	 |                     d¦  «                             ¦   «         }|                     d¦  «                             ¦   «         }n4# t          $ r}t          d¦  «        |‚d }~ww xY wt          d| › �¦  «        ‚||fS r÷   )rì   r=   r?   r_   rø   rA   rù   s        r   rí   rí   K  sµ   € õ 	×Ò˜CÑ Ô €AØð Að	HØ—7’7˜1‘:”:×#Ò#Ñ%Ô%ˆDØ—7’7˜1‘:”:×#Ò#Ñ%Ô%ˆDˆDøÝð 	Hð 	Hð 	HÝÐ?Ñ@Ô@ÀaÐGøøøøð	Høøøõ Ð?¸#Ð?Ð?Ñ@Ô@Ð@Ø�ˆ:Ðrü   c                 óÄ  — t          j        d|j        z   dz   ¦  «        }|                     |¦  «        sœt                               |¦  «        }|r\t
                               |¦  «        }|r.t          | |¦  «        \  }}|j                             |¦  «         n!t          d|› �¦  «        ‚t          | ¦  «        }|                     |¦  «        ¯œt          | ¦  «        }|S )z4Read the nested attributes of a relational attributez^@[Ee][Nn][Dd]\s*z\s*$úError parsing line )rÇ   rÈ   r   r=   Úr_headerlineré   rõ   rž   r®   rA   ræ   )ÚofileÚrelational_attributer3   Úr_end_relationalrC   Úisattrr¹   s          r   rî   rî   Z  sö   € õ ”zÐ"6Ø"6Ô";ñ#<Ø>Eñ#Fñ Gô GÐð ×$Ò$ QÑ'Ô'ð 
Ý×Ò˜qÑ!Ô!ˆØð 	Ý ×&Ò& qÑ)Ô)ˆFØð <Ý,¨U°AÑ6Ô6‘��aØ$Ô/×6Ò6°tÑ<Ô<Ð<Ð<å Ð!:°qÐ!:Ð!:Ñ;Ô;Ð;å�U‘”ˆAð ×$Ò$ QÑ'Ô'ð 
õ 	ˆU‰Œ€AØ€Hr   c                 ó¦  — t          | ¦  «        }t                               |¦  «        r)t          | ¦  «        }t                               |¦  «        °)d}g }t                               |¦  «        sÞt                               |¦  «        }|r™t
                               |¦  «        }|r)t          | |¦  «        \  }}|                     |¦  «         nct                               |¦  «        }|r| 	                    d¦  «        }nt          d|› �¦  «        ‚t          | ¦  «        }nt          | ¦  «        }t                               |¦  «        ¯Þ||fS )z&Read the header of the iterable ofile.Nr;   rÿ   )ræ   Ú	r_commentr=   Ú
r_datametar   ré   rõ   r®   Ú
r_relationr?   rA   )r  r3   Úrelationrž   rC   r  r¹   Úisrels           r   Úread_headerr  p  sG  € åˆU‰Œ€Aõ �/Š/˜!Ñ
Ô
ð Ý�‰KŒKˆõ �/Š/˜!Ñ
Ô
ð ð €HØ€JÝ×Ò˜qÑ!Ô!ð Ý×Ò˜qÑ!Ô!ˆØð 	Ý ×&Ò& qÑ)Ô)ˆFØð 	 Ý,¨U°AÑ6Ô6‘��aØ×!Ò! $Ñ'Ô'Ð'Ð'å"×(Ò(¨Ñ+Ô+�Øð @Ø$Ÿ{š{¨1™~œ~�H�Hå$Ð%>¸1Ð%>Ð%>Ñ?Ô?Ð?Ý˜‘K”K��å�U‘”ˆAõ ×Ò˜qÑ!Ô!ð ð" �ZÐÐr   c                   ó6   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	dS )	r   a§  Small container to keep useful information on a ARFF dataset.

    Knows about attributes names and types.

    Examples
    --------
    ::

        data, meta = loadarff('iris.arff')
        # This will print the attributes names of the iris.arff dataset
        for i in meta:
            print(i)
        # This works too
        meta.names()
        # Getting attribute type
        types = meta.types()

    Methods
    -------
    names
    types

    Notes
    -----
    Also maintains the list of attributes in order, i.e., doing for i in
    meta, where meta is an instance of MetaData, will return the
    different attribute names in the order they were defined.
    c                 ó6   — || _         d„ |D ¦   «         | _        d S )Nc                 ó   — i | ]
}|j         |“ŒS r   )r   r¨   s     r   ú
<dictcomp>z%MetaData.__init__.<locals>.<dictcomp>®  s   € Ð4Ð4Ð4¨!˜AœF AÐ4Ð4Ð4r   )r   Ú_attributes)r   Úrelr¹   s      r   r   zMetaData.__init__¬  s%   € ØˆŒ	Ø4Ð4¨tÐ4Ñ4Ô4ˆÔÐÐr   c                 óè   — d}|d| j         › d�z  }| j        D ]Y}|d|› d| j        |         j        › �z  }| j        |         j        r%|dt	          | j        |         j        ¦  «        › �z  }|dz  }ŒZ|S )NÚ z	Dataset: r¢   ú	z's type is z, range is )r   r  r(   r   rK   rO   s      r   Ú__repr__zMetaData.__repr__°  s¡   € ØˆØÐ(˜4œ9Ð(Ð(Ð(Ñ(ˆØÔ!ð 	ð 	ˆAØÐE˜ÐEÐE dÔ&6°qÔ&9Ô&CÐEÐEÑEˆCØÔ Ô"Ô(ð FØÐE¥S¨Ô)9¸!Ô)<Ô)BÑ%CÔ%CÐEÐEÑE�Ø�4‰KˆCˆCØˆ
r   c                 ó*   — t          | j        ¦  «        S r   )Úiterr  r)   s    r   Ú__iter__zMetaData.__iter__º  s   € Ý�DÔ$Ñ%Ô%Ð%r   c                 ó8   — | j         |         }|j        |j        fS r   )r  r(   r   )r   Úkeyr¹   s      r   Ú__getitem__zMetaData.__getitem__½  s   € ØÔ Ô$ˆà” ¤
Ð+Ð+r   c                 ó*   — t          | j        ¦  «        S )zŽReturn the list of attribute names.

        Returns
        -------
        attrnames : list of str
            The attribute names.
        )rª   r  r)   s    r   ÚnameszMetaData.namesÂ  s   € õ �DÔ$Ñ%Ô%Ð%r   c                 ó.   ‡ — ˆ fd„‰ j         D ¦   «         }|S )z�Return the list of attribute types.

        Returns
        -------
        attr_types : list of str
            The attribute types.
        c                 ó4   •— g | ]}‰j         |         j        ‘ŒS r   )r  r(   )r2   r   r   s     €r   r¥   z"MetaData.types.<locals>.<listcomp>Ô  s4   ø€ ð 4ð 4ð 4Øð Ô& tÔ,Ô6ð 4ð 4ð 4r   )r  )r   Ú
attr_typess   ` r   ÚtypeszMetaData.typesÌ  s4   ø€ ð4ð 4ð 4ð 4Ø"&Ô"2ð4ñ 4ô 4ˆ
àÐr   N)
r	   r
   r   Ú__doc__r   r  r  r  r  r!  r   r   r   r   r   �  sx   € € € € € ðð ð85ð 5ð 5ðð ð ð&ð &ð &ð,ð ,ð ,ð
&ð &ð &ð
ð 
ð 
ð 
ð 
r   r   c                 óÔ   — t          | d¦  «        r| }nt          | ¦  «        }	 t          |¦  «        || ur|                     ¦   «          S S # || ur|                     ¦   «          w w xY w)a  
    Read an arff file.

    The data is returned as a record array, which can be accessed much like
    a dictionary of NumPy arrays. For example, if one of the attributes is
    called 'pressure', then its first 10 data points can be accessed from the
    ``data`` record array like so: ``data['pressure'][0:10]``


    Parameters
    ----------
    f : file-like or str
       File-like object to read from, or filename to open.

    Returns
    -------
    data : record array
       The data of the arff file, accessible by attribute names.
    meta : `MetaData`
       Contains information about the arff file such as name and
       type of attributes, the relation (name of the dataset), etc.

    Raises
    ------
    ParseArffError
        This is raised if the given file is not ARFF-formatted.
    NotImplementedError
        The ARFF file has an attribute which is not supported yet.

    Notes
    -----

    This function should be able to read most arff files. Not
    implemented functionality include:

    * date type attributes
    * string type attributes

    It can read files with numeric and nominal attributes. It cannot read
    files with sparse data ({} in the file). However, this function can
    read files with missing data (? in the file), representing the data
    points as NaNs.

    Examples
    --------
    >>> from scipy.io import arff
    >>> from io import StringIO
    >>> content = """
    ... @relation foo
    ... @attribute width  numeric
    ... @attribute height numeric
    ... @attribute color  {red,green,blue,yellow,black}
    ... @data
    ... 5.0,3.25,blue
    ... 4.5,3.75,green
    ... 3.0,4.00,red
    ... """
    >>> f = StringIO(content)
    >>> data, meta = arff.loadarff(f)
    >>> data
    array([(5.0, 3.25, 'blue'), (4.5, 3.75, 'green'), (3.0, 4.0, 'red')],
          dtype=[('width', '<f8'), ('height', '<f8'), ('color', '|S6')])
    >>> meta
    Dataset: foo
    	width's type is numeric
    	height's type is numeric
    	color's type is nominal, range is ('red', 'green', 'blue', 'yellow', 'black')

    Úread)ÚhasattrÚopenÚ	_loadarffÚclose)Úfr  s     r   r   r   Ù  sv   € õL ˆq�&ÑÔð Øˆˆå�Q‘”ˆðÝ˜ÑÔà˜ˆ>ˆ>Ø�KŠK‰MŒMˆMˆMð øˆ5˜ˆ>ˆ>Ø�KŠK‰MŒMˆMˆMð øøøs   ¤A ÁA'c                 ó¶  ‡	‡
— 	 t          | ¦  «        \  }Š	n4# t          $ r'}dt          |¦  «        z   }t          |¦  «        |‚d }~ww xY wd}‰	D ]}t	          |t
          ¦  «        rd}Œt          |‰	¦  «        }|rt          d¦  «        ‚t          ‰	¦  «        Š
dˆ	ˆ
fd„	}t           || ¦  «        ¦  «        }t          j        |d„ ‰	D ¦   «         ¦  «        }||fS )	Nz'Error while parsing header, error was: FTz*String attributes not supported yet, sorryr'   c              3   ó   •‡K  — t          t          ‰¦  «        ¦  «        }d }| D ]h}t                               |¦  «        st                               |¦  «        rŒ7t          ||¦  «        \  Š}t          ˆˆfd„|D ¦   «         ¦  «        V — Œid S )Nc                 óR   •— g | ]#}‰|                               ‰|         ¦  «        ‘Œ$S r   )r%   )r2   r3   r¹   r¤   s     €€r   r¥   z0_loadarff.<locals>.generator.<locals>.<listcomp>c  s/   ø€ ÐCÐCÐC¸˜˜aœ×+Ò+¨C°¬FÑ3Ô3ÐCÐCÐCr   )rª   r   r  r=   Úr_emptyr>   r@   )Úrow_iterrÅ   r°   rŸ   r³   r¤   r¹   Únis        @€€r   Ú	generatorz_loadarff.<locals>.generatorI  s«   øøè è € õ •U˜2‘Y”Y‘”ˆàˆØð 	Eð 	EˆCõ �Š˜sÑ#Ô#ð ¥w§}¢}°SÑ'9Ô'9ð Øå*¨3°Ñ8Ô8‰LˆC�åÐCÐCÐCÐCÐC¸UÐCÑCÔCÑDÔDÐDÐDÐDÐDð	Eð 	Er   c                 ó*   — g | ]}|j         |j        f‘ŒS r   r§   r¨   s     r   r¥   z_loadarff.<locals>.<listcomp>g  s!   € Ð8Ð8Ð8¨a˜œ ¤Ð)Ð8Ð8Ð8r   )r'   )r  rA   rK   r   Ú
isinstancerm   r   ÚNotImplementedErrorr1   rª   r   r¯   )r  r  rû   rP   Úhasstrr©   Úmetar0  ri   r¹   r/  s            @@r   r'  r'  *  s,  øø€ ð)Ý Ñ&Ô&‰	ˆˆTˆTøÝð )ð )ð )Ø7½#¸a¹&¼&Ñ@ˆÝ˜SÑ!Ô! qÐ(øøøøð)øøøð
 €FØð ð ˆÝ�a�Ñ)Ô)ð 	ØˆFøå�C˜ÑÔ€Dð ð Põ "Ð"NÑOÔOÐOå	ˆT‰Œ€BðEð Eð Eð Eð Eð Eð Eõ8 	ˆYˆY�uÑÔÑÔ€AåŒ8�AÐ8Ð8°4Ð8Ñ8Ô8Ñ9Ô9€DØ�ˆ:Ðs   „ —
A¡"AÁAr   )(rÇ   r“   Únumpyr   r¿   râ   Ú__all__rÈ   Úr_metar  r-  r   r  r  ré   r<   r‡   rê   rì   ÚOSErrorr   r   r   r-   rU   rm   rr   r›   rº   r¾   rÛ   r>   rõ   rë   rí   rî   r  r   r   r'  r   r   r   ú<module>r:     sY  ðà 	€	€	€	Ø €€€à Ð Ð Ð à 
€
€
€
Ø €€€à "à
AÐ
AÐ
A€ð$ 
ˆŒ�HÑ	Ô	€àˆBŒJ�uÑÔ€	à
ˆ"Œ*�XÑ
Ô
€àˆrŒz˜+Ñ&Ô&€ØˆRŒZÐ-Ñ.Ô.€
ØˆRŒZÐEÑFÔF€
ØˆbŒjÐNÑOÔO€àˆBŒJ�yÑ!Ô!€	Ø	ˆŒÐ<Ñ	=Ô	=€ð ˆrŒzÐ-Ñ.Ô.€à�”
Ð,Ñ-Ô-€ð	ð 	ð 	ð 	ð 	�ñ 	ô 	ð 	ð	ð 	ð 	ð 	ð 	�Yñ 	ô 	ð 	ð0ð 0ð 0ð 0ð 0ñ 0ô 0ð 0ð<Hð Hð Hð Hð H�yñ Hô Hð HðV;5ð ;5ð ;5ð ;5ð ;5�yñ ;5ô ;5ð ;5ð|ð ð ð ð �iñ ô ð ð0P:ð P:ð P:ð P:ð P:�Iñ P:ô P:ð P:ðf->ð ->ð ->ð ->ð ->˜)ñ ->ô ->ð ->ðf	=ð 	=ð 	=ðð ð ð /)ð /)ð /)ðdð ð ð ðFB ð B ð B ðJð ð ðð ð ðð ð ð, ð  ð  ð>Gð Gð Gð Gð Gñ Gô Gð GðTNð Nð Nðb>ð >ð >ð >ð >r   