
    lit
                     p    d Z ddlmZmZ dZ G d d          Z G d de          Z G d d	e          Zd
S )zX
This module is responsible for generating the check digit and formatting
ISBN numbers.
    )AnyOptional   c                   d    e Zd Z	 	 	 	 ddee         dee         dee         dee         ddf
dZdS )	ISBNNeangroup
registrantpublicationreturnc                 >    || _         || _        || _        || _        d S N)r   r	   r
   r   )selfr   r	   r
   r   s        i/var/www/html/Pagina-Ingenieria-Requisitos/venv/lib/python3.11/site-packages/faker/providers/isbn/isbn.py__init__zISBN.__init__   s'     
$&    )NNNN)__name__
__module____qualname__r   strr    r   r   r   r      s{         "#$(%)
' 
'c]
' }
' SM	
'
 c]
' 

' 
' 
' 
' 
' 
'r   r   c                   J     e Zd Zdededdf fdZdefdZd
dedefd	Z xZS )ISBN13argskwargsr   Nc                 l     t                      j        |i | |                                 | _        d S r   superr   _check_digitcheck_digitr   r   r   	__class__s      r   r   zISBN13.__init__   9    $)&))),,..r   c                 2   d t          d          D             }d                    d | j        | j        | j        | j        fD                       }t          d t          ||          D                       dz  }d|z
  }|dk    rdn|}t          |          S )zCalculate the check digit for ISBN-13.
        See https://en.wikipedia.org/wiki/International_Standard_Book_Number
        for calculation.
        c              3   0   K   | ]}|d z  dk    rdndV  dS )   r         Nr   ).0xs     r   	<genexpr>z&ISBN13._check_digit.<locals>.<genexpr>#   s2      ==aA

11======r       c                     g | ]}||S r   r   r)   parts     r   
<listcomp>z'ISBN13._check_digit.<locals>.<listcomp>$   s    wwwfjfvfvfvfvr   c              3   @   K   | ]\  }}t          |          |z  V  d S r   intr)   bws      r   r+   z&ISBN13._check_digit.<locals>.<genexpr>%   0      BBtq!A
BBBBBBr   
   r   )	rangejoinr   r	   r
   r   sumzipr   )r   weightsbody	remainderdiffr    s         r   r   zISBN13._check_digit   s    
 >=599===wwww$(DJQUQa)bwwwxxBBs4/A/ABBBBBRG	I~2::aa4;r   r-   	separatorc                 |    |                     d | j        | j        | j        | j        | j        fD                       S )Nc                     g | ]}||S r   r   r/   s     r   r1   z!ISBN13.format.<locals>.<listcomp>,   s,     
 
 
 #  $##r   )r;   r   r	   r
   r   r    r   rB   s     r   formatzISBN13.format*   sS    ~~
 
 HJO$$
 
 

 
 	
r   r-   	r   r   r   r   r   r   r   rF   __classcell__r"   s   @r   r   r      s        /c /S /T / / / / / /
 c 
  
  
  
 
 
 
S 
 
 
 
 
 
 
 
r   r   c                   J     e Zd Zdededdf fdZdefdZd
dedefd	Z xZS )ISBN10r   r   r   Nc                 l     t                      j        |i | |                                 | _        d S r   r   r!   s      r   r   zISBN10.__init__;   r#   r   c                 $   t          dd          }d                    d | j        | j        | j        fD                       }t          d t          ||          D                       dz  }|dk    rdnt          |          }t          |          S )zCalculate the check digit for ISBN-10.
        See https://en.wikipedia.org/wiki/International_Standard_Book_Number
        for calculation.
        r'   r9   r-   c                     g | ]}||S r   r   r/   s     r   r1   z'ISBN10._check_digit.<locals>.<listcomp>E   s    mmm\`\l\l\l\lr   c              3   @   K   | ]\  }}t          |          |z  V  d S r   r3   r5   s      r   r+   z&ISBN10._check_digit.<locals>.<genexpr>F   r8   r      X)r:   r;   r	   r
   r   r<   r=   r   )r   r>   r?   r@   r    s        r   r   zISBN10._check_digit?   s    
 2,,wwmm$*dotGW)XmmmnnBBs4/A/ABBBBBRG	&"__cc#i..;r   r-   rB   c                 p    |                     d | j        | j        | j        | j        fD                       S )Nc                     g | ]}||S r   r   r/   s     r   r1   z!ISBN10.format.<locals>.<listcomp>L   s,     	 	 	 #  $##r   )r;   r	   r
   r   r    rE   s     r   rF   zISBN10.formatJ   sN    ~~	 	 JO$$		 	 	
 
 	
r   rG   rH   rJ   s   @r   rL   rL   :   s        /c /S /T / / / / / /	 c 	  	  	  	 
 
 
S 
 
 
 
 
 
 
 
r   rL   N)__doc__typingr   r   
MAX_LENGTHr   r   rL   r   r   r   <module>rX      s    
 !              
' ' ' ' ' ' ' '
 
 
 
 
T 
 
 
B
 
 
 
 
T 
 
 
 
 
r   