
    li                         d dl mZmZ ddlmZ dZeeeeeeeef         df         f         df         Z G d de          Z	dS )	    )TupleUnion   )BaseProviderT.c                       e Zd ZU dZdZeed<   ddededefdZ	ddededefd	Z
ddedefd
ZddedefdZddedefdZdefdZdefdZdS )ProviderzxImplement default barcode provider for Faker.

    Sources:

    - https://gs1.org/standards/id-keys/company-prefix
     local_prefixes   lengthprefixesreturnc                     |dvrt          d           fdt          |dz
            D             }|r<                     |          }t          t          |          |d t          |          <   |dk    rg d}n
|dk    rg d}t          d	 t          ||          D                       }d
|d
z  z
  d
z  }|                    |           d	                    d |D                       S )N)   r   zlength can only be 8 or 13c                 8    g | ]}                                 S r	   )random_digit).0_selfs     p/var/www/html/Pagina-Ingenieria-Requisitos/venv/lib/python3.11/site-packages/faker/providers/barcode/__init__.py
<listcomp>z!Provider._ean.<locals>.<listcomp>   s%    ???!!##???       r   )   r   r   r   r   r   r   r   )r   r   r   r   r   r   r   r   r   r   r   r   c              3   &   K   | ]\  }}||z  V  d S Nr	   )r   xys      r   	<genexpr>z Provider._ean.<locals>.<genexpr>#   s*      @@TQ1q5@@@@@@r   
    c              3   4   K   | ]}t          |          V  d S r   )str)r   r   s     r   r   z Provider._ean.<locals>.<genexpr>'   s(      ,,!s1vv,,,,,,r   )
AssertionErrorrangerandom_elementmapintlensumzipappendjoin)r   r   r   codeprefixweightsweighted_sumcheck_digits   `       r   _eanzProvider._ean   s      !=>>>????U6A:->->??? 	3--h77F"%c6"2"2D3v;;Q;;+++GGr\\:::G@@Sw-?-?@@@@@L2--3K   ww,,t,,,,,,r   c                 0    |                      ||          S )a  Generate an EAN barcode of the specified ``length``.

        The value of ``length`` can only be ``8`` or ``13`` (default) which will
        create an EAN-8 or an EAN-13 barcode respectively.

        If a value for ``prefixes`` is specified, the result will begin with one
        of the sequences in ``prefixes``.

        :sample: length=13
        :sample: length=8
        :sample: prefixes=('00',)
        :sample: prefixes=('45', '49')
        r   r3   )r   r   r   s      r   eanzProvider.ean)   s     yy(y333r   c                 0    |                      d|          S )ag  Generate an EAN-8 barcode.

        This method uses |ean| under the hood with the ``length`` argument
        explicitly set to ``8``.

        If a value for ``prefixes`` is specified, the result will begin with one
        of the sequences in ``prefixes``.

        :sample:
        :sample: prefixes=('00',)
        :sample: prefixes=('45', '49')
        r   r5   r6   r   r   s     r   ean8zProvider.ean89   s     yyXy...r   c                 0    |                      d|          S )aH  Generate an EAN-13 barcode.

        This method uses |ean| under the hood with the ``length`` argument
        explicitly set to ``13``.

        If a value for ``prefixes`` is specified, the result will begin with one
        of the sequences in ``prefixes``.

        .. note::
           Codes starting with a leading zero are treated specially in some
           barcode readers. For more information on compatibility with UPC-A
           codes, see |EnUsBarcodeProvider.ean13|.

        :sample:
        :sample: prefixes=('00',)
        :sample: prefixes=('45', '49')
        r   r5   r6   r9   s     r   ean13zProvider.ean13H   s    $ yyhy///r   c                 :    |                      || j                  S )a  Generate a localized EAN barcode of the specified ``length``.

        The value of ``length`` can only be ``8`` or ``13`` (default) which will
        create an EAN-8 or an EAN-13 barcode respectively.

        This method uses the standard barcode provider's |ean| under the hood
        with the ``prefixes`` argument explicitly set to ``local_prefixes`` of
        a localized barcode provider implementation.

        :sample:
        :sample: length=13
        :sample: length=8
        r5   )r3   r
   )r   r   s     r   localized_eanzProvider.localized_ean\   s     yy$*=y>>>r   c                 ,    |                      d          S )zGenerate a localized EAN-8 barcode.

        This method uses |localized_ean| under the hood with the ``length``
        argument explicitly set to ``8``.
        r   r>   r   s    r   localized_ean8zProvider.localized_ean8l   s     !!!$$$r   c                 ,    |                      d          S )zGenerate a localized EAN-13 barcode.

        This method uses |localized_ean| under the hood with the ``length``
        argument explicitly set to ``13``.
        r   r@   rA   s    r   localized_ean13zProvider.localized_ean13t   s     !!"%%%r   N)r   r	   )r	   )r   )__name__
__module____qualname____doc__r
   
PrefixType__annotations__r(   r#   r3   r7   r:   r<   r>   rB   rD   r	   r   r   r   r   
   s9          "$NJ###- -3 -z -3 - - - -*4 4# 4j 4# 4 4 4 4 / /Z / / / / /0 0j 0# 0 0 0 0(? ?C ? ? ? ? ? % % % % %& & & & & & &r   r   N)
typingr   r   r!   r   	localizedr(   r#   rI   r   r	   r   r   <module>rM      s                 	5c5sCx#)=#>>?DE
p& p& p& p& p&| p& p& p& p& p&r   