
    VgW(                     F    d dl mZmZmZmZ ddlmZ dZdZ G d de      Z	y)	    )ListOptionalSequencecast   )BaseProviderTlac                   n   e Zd ZdZdZdZ	 	 	 	 ddedee   dee	e      de
d	ee   f
d
Zddee   dee	e      d	efdZ	 ddede
dee	e      d	efdZddedee	e      d	ee   fdZ	 ddede
dee	e      d	efdZddedee	e      d	ee   fdZddedee	e      d	efdZ	 ddededee	e      d	ee   fdZy)Providera  Implement default lorem provider for Faker.

    .. important::
       The default locale of the lorem provider is ``la``. When using a locale
       without a localized lorem provider, the ``la`` lorem provider will be
       used, so generated words will be in pseudo-Latin. The locale used for
       the standard provider docs was ``en_US``, and ``en_US`` has a localized
       lorem provider which is why the samples here show words in American
       English.
     .Nnbpart_of_speechext_word_listuniquereturnc                 ,   ||}n:|r,|| j                   vrt        | d      | j                   |   }n| j                  }|r*t        t        t
           | j                  ||            }|S t        t        t
           | j                  ||            }|S )aZ  Generate a tuple of words.

        The ``nb`` argument controls the number of words in the resulting list,
        and if ``ext_word_list`` is provided, words from that list will be used
        instead of those from the locale provider's built-in word list.

        If ``unique`` is ``True``, this method will return a list containing
        unique words. Under the hood, |random_sample| will be used for sampling
        without replacement. If ``unique`` is ``False``, |random_choices| is
        used instead, and the list returned may contain duplicates.

        ``part_of_speech`` is a parameter that defines to what part of speech
        the returned word belongs. If ``ext_word_list`` is not ``None``, then
        ``part_of_speech`` is ignored. If the value of ``part_of_speech`` does
        not correspond to an existent part of speech according to the set locale,
        then an exception is raised.

        .. warning::
           Depending on the length of a locale provider's built-in word list or
           on the length of ``ext_word_list`` if provided, a large ``nb`` can
           exhaust said lists if ``unique`` is ``True``, raising an exception.

        :sample:
        :sample: nb=5
        :sample: nb=5, ext_word_list=['abc', 'def', 'ghi', 'jkl']
        :sample: nb=4, ext_word_list=['abc', 'def', 'ghi', 'jkl'], unique=True
        z' is not recognized as a part of speech.)length)parts_of_speech
ValueError	word_listr   r   strrandom_samplerandom_choices)selfr   r   r   r   r   unique_samplessampless           _/var/www/html/hubwallet-dev/venv/lib/python3.12/site-packages/faker/providers/lorem/__init__.pywordszProvider.words   s    D $%IT%9%99 N#33Z![\\ 00@	I!$s)T-?-?	RT-?-UVN!!tCy$"5"5i"5"KL    c                 .    | j                  d||      d   S )zGenerate a word.

        This method uses |words| under the hood with the ``nb`` argument set to
        ``1`` to generate the result.

        :sample:
        :sample: ext_word_list=['abc', 'def', 'ghi', 'jkl']
           r   )r   )r   r   r   s      r   wordzProvider.wordL   s     zz!^];A>>r    nb_wordsvariable_nb_wordsc                     |dk  ry|r| j                  |d      }t        | j                  ||            }|d   j                         |d<   | j                  j                  |      | j                  z   S )a  Generate a sentence.

        The ``nb_words`` argument controls how many words the sentence will
        contain, and setting ``variable_nb_words`` to ``False`` will generate
        the exact amount, while setting it to ``True`` (default) will generate
        a random amount (+/-40%, minimum of 1) using |randomize_nb_elements|.

        Under the hood, |words| is used to generate the words, so the argument
        ``ext_word_list`` works in the same way here as it would in that method.

        :sample: nb_words=10
        :sample: nb_words=10, variable_nb_words=False
        :sample: nb_words=10, ext_word_list=['abc', 'def', 'ghi', 'jkl']
        :sample: nb_words=10, variable_nb_words=True,
                 ext_word_list=['abc', 'def', 'ghi', 'jkl']
        r    r"   min)r   r   )randomize_nb_elementslistr   titleword_connectorjoinsentence_punctuation)r   r$   r%   r   r   s        r   sentencezProvider.sentenceW   ss    & q=11(1BHTZZ8=ZIJ8>>#a""''.1J1JJJr    c                 `    t        d|      D cg c]  }| j                  |       c}S c c}w )a  Generate a list of sentences.

        This method uses |sentence| under the hood to generate sentences, and
        the ``nb`` argument controls exactly how many sentences the list will
        contain. The ``ext_word_list`` argument works in exactly the same way
        as well.

        :sample:
        :sample: nb=5
        :sample: nb=5, ext_word_list=['abc', 'def', 'ghi', 'jkl']
        r   r   )ranger0   r   r   r   _s       r   	sentenceszProvider.sentencesu   s+     EJ!RLQqM:QQQ   +nb_sentencesvariable_nb_sentencesc                     |dk  ry|r| j                  |d      }| j                  j                  | j                  ||            }|S )a@  Generate a paragraph.

        The ``nb_sentences`` argument controls how many sentences the paragraph
        will contain, and setting ``variable_nb_sentences`` to ``False`` will
        generate the exact amount, while setting it to ``True`` (default) will
        generate a random amount (+/-40%, minimum of 1) using
        |randomize_nb_elements|.

        Under the hood, |sentences| is used to generate the sentences, so the
        argument ``ext_word_list`` works in the same way here as it would in
        that method.

        :sample: nb_sentences=5
        :sample: nb_sentences=5, variable_nb_sentences=False
        :sample: nb_sentences=5, ext_word_list=['abc', 'def', 'ghi', 'jkl']
        :sample: nb_sentences=5, variable_nb_sentences=False,
                 ext_word_list=['abc', 'def', 'ghi', 'jkl']
        r   r'   r"   r(   r2   )r*   r-   r.   r6   )r   r8   r9   r   paras        r   	paragraphzProvider.paragraph   sP    * 1 55l5JL""''|S`(abr    c                 `    t        d|      D cg c]  }| j                  |       c}S c c}w )a~  Generate a list of paragraphs.

        This method uses |paragraph| under the hood to generate paragraphs, and
        the ``nb`` argument controls exactly how many sentences the list will
        contain. The ``ext_word_list`` argument works in exactly the same way
        as well.

        :sample: nb=5
        :sample: nb=5, ext_word_list=['abc', 'def', 'ghi', 'jkl']
        r   r2   )r3   r<   r4   s       r   
paragraphszProvider.paragraphs   s+     FK1b\R];RRRr7   max_nb_charsc                 2   g }|dk  rt        d      |dk  r|sbd}||k  rH|r| j                  nd| j                  |      z   }|j                  |       |t	        |      z  }||k  rH|j                          |sb|d   d   j                         |d   dd z   |d<   t	        |      dz
  }||xx   | j                  z  cc<   n|d	k  re|sd}||k  rH|r| j                  nd| j                  |      z   }|j                  |       |t	        |      z  }||k  rH|j                          |sbnZ|sXd}||k  r>|rd
nd| j                  |      z   }|j                  |       |t	        |      z  }||k  r>|j                          |sXdj                  |      S )a"  Generate a text string.

        The ``max_nb_chars`` argument controls the approximate number of
        characters the text string will have, and depending on its value, this
        method may use either |words|, |sentences|, or |paragraphs| for text
        generation. The ``ext_word_list`` argument works in exactly the same way
        it would in any of those methods.

        :sample: max_nb_chars=20
        :sample: max_nb_chars=80
        :sample: max_nb_chars=160
        :sample: ext_word_list=['abc', 'def', 'ghi', 'jkl']
           z6text() can only generate text of at least 5 characters   r   r'   r2   r"   Nd   
)r   r-   r#   appendlenpopupperr/   r0   r<   r.   )	r   r?   r   textsizer#   
last_indexr0   r<   s	            r   rI   zProvider.text   s    !UVV" \)37D//R499[h9CiiDKK%CI%D \) 
  1gaj&&(4712;6DGTQJ 9 99C \)7; 3 3t}}cp}GqqHKK)CM)D \) 
   \))-2Vc9d dIKK	*C	N*D \) 
  wwt}r    nb_textsc                 `    t        d|      D cg c]  }| j                  ||       c}S c c}w )a   Generate a list of text strings.

        The ``nb_texts`` argument controls how many text strings the list will
        contain, and this method uses |text| under the hood for text generation,
        so the two remaining arguments, ``max_nb_chars`` and ``ext_word_list``
        will work in exactly the same way as well.

        :sample: nb_texts=5
        :sample: nb_texts=5, max_nb_chars=50
        :sample: nb_texts=5, max_nb_chars=50,
                 ext_word_list=['abc', 'def', 'ghi', 'jkl']
        r   )r3   rI   )r   rL   r?   r   r5   s        r   textszProvider.texts   s,     AFa@RS1		,6SSSr7   )   NNF)NN)   TN)rO   N)rO   TN)   N)rO   rQ   N)__name__
__module____qualname____doc__r-   r/   intr   r   r   boolr   r   r#   r0   r6   r<   r>   rI   rN    r    r   r   r      s   	 N (,1500 !0  .	0
 0 
c0d	?8C= 	?QYZ]Q^H_ 	?kn 	? koKK48KPXYabeYfPgK	K<RC RHXc]4K RW[\_W` R sw<@X`aijmanXo	>SS SXhsm5L SX\]`Xa S7 78HSM;R 7^a 7t dhTT/2TIQRZ[^R_I`T	cTr    r   N)
typingr   r   r   r   r'   r   	localizeddefault_localer   rX   r    r   <module>r\      s*    1 1 	 lT| lTr    