
    Vg                     h    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	y)	    )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y)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      t        |dz
        D cg c]  }| j                          }}|r-| j                  |      }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  }|j                  |       d
j                  d |D              S c c}w )N)      zlength can only be 8 or 13   r   )   r   r   r   r   r   r   r   )r   r   r   r   r   r   r   r   r   r   r   r   c              3   ,   K   | ]  \  }}||z    y wNr	   ).0xys      a/var/www/html/hubwallet-dev/venv/lib/python3.12/site-packages/faker/providers/barcode/__init__.py	<genexpr>z Provider._ean.<locals>.<genexpr>#   s     @TQ1q5@s   
    c              3   2   K   | ]  }t        |        y wr   )str)r   r   s     r   r   z Provider._ean.<locals>.<genexpr>'   s     ,!s1v,s   )AssertionErrorrangerandom_digitrandom_elementmapintlensumzipappendjoin)	selfr   r   _codeprefixweightsweighted_sumcheck_digits	            r   _eanzProvider._ean   s      !=>>-26A:->?!!#??--h7F"%c6"2D3v;Q;+Gr\:G@Sw-?@@L2--3K ww,t,,, @s   Cc                 (    | j                  ||      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   r0   )r)   r   r   s      r   eanzProvider.ean)   s     yy(y33    c                 (    | j                  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   r2   r3   r)   r   s     r   ean8zProvider.ean89   s     yyXy..r5   c                 (    | j                  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   r2   r3   r7   s     r   ean13zProvider.ean13H   s    $ yyhy//r5   c                 <    | j                  || 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
        r2   )r0   r
   )r)   r   s     r   localized_eanzProvider.localized_ean\   s     yy$*=*=y>>r5   c                 $    | j                  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     !!!$$r5   c                 $    | j                  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>   r?   s    r   localized_ean13zProvider.localized_ean13t   s     !!"%%r5   N)r   r	   )r	   )r   )__name__
__module____qualname____doc__r
   
PrefixType__annotations__r#   r   r0   r4   r8   r:   r<   r@   rB   r	   r5   r   r   r   
   s     "$NJ#-3 -z -3 -*4# 4j 4# 4 /Z / /0j 0# 0(?C ? ? % %& &r5   r   N)
typingr   r   r   r   	localizedr#   r   rG   r   r	   r5   r   <module>rK      sK     	5c5sCx#)=#>>?DE
p&| p&r5   