
    li
                     Z    d dl mZmZmZ ddlmZ ddlmZmZm	Z	 dZ
 G d de          Zd	S )
    )DictListTuple   )BaseProvider   )ISBN10ISBN13
MAX_LENGTHTc            	           e Zd ZU dZi Zeeeeeeeee	f                  f         f         e
d<   dee         fdZededeeeee	f                  deeef         fd            Zddedefd	Zddedefd
ZdS )ProviderzGenerates fake ISBNs.

    See https://www.isbn-international.org/content/what-isbn for the
    format of ISBNs.
    See https://www.isbn-international.org/range_file_generation for the
    list of rules pertaining to each prefix/registration group.
    rulesreturnc                    |                      | j                                                  }|                      | j        |                                                   }t          t	          |          z
  t	          |          z
  dz
  }|                     d|z            }| j        |         |         }|                     ||          \  }}||||gS )zSGenerate the information required to create an ISBN-10 or
        ISBN-13.
        r   #)random_elementr   keysr   lennumerify_registrant_publication)selfean	reg_groupreg_pub_lenreg_pubr   
registrantpublications           m/var/www/html/Pagina-Ingenieria-Requisitos/venv/lib/python3.11/site-packages/faker/providers/isbn/__init__.py_bodyzProvider._body   s     &&tz'8'899,,TZ_-A-A-C-CDD	 &C03y>>AAE }}S;%677 
3	*"&">">w"N"N
KY
K88    r   c                     |D ]0}|d         | dd         cxk    r|d         k    rn &|d         } n1t          d|  d          | d|         | |d         }}||fS )ap  Separate the registration from the publication in a given
        string.

        :param reg_pub: A string of digits representing a registration
            and publication.
        :param rules: A list of registrant rules which designate where
            to separate the values in the string.
        :returns: A (registrant, publication) tuple of strings.
        r   Nr   r   zRegistrant/Publication 'z$' not found in registrant rule list.)	Exception)r   r   rulereg_lenr   r   s         r   r   z Provider._registrant_publication)   s      	f 	fDAw'#2#,1111$q'11111q' 2 dwdddeee")(7("3WWXX5FK
;&&r    -	separatorc                     |                                  \  }}}}t          ||||          }|                    |          S z
        :sample:
        )r   r
   formatr   r'   r   groupr   r   isbns          r   isbn13zProvider.isbn13=   ?     /3jjll+UJc5*k::{{9%%%r    c                     |                                  \  }}}}t          ||||          }|                    |          S r)   )r   r	   r*   r+   s          r   isbn10zProvider.isbn10E   r/   r    N)r&   )__name__
__module____qualname____doc__r   r   strr   r   int__annotations__r   staticmethodr   r.   r1    r    r   r   r   	   s          ?AE4T#tE#sC-$899::;@@@9tCy 9 9 9 9* ' 'T%S#:N5O 'TYZ]_bZbTc ' ' ' \'&& & &c & & & && & &c & & & & & &r    r   N)typingr   r   r    r   r-   r	   r
   r   	localizedr   r:   r    r   <module>r>      s    $ $ $ $ $ $ $ $ $ $       , , , , , , , , , ,	B& B& B& B& B&| B& B& B& B& B&r    