
    XV.j`
                     l    d dl Zd dlmc m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y)
    N)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y
)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                 p   | j                  | j                  j                               }| j                  | j                  |   j                               }t        t	        |      z
  t	        |      z
  dz
  }| j                  d|z        }| j                  |   |   }| 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           _C:\xampp\htdocs\tradingbinance\backend\.venv\Lib\site-packages\faker\providers\isbn\__init__.py_bodyzProvider._body   s     &&tzz'89,,TZZ_-A-A-CD	 &C03y>AAE }}S;%67 

3	*"&">">w"N
KY
K88    r   c                     |D ]   }|d   | dd cxk  r	|d   k  sn |d   } n t        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)   so     DAw'#2,1$q'1q' 
 6wi?cdee")(7"3WWX5FK
;&&r    	separatorc                 j    | j                         \  }}}}t        ||||      }|j                  |      S N)r   r
   formatr   r&   r   groupr   r   isbns          r   isbn13zProvider.isbn13=   5    .2jjl+UJc5*k:{{9%%r    c                 j    | j                         \  }}}}t        ||||      }|j                  |      S r(   )r   r	   r)   r*   s          r   isbn10zProvider.isbn10B   r.   r    N)-)__name__
__module____qualname____doc__r   r   strr   r   int__annotations__r   staticmethodr   r-   r0    r    r   r   r   	   s     ?AE4T#tE#sC-$899::;@9tCy 9* ' 'T%S#:N5O 'TYZ]_bZbTc ' '&& &c &
& &c &r    r   )builtins@py_builtins_pytest.assertion.rewrite	assertionrewrite
@pytest_artypingr   r   r    r   r,   r	   r
   r   	localizedr   r:   r    r   <module>rD      s*       $ $  , ,	<&| <&r    