
    Xf                     8    d Z d Zd Z G d de          Zd ZdS )a+  Parse the enzyme.dat file from Enzyme at ExPASy.

See https://www.expasy.org/enzyme/

Tested with the release of 03-Mar-2009.

Functions:
 - read       Reads a file containing one ENZYME entry
 - parse      Reads a file containing multiple ENZYME entries

Classes:
 - Record     Holds ENZYME data.

c              #   8   K   	 t          |           }|sdS |V  )zParse ENZYME records.

    This function is for parsing ENZYME files containing multiple
    records.

    Arguments:
     - handle   - handle to the file.

    TN)__read)handlerecords     1lib/python3.11/site-packages/Bio/ExPASy/Enzyme.pyparser      s1       	E	    c                 n    t          |           }|                                 }|rt          d          |S )zRead one ENZYME record.

    This function is for parsing ENZYME files containing
    exactly one record.

    Arguments:
     - handle   - handle to the file.

    z!More than one ENZYME record found)r   read
ValueError)r   r   	remainders      r   r
   r
   (   s8     F^^FI ><===Mr   c                   $    e Zd ZdZd Zd Zd ZdS )Recorda  Holds information from an ExPASy ENZYME record as a Python dictionary.

    Each record contains the following keys:

    - ID: EC number
    - DE: Recommended name
    - AN: Alternative names (if any)
    - CA: Catalytic activity
    - CF: Cofactors (if any)
    - PR: Pointers to any Prosite documentation entries that correspond to the
      enzyme
    - DR: Pointers to any Swiss-Prot protein sequence entries that correspond
      to the enzyme
    - CC: Comments

    c                     t                               |            d| d<   d| d<   g | d<   d| d<   d| d<   g | d<   g | d<   g | d	<   d
S )zInitialize the class. IDDEANCACFCCPRDRN)dict__init__selfs    r   r   zRecord.__init__L   s`    dT
T
T
T
T
T
T
T


r   c                     | d         rA| d         r!| j         j         d| d          d| d          dS | j         j         d| d          dS | j         j         dS )z@Return the canonical string representation of the Record object.r   r   z (z, )z ( ))	__class____name__r   s    r   __repr__zRecord.__repr__X   s{    : 	4Dz C.1PPT$ZPP4:PPPP.1BBT$ZBBBBn-3333r   c                 >   d| d         z   d| d         z   dt          | d                   z   d| d         z   d	z   d
| d         z   dt          | d                   z   dt          | d                   z   dt          | d                   z  g}d                    |          S )z=Return a readable string representation of the Record object.zID: r   zDE: r   zAN: r   zCA: 'r   'zCF: r   zCC: r   zPR: r   zDR: %d Recordsr   
)reprlenjoin)r   outputs     r   __str__zRecord.__str__b   s     T$ZT$ZT$t*%%%d4j 3&T$ZT$t*%%%T$t*%%%s4:.	
 yy   r   N)r    
__module____qualname____doc__r   r!   r)    r   r   r   r   :   sK         "
 
 
4 4 4! ! ! ! !r   r   c                    d }| D ]r}|d d         |dd                                           }}|dk    rt                      }||d<   C|dk    r|dxx         |z  cc<   Z|dk    r_|d         r;|d         d                             d          s|d         dxx         d|z   z  cc<   |d                             |           |d	k    r|d	xx         |z  cc<   |d
k    r|                     d                              d          }|D ]]}|                    d          \  }}|                                |                                g}	|d
                             |	           ^f|dk    r$|d         r|dxx         d|z   z  cc<   ||d<   |dk    rQ|                    d          sJ |dd                               d          }|d                             |           |dk    rw|                    d          r%|d                             |dd                     '|                    d          r&|d         r|d         dxx         |dd          z  cc<   d|dk    r|r|c S rt|rt          d          d S )N      r   r   r   . r   r   ;,r   r   z	PROSITE; 	   r   z-!-    z       z//zUnexpected end of stream)rstripr   endswithappendsplitstrip
startswithr   )
r   r   linekeyvalue	pair_datapairt1t2rows
             r   r   r   t   s   F ' '"1"XtABBx00U$;;XXF F4LLD[[4LLLE!LLLLD[[d| +F4L$4$=$=c$B$B +tR   C%K/    t##E****D[[4LLLE!LLLLD[[S))//44I! ) )CBxxzz288::.t##C(((() D[[d| %te+$tD[[##K00000!""I$$S))E4L&&&&D[['' .t##E!""I....!!&)) .fTl .tR   E!""I-   D[[ 	 
  534445 5r   N)r,   r   r
   r   r   r   r-   r   r   <module>rG      sq       "  $4! 4! 4! 4! 4!T 4! 4! 4!t+5 +5 +5 +5 +5r   