Ë
    qwjf  ã                   óÈ  — 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'y),é    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Zy)r   z±
    Base exception for errors when reading ARFF files.
    
    Raised when an ARFF file cannot be read due to file access issues,
    corruption, or unsupported features.
    N©Ú__name__Ú
__module__Ú__qualname__Ú__doc__© ó    ú\/var/www/html/newmanjeet/manjet/venv/lib/python3.12/site-packages/scipy/io/arff/_arffread.pyr   r   6   ó   „ ñð 	r   r   c                   ó   — e Zd ZdZy)r   zÀ
    Exception for syntax and parsing errors in ARFF files.
    
    Raised when an ARFF file has invalid syntax, malformed attributes,
    or data that doesn't match the expected format.
    Nr   r   r   r   r   r   @   r   r   r   c                   ó2   — e Zd ZdZd„ Zed„ «       Zd„ Zd„ Zy)Ú	AttributeNc                 óJ   — || _         d | _        t        j                  | _        y ©N)ÚnameÚrangeÚnpÚobject_Údtype)Úselfr   s     r   Ú__init__zAttribute.__init__Q   s   € ØˆŒ	ØˆŒ
Ü—Z‘Zˆ�
r   c                  ó   — y)zj
        Parse the attribute line if it knows how. Returns the parsed
        attribute, or None.
        Nr   ©Úclsr   Úattr_strings      r   Úparse_attributezAttribute.parse_attributeV   s   € ð r   c                  ó   — y)ú-
        Parse a value of this type.
        Nr   ©r   Údata_strs     r   Ú
parse_datazAttribute.parse_data^   s   € ð r   c                 ó:   — | j                   dz   | j                  z   S )r#   Ú,)r   Ú	type_name©r   s    r   Ú__str__zAttribute.__str__d   s   € ð �y‰y˜3‰ §¡Ñ/Ð/r   )	r	   r
   r   r)   r   Úclassmethodr!   r&   r+   r   r   r   r   r   M   s*   „ à€Iò ð
 ñó ðòó0r   r   c                   óN   ‡ — 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| _        y )Nc              3   ó2   K  — | ]  }t        |«      –— Œ y ­wr   )Úlen)Ú.0Úis     r   Ú	<genexpr>z,NominalAttribute.__init__.<locals>.<genexpr>s   s   è ø€ Ð$<±V°¤S¨§V±Vùó   ‚)Úsuperr   Úvaluesr   r   Úbytes_Úmaxr   )r   r   r8   Ú	__class__s      €r   r   zNominalAttribute.__init__o   s9   ø€ Ü‰Ñ˜ÔØˆŒØˆŒ
Ü—i‘i¤Ñ$<±VÓ$<Ó!<Ð=ˆ�
r   c                 ó–   — t         j                  | «      }|r(t        |j                  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_valu   sA   € ô. �O‰O˜DÓ!ˆÙÜ& q§w¡w¨q£zÓ2‰HˆE�1Ü˜“<ÐäÐGÓHÐHr   c                 óH   — |d   dk(  r| j                  |«      } | ||«      S y)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)rH   )r   r   r    r8   s       r   r!   z NominalAttribute.parse_attribute“   s0   € ð �q‰>˜SÒ Ø×%Ñ% kÓ2ˆFÙ�t˜VÓ$Ð$àr   c                 óˆ   — || j                   v r|S |dk(  r|S t        t        |«      › dt        | j                   «      › �«      ‚)r#   Ú?z value not in )r8   rC   Ústrr$   s     r   r&   zNominalAttribute.parse_data¢   sE   € ð �t—{‘{Ñ"ØˆOØ˜Š_ØˆOä¤ H£˜¨n¼SÀÇÁÓ=MÐ<NÐOÓ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   r2   r8   ©r   Úmsgr4   s      r   r+   zNominalAttribute.__str__­   sd   € Ø�i‰i˜$ÑˆÜ”s˜4Ÿ;™;Ó'¨Ñ)Ö*ˆAØ�4—;‘;˜q‘> CÑ'Ñ'‰Cð +àˆt�{‰{˜2‰ÑˆØˆs‰
ˆØˆ
r   )r	   r
   r   r)   r   ÚstaticmethodrH   r,   r!   r&   r+   Ú__classcell__©r;   s   @r   r.   r.   k   sB   ø„ à€Iô>ð ñIó ðIð: ñó ðò	Qör   r.   c                   ó:   ‡ — e Zd Zˆ fd„Zed„ «       Zd„ Zd„ Zˆ xZS )ÚNumericAttributec                 ó\   •— t         ‰| �  |«       d| _        t        j                  | _        y )NÚnumeric)r7   r   r)   r   Úfloat64r   ©r   r   r;   s     €r   r   zNumericAttribute.__init__¸   s"   ø€ Ü‰Ñ˜ÔØ"ˆŒÜ—Z‘Zˆ�
r   c                 ó¶   — |j                  «       j                  «       }|dt        d«       dk(  s"|dt        d«       dk(  s|dt        d«       dk(  r | |«      S y)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'.
        NrY   ÚintÚreal©ÚlowerÚstripr2   r   s      r   r!   z NumericAttribute.parse_attribute½   sa   € ð "×'Ñ'Ó)×/Ñ/Ó1ˆà˜œ˜Y›Ð(¨IÒ5Ø�{œ˜E›
Ð# uÒ,Ø�|œ˜F›Ð$¨Ò.Ù�t“9Ðàr   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
        rL   )r   ÚnanÚfloatr$   s     r   r&   zNumericAttribute.parse_dataÐ   s   € ð2 �(‰?Ü—6‘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î   sU   € Ø—	‘	˜B‘ $§)¡)¨a¡-Ñ0ˆÜ—	‘	˜$“¤§¡¨4£Ü—‘˜“œrŸv™v d›|¨eÑ3ð5ð 	5r   )	r	   r
   r   r   r,   r!   r&   rm   rT   rU   s   @r   rW   rW   ¶   s&   ø„ ô ð
 ñó ðò$#ö<5r   rW   c                   ó.   ‡ — e Zd Zˆ fd„Zed„ «       Zˆ xZS )ÚStringAttributec                 ó2   •— t         ‰| �  |«       d| _        y )NÚstring)r7   r   r)   r[   s     €r   r   zStringAttribute.__init__ö   s   ø€ Ü‰Ñ˜ÔØ!ˆ�r   c                 ór   — |j                  «       j                  «       }|dt        d«       dk(  r | |«      S y)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'.
        Nrq   r_   r   s      r   r!   zStringAttribute.parse_attributeú   s;   € ð "×'Ñ'Ó)×/Ñ/Ó1ˆà�~œ˜H›Ð&¨(Ò2Ù�t“9Ðàr   )r	   r
   r   r   r,   r!   rT   rU   s   @r   ro   ro   ô   s   ø„ ô"ð ñó ôr   ro   c                   óN   ‡ — 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                  «      | _        y )NÚdater   )	r7   r   Údate_formatÚdatetime_unitr)   r   r   Ú
datetime64r   )r   r   rw   rx   r;   s       €r   r   zDateAttribute.__init__  sF   ø€ Ü‰Ñ˜ÔØ&ˆÔØ*ˆÔØˆŒØ ˆŒ
Ü—]‘] 1 d×&8Ñ&8Ó9ˆ�
r   c                 ó  — t         j                  | «      }|rë|j                  d«      j                  «       }d }d|v r|j	                  dd«      }d}n	 |j	                  dd«      }d}d|v r|j	                  dd«      }d	}d
|v r|j	                  d
d«      }d}d|v r|j	                  dd«      }d}d|v r|j	                  dd«      }d}d|v r|j	                  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%MrE   Ú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?   rA   ra   ÚreplacerC   )rD   rE   Úpatternrx   s       r   Ú_get_date_formatzDateAttribute._get_date_format  s9  € ä�L‰L˜ÓˆÙØ—g‘g˜a“j×&Ñ&Ó(ˆGà ˆMØ˜Ñ Ø!Ÿ/™/¨&°$Ó7�Ø #‘ØØ!Ÿ/™/¨$°Ó5�Ø #�Ø�w‰Ø!Ÿ/™/¨$°Ó5�Ø #�Ø�w‰Ø!Ÿ/™/¨$°Ó5�Ø #�Ø�w‰Ø!Ÿ/™/¨$°Ó5�Ø #�Ø�w‰Ø!Ÿ/™/¨$°Ó5�Ø #�Ø�w‰Ø!Ÿ/™/¨$°Ó5�Ø #�Ø�g‰~ ¨¡Ü ð "2ó 3ð 3ð Ð$Ü Ð!EÓFÐFà˜MÐ)Ð)äÐ8Ó9Ð9r   c                 óž   — |j                  «       j                  «       }|dt        d«       dk(  r| j                  |«      \  }} | |||«      S y)úÄ
        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>'.
        Nrv   )r`   ra   r2   rŒ   )r   r   r    Úattr_string_lowerrw   rx   s         r   r!   zDateAttribute.parse_attribute=  sV   € ð (×-Ñ-Ó/×5Ñ5Ó7Ðà˜\œc &›kÐ*¨fÒ4Ø),×)=Ñ)=¸kÓ)JÑ&ˆK˜Ù�t˜[¨-Ó8Ð8àr   c                 ó`  — |j                  «       j                  d«      j                  d«      }|dk(  r t        j                  d| j                  «      S t        j                  j                  || j                  «      }t        j                  |«      j                  d| j                  › d�«      S )r#   Ú'Ú"rL   ÚNaTzdatetime64[Ú])ra   r   ry   rx   ÚdatetimeÚstrptimerw   Úastype)r   r%   Údate_strÚdts       r   r&   zDateAttribute.parse_dataO  s‘   € ð —>‘>Ó#×)Ñ)¨#Ó.×4Ñ4°SÓ9ˆØ�sŠ?Ü—=‘= ¨×(:Ñ(:Ó;Ð;ä×"Ñ"×+Ñ+¨H°d×6FÑ6FÓGˆBÜ—=‘= Ó$×+Ñ+Ø˜d×0Ñ0Ð1°Ð3ó5ð 5r   c                 ó@   •— t         ‰| �  «       dz   | j                  z   S )Nr(   )r7   r+   rw   ©r   r;   s    €r   r+   zDateAttribute.__str__[  s    ø€ Ü‰w‰Ó  3Ñ&¨×)9Ñ)9Ñ9Ð9r   )r	   r
   r   r   rS   rŒ   r,   r!   r&   r+   rT   rU   s   @r   rt   rt     s@   ø„ ô:ð ñ$:ó ð$:ðL ñó ðò"
5÷:ð :r   rt   c                   ó>   ‡ — e Zd Zˆ fd„Zed„ «       Zd„ Zˆ fd„Zˆ xZS )ÚRelationalAttributec                 óx   •— t         ‰| �  |«       d| _        t        j                  | _        g | _        d | _        y )NÚ
relational)r7   r   r)   r   r   r   Ú
attributesÚdialectr[   s     €r   r   zRelationalAttribute.__init__a  s0   ø€ Ü‰Ñ˜ÔØ%ˆŒÜ—Z‘ZˆŒ
ØˆŒØˆ�r   c                 ór   — |j                  «       j                  «       }|dt        d«       dk(  r | |«      S y)rŽ   NrŸ   r_   )r   r   r    r�   s       r   r!   z#RelationalAttribute.parse_attributeh  s>   € ð (×-Ñ-Ó/×5Ñ5Ó7ÐàÐ/œc ,Ó/Ð0°LÒ@Ù�t“9Ðàr   c                 ó$  — t        t        t        | j                  «      «      «      }|j	                  «       j                  d«      }g }|j                  d«      D ]g  }t        || j                  «      \  }| _        |j                  t        |D �cg c]#  }| j                  |   j                  ||   «      ‘Œ% c}«      «       Œi t        j                  || j                  D �cg c]  }|j                  |j                  f‘Œ c}«      S c c}w c c}w )Nzunicode-escapeÚ
)Úlistr   r2   r    ÚencodeÚdecodeÚsplitr@   r¡   ÚappendrB   r&   r   Úarrayr   r   )	r   r%   ÚelemsÚescaped_stringÚ
row_tuplesÚrawÚrowr4   Úas	            r   r&   zRelationalAttribute.parse_datay  sê   € ä”Uœ3˜tŸ™Ó/Ó0Ó1ˆà!Ÿ™Ó*×1Ñ1Ð2BÓCˆàˆ
à!×'Ñ'¨Ö-ˆCÜ /°°T·\±\Ó BÑˆC�”à×ÑœeÙ@EÓFÁ¸1�—‘ Ñ#×.Ñ.¨s°1©vÕ6ÀÑFóHõ Ið .ô �x‰x˜
Ø48·O²OÓD±O¨q˜!Ÿ&™& !§'¡'Ò*°OÑDóFð 	Fùò Gùò Es   Â(DÃ"D
c                 ól   •— t         ‰| �  «       dz   dj                  d„ | j                  D «       «      z   S )Nz
	c              3   ó2   K  — | ]  }t        |«      –— Œ y ­wr   )rM   )r3   r°   s     r   r5   z.RelationalAttribute.__str__.<locals>.<genexpr>Œ  s   è ø€ Ð<©O qœC ŸF©Oùr6   )r7   r+   Újoinr    r›   s    €r   r+   zRelationalAttribute.__str__Š  s2   ø€ Ü‘‘Ó! FÑ*Ø—‘Ñ<¨D¯OªOÓ<Ó<ñ=ð 	>r   )	r	   r
   r   r   r,   r!   r&   r+   rT   rU   s   @r   r�   r�   _  s,   ø„ ôð ñó ðò F÷">ð >r   r�   c                 ó’   — t         t        t        t        t        f}|D ]  }|j                  | |«      }|€Œ|c S  t        d|› �«      ‚)Nzunknown attribute )r.   rW   rt   ro   r�   r!   r   )r   r    Úattr_classesr   Úattrs        r   Úto_attributer·   ’  sU   € Ü$Ô&6¼Ü#Ô%8ð:€Ló ˆØ×"Ñ" 4¨Ó5ˆØÑØŠKð ô
 Ð-¨k¨]Ð;Ó
<Ð<r   c                  óÂ   — t        t        dd«      } | €Kt        j                  «       j	                  d«      }|j
                  dk7  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€Gà€Ü—+‘+“-×%Ñ% hÓ/ˆØ18×1BÑ1BÀcÑ1IÔ&Ô.Ü0×8Ñ8ˆà€Nr   c                 óø  — t        «       �rod}dd|dfD ]L  }t        j                  |t        j                  t        j                  z  «      }|j                  | «      }|sŒL n |k7  ry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        |j                  | «      «      }|
|_        ||v r||_        ||_        ||_        yy)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Ú
groupindexr2   ÚboolÚescapeÚsearchr¿   Ú	delimiterÚdoublequoteÚskipinitialspace)Ú
sniff_liner¡   Ú
delimitersÚright_regexÚrestrÚregexpÚmatchesrÉ   rE   ÚnrÁ   rÂ   rÃ   Ú	dq_regexprÎ   s                  r   Ú%workaround_csv_sniffer_bug_last_fieldrØ   ®  s¾  € ô &Õ'à`ˆàbØ`Ø!ØFóHˆEô —Z‘Z ¤r§y¡y´2·<±<Ñ'?Ó@ˆFØ—n‘n ZÓ0ˆGÚÙðHð �KÒØà×&Ñ&ˆ
ô �7‹|˜qÒ Ð Ð Ø�A‰Jˆà�wÑ !Ñ#ˆØ�!‘ˆà�wÑ !Ñ#ˆØ�!‘ˆà�wÑ !Ñ#ˆÜ�Q�q‘T“
ˆä—J‘JØ”"—)‘)˜EÓ"Ð# 7¨5¨'°´B·I±I¸eÓ4DÐ3EÀTÈ%ÈÐPRÔSU×S\ÑS\Ð]bÓScÐRdÐdhÐinÐhoÐotÔuw×u~Ñu~ð  @Eó  vFð  uGð  GKð  Lô  NP÷  NZñ  NZó
ˆ	ô ˜9×+Ñ+¨JÓ7Ó8ˆà!ˆÔØ�JÑØ %ˆGÔØ)ˆÔØ#(ˆÕ ðW (r   c                 ó¦  ‡ — d}t        j                  t        t        j                  d«      j
                  dz  «      «       ‰ d   dk(  r‰ d d Š ‰ j                  «       Š ‰ }t        ˆ fd„|D «       «      s|dz  }|€3t        j                  «       j                  ||¬«      }t        |||¬«       t        t        j                  ‰ g|«      «      }||fS )	Nz,	rO   é   r¤   c              3   ó&   •K  — | ]  }|‰v –— Œ
 y ­wr   r   )r3   ÚdÚlines     €r   r5   z"split_data_line.<locals>.<genexpr>ò  s   øè ø€ Ð-¡*˜Qˆq�DŒy¡*ùs   ƒr(   )rÑ   )rÐ   r¡   rÑ   )r¼   Úfield_size_limitr]   ÚctypesÚc_ulongÚvaluera   Úanyr½   r¾   rØ   ÚnextÚreader)rÝ   r¡   rÑ   rÐ   r¯   s   `    r   r@   r@   à  sÊ   ø€ Ø€Jô ×ÑœœVŸ^™^¨BÓ/×5Ñ5¸Ñ:Ó;Ô<ð ˆB�x�4ÒØ�C�Rˆyˆð �:‰:‹<€Dà€Jô Ó-¡*Ó-Ô-Ø�cÑˆ
à€Ü—+‘+“-×%Ñ% j¸ZÐ%ÓHˆÜ-¸Ø6=Ø9Cõ	Eô Œs�z‰z˜4˜& 'Ó*Ó
+€Cà�ˆ<Ðr   c                 óÀ  — |j                  «       }t        j                  |«      }|rz|j                  d«      }t        j                  |«      rt        |«      \  }}t        | «      }nHt        j                  |«      rt        |«      \  }}t        | «      }nt        d«      ‚t        d|› �«      ‚t        ||«      }|j                  «       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Ÿ   )ra   Úr_attributer?   rA   Úr_comattrvalÚtokenize_single_commarã   Úr_wcomattrvalÚtokenize_single_wcommarC   r·   r`   Úread_relational_attribute)ÚiterableÚ	attributeÚsattrÚmattrrD   r   ÚtypeÚ	next_items           r   Útokenize_attributerò     sÑ   € ðT �O‰OÓ€EÜ×Ñ˜eÓ$€EÙà�{‰{˜1‹~ˆÜ×Ñ˜dÔ#Ü.¨tÓ4‰JˆD�$Ü˜X›‰IÜ× Ñ  Ô&Ü/°Ó5‰JˆD�$Ü˜X›‰Iô Ð;Ó<Ð<äÐ2°5°'Ð:Ó;Ð;ä˜T 4Ó(€Ià‡z�zƒ|�|Ò#Ü-¨h¸	À9ÓMˆ	ð �iÐÐr   c                 ó  — t         j                  | «      }|rC	 |j                  d«      j                  «       }|j                  d«      j                  «       }||fS t        d| › �«      ‚# t        $ r}t        d«      |‚d }~ww xY w©Nr=   rÚ   z Error while tokenizing attributezError while tokenizing single )rç   r?   rA   ra   Ú
IndexErrorrC   ©ÚvalrE   r   rð   Úes        r   rè   rè   H  sŒ   € ô 	×Ñ˜3Ó€AÙð	HØ—7‘7˜1“:×#Ñ#Ó%ˆDØ—7‘7˜1“:×#Ñ#Ó%ˆDð
 �ˆ:Ðô Ð9¸#¸Ð?Ó@Ð@øô ò 	HÜÐ?Ó@ÀaÐGûð	Húó   ™>A) Á)	BÁ2A>Á>Bc                 ó  — t         j                  | «      }|rC	 |j                  d«      j                  «       }|j                  d«      j                  «       }||fS t        d| › �«      ‚# t        $ r}t        d«      |‚d }~ww xY wrô   )ré   r?   rA   ra   rõ   rC   rö   s        r   rê   rê   W  sŒ   € ô 	×Ñ˜CÓ €AÙð	HØ—7‘7˜1“:×#Ñ#Ó%ˆDØ—7‘7˜1“:×#Ñ#Ó%ˆDð
 �ˆ:Ðô Ð9¸#¸Ð?Ó@Ð@øô ò 	HÜÐ?Ó@ÀaÐGûð	Húrù   c                 ó�  — t        j                  d|j                  z   dz   «      }|j                  |«      s„t        j                  |«      }|rPt
        j                  |«      }|r+t        | |«      \  }}|j                  j                  |«       nt        d|› �«      ‚t        | «      }|j                  |«      sŒ„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©   rC   rã   )ÚofileÚrelational_attributer4   Úr_end_relationalrE   Úisattrr¶   s          r   rë   rë   f  sÄ   € ô —z‘zÐ"6Ø"6×";Ñ";ñ#<Ø>Eñ#Fó GÐð ×$Ñ$ QÔ'Ü×Ñ˜qÓ!ˆÙÜ ×&Ñ& qÓ)ˆFÙÜ,¨U°AÓ6‘��aØ$×/Ñ/×6Ñ6°tÕ<ä Ð#6°q°cÐ!:Ó;Ð;ä�U“ˆAð ×$Ñ$ QÕ'ô 	ˆU‹€AØ€Hr   c                 ó$  — t        | «      }t        j                  |«      r!t        | «      }t        j                  |«      rŒ!d}g }t        j                  |«      s³t        j                  |«      }|r{t
        j                  |«      }|r!t        | |«      \  }}|j                  |«       nNt        j                  |«      }|r|j                  d«      }nt        d|› �«      ‚t        | «      }nt        | «      }t        j                  |«      sŒ³||fS )z&Read the header of the iterable ofile.Nr=   rü   )rã   Ú	r_commentr?   Ú
r_datametarý   ræ   rò   r©   Ú
r_relationrA   rC   )rþ   r4   Úrelationr    rE   r  r¶   Úisrels           r   Úread_headerr  |  sð   € äˆU‹€Aô �/‰/˜!Ô
Ü�‹Kˆô �/‰/˜!Õ
ð €HØ€JÜ×Ñ˜qÔ!Ü×Ñ˜qÓ!ˆÙÜ ×&Ñ& qÓ)ˆFÙÜ,¨U°AÓ6‘��aØ×!Ñ! $Õ'ä"×(Ñ(¨Ó+�ÙØ$Ÿ{™{¨1›~‘Hä$Ð':¸1¸#Ð%>Ó?Ð?Ü˜“K‘ä�U“ˆAô ×Ñ˜qÕ!ð" �ZÐÐr   c                   ó4   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	y)	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                 ó\   — || _         |D �ci c]  }|j                   |“Œ c}| _        y c c}w r   )r   Ú_attributes)r   Úrelr¶   r°   s       r   r   zMetaData.__init__¸  s+   € ØˆŒ	Ù/3Ó4©t¨!˜AŸF™F A™I¨tÑ4ˆÕùÒ4s   Œ)c                 ó"  — d}|d| j                   › d�z  }| j                  D ]j  }|d|› d| j                  |   j                  › �z  }| j                  |   j                  r(|dt	        | j                  |   j                  «      › �z  }|dz  }Œl |S )NÚ z	Dataset: r¤   Ú	z's type is z, range is )r   r  r)   r   rM   rQ   s      r   Ú__repr__zMetaData.__repr__¼  s£   € ØˆØ�˜4Ÿ9™9˜+ RÐ(Ñ(ˆØ×!Ô!ˆAØ�R˜�s˜+ d×&6Ñ&6°qÑ&9×&CÑ&CÐ%DÐEÑEˆCØ×Ñ Ñ"×(Ò(Ø˜¤S¨×)9Ñ)9¸!Ñ)<×)BÑ)BÓ%CÐ$DÐEÑE�Ø�4‰K‰Cð	 "ð
 ˆ
r   c                 ó,   — t        | j                  «      S r   )Úiterr  r*   s    r   Ú__iter__zMetaData.__iter__Æ  s   € Ü�D×$Ñ$Ó%Ð%r   c                 óP   — | 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                 óp   — | j                   D �cg c]  }| j                   |   j                  ‘Œ }}|S c c}w )z�Return the list of attribute types.

        Returns
        -------
        attr_types : list of str
            The attribute types.
        )r  r)   )r   r   Ú
attr_typess      r   ÚtypeszMetaData.typesØ  sF   € ð #'×"2Ò"2ó4Ù"2˜$ð ×&Ñ& tÑ,×6Ó6Ø"2ð 	ð 4àÐùò4s   � 3N)
r	   r
   r   r   r   r  r  r  r  r  r   r   r   r   r   ›  s%   „ ñò85òò&ò,ò
&ó
r   r   c                 ó¬   — t        | d«      r| }nt        | «      }	 t        |«      || ur|j                  «        S S # || ur|j                  «        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   å  sU   € ôL ˆq�&ÔØ‰ä�Q“ˆðÜ˜Óà˜‰>Ø�K‰K�Mð øˆ5˜‰>Ø�K‰K�Mð ús	   œ
< ¼Ac                 ó°  ‡	‡
— 	 t        | «      \  }Š	d}‰	D ]  }t	        |t
        «      sŒd}Œ t        |‰	«      }|rt        d«      ‚t        ‰	«      Š
dˆ	ˆ
fd„	}t         || «      «      }t        j                  |‰	D �cg c]  }|j                  |j                  f‘Œ c}«      }||fS # t        $ r}dt        |«      z   }t        |«      |‚d }~ww xY wc c}w )Nz'Error while parsing header, error was: FTz*String attributes not supported yet, sorryc           
   3   ó&  •K  — t        t        ‰«      «      }d }| D ]l  }t        j                  |«      st        j                  |«      rŒ.t        ||«      \  }}t        |D �cg c]  }‰|   j                  ||   «      ‘Œ c}«      –— Œn y c c}w ­wr   )r¥   r   r  r?   Úr_emptyr@   rB   r&   )	Úrow_iterrÂ   r«   r¡   r®   r¯   r4   r¶   Únis	          €€r   Ú	generatorz_loadarff.<locals>.generatorU  s„   øè ø€ ô ”U˜2“Y“ˆàˆÛˆCô �‰˜sÔ#¤w§}¡}°SÔ'9Øä*¨3°Ó8‰LˆC�ä¹UÓC¹U¸˜˜a™×+Ñ+¨C°©FÕ3¸UÑCÓDÓDñ ùò Dùs   ƒABÁ"B
Â B)r(   )r  rC   rM   r   Ú
isinstancero   r   ÚNotImplementedErrorr2   r¥   r   rª   r   r   )rþ   r  rø   rR   Úhasstrr°   Úmetar(  rk   r¶   r'  s            @@r   r   r   6  sà   ù€ ð)Ü Ó&‰	ˆˆTð €FÛˆÜ�aœÕ)Ø‰Fð ô �C˜Ó€Dñ ô "Ð"NÓOÐOä	ˆT‹€BöEô8 	‰Y�uÓÓ€Aä�8‰8�A±4Ó8±4¨a˜Ÿ™ §¡Ò)°4Ñ8Ó9€DØ�ˆ:Ðøôu ò )Ø7¼#¸a»&Ñ@ˆÜ˜SÓ! qÐ(ûð)üòr 9s   „B( Á>C
Â(	CÂ1CÃCr   )(rÄ   r•   Únumpyr   r¼   rß   Ú__all__rÅ   Úr_metar  r%  rý   r  r  ræ   r>   r‰   rç   ré   ÚOSErrorr   r   r   r.   rW   ro   rt   r�   r·   r»   rØ   r@   rò   rè   rê   rë   r  r   r   r   r   r   r   Ú<module>r1     s†  ðã 	Û ã ã 
Û à "â
A€ð$ 
ˆ�‰�HÓ	€àˆB�J‰J�uÓ€	à
ˆ"�*‰*�XÓ
€àˆr�z‰z˜+Ó&€ØˆR�Z‰ZÐ-Ó.€
ØˆR�Z‰ZÐEÓF€
Øˆb�j‰jÐNÓO€àˆB�J‰J�yÓ!€	Ø	ˆ�‰Ð<Ó	=€ð ˆr�z‰zÐ-Ó.€à�—
‘
Ð,Ó-€ô	�ô 	ô	�Yô 	÷0ñ 0ô<H�yô HôV;5�yô ;5ô|�iô ô0P:�Iô P:ôf->˜)ô ->òf	=òò /)ódòFB òJòòò, ÷>Gñ GòTNób>r   