
    gi,                     N    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	dS )	    )ListOptionalSequencecast   )BaseProviderTlac                   >   e Zd ZdZdZdZ	 	 ddee         deee                  de	e         fdZ
	 	 	 	 ddedee	e                  d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dS )%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part_of_speechext_word_listreturnc                     ||}n2|r)|| j         vrt          | d          | j         |         }n| j        }t          |          S )a$  Get list of words.

        ``ext_word_list`` is a parameter that allows the user to provide a list
        of words to be used instead of the built-in word list. If ``ext_word_list``
        is provided, then the value of ``part_of_speech`` is ignored.

        ``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.

        :sample: part_of_speech="abc", ext_word_list=['abc', 'def', 'ghi', 'jkl']
        :sample: part_of_speech="abc"
        :sample: ext_word_list=['abc', 'def', 'ghi', 'jkl']

        .. 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.
        Nz' is not recognized as a part of speech.)parts_of_speech
ValueError	word_listlistselfr   r   r   s       v/var/www/development/aibuddy-work/election-extract/venv/lib/python3.11/site-packages/faker/providers/lorem/__init__.pyget_words_listzProvider.get_words_list   s`    6 $%II 	'T%999 N![![![\\\ 0@		II       Fnbuniquec                    |                      ||          }|r7t          t          t                   |                     ||                    }|S t          t          t                   |                     ||                    }|S )a  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 ``word_list`` is not provided, the method will use a default value of None,
        which will result in the method calling the ``get_words_list`` method to get the
        word list. If ``word_list`` is provided, the method will use the provided 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.

        :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
        )r   r   )length)r   r   r   strrandom_samplerandom_choices)r   r   r   r   r   r   unique_samplessampless           r   wordszProvider.wordsA   s}    8 ''~Ub'cc	 	"!$s)T-?-?	RT-?-U-UVVN!!tCy$"5"5i"5"K"KLLr   c                 f    |                      ||          }|                     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   s       r   wordzProvider.worde   s2     ''FF	zz!Y''**r      Tnb_wordsvariable_nb_wordsc                 6   |dk    rdS |r|                      |d          }|                     |          }t          |                     ||                    }|d                                         |d<   | 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   r   )randomize_nb_elementsr   r   r%   titleword_connectorjoinsentence_punctuation)r   r*   r+   r   r   r%   s         r   sentencezProvider.sentencer   s    & q==2 	C11(1BBH''m'DD	TZZ89ZEEFF8>>##a"''..1JJJr   c                 @      fdt          d|          D             S )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']
        c                 <    g | ]}                                S r0   )r6   .0_r   r   s     r   
<listcomp>z&Provider.sentences.<locals>.<listcomp>   s'    QQQqM::QQQr   r   ranger   r   r   s   ` `r   	sentenceszProvider.sentences   s,     RQQQQE!RLLQQQQr   nb_sentencesvariable_nb_sentencesc                     |dk    rdS |r|                      |d          }| 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.   r0   )r1   r3   r4   rA   )r   rB   rC   r   paras        r   	paragraphzProvider.paragraph   sa    * 12  	K55l5JJL"''|S`(a(abbr   c                 @      fdt          d|          D             S )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']
        c                 <    g | ]}                                S r9   )rF   r:   s     r   r=   z'Provider.paragraphs.<locals>.<listcomp>   s'    RRR];;RRRr   r   r>   r@   s   ` `r   
paragraphszProvider.paragraphs   s,     SRRRRU1b\\RRRRr      max_nb_charsc                    g }|dk     rt          d          |dk     r|smd}||k     rO|r| j        nd|                     |          z   }|                    |           |t	          |          z  }||k     O|                                 |m|d         d                                         |d         dd         z   |d<   t	          |          dz
  }||xx         | j        z  cc<   n|d	k     rp|smd}||k     rO|r| j        nd|                     |          z   }|                    |           |t	          |          z  }||k     O|                                 |mnj|shd}||k     rJ|rd
nd| 	                    |          z   }|                    |           |t	          |          z  }||k     J|                                 |hd
                    |          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-   r0   r'   Nd   
)r   r3   r(   appendlenpopupperr5   r6   rF   r4   )	r   rK   r   textsizer(   
last_indexr6   rF   s	            r   rU   zProvider.text   sC    !UVVV"  \))37?D//R499[h9CiCiiDKK%%%CII%D \)) 


   1gaj&&((47122;6DGTQJ 99C  \))7; C 3 3t}}cp}GqGqqHKK)))CMM)D \)) 


     \)))-!52Vc9d9d dIKK	***C	NN*D \)) 


   wwt}}r   nb_textsc                 D      fdt          d|          D             S )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']
        c                 <    g | ]}                               S  )rU   )r;   r<   r   rK   r   s     r   r=   z"Provider.texts.<locals>.<listcomp>  s'    SSS1		,66SSSr   r   r>   )r   rX   rK   r   s   ` ``r   textszProvider.texts  s2     TSSSSSa@R@RSSSSr   )NN)r   NNF)r)   TN)r   N)r   TN)rJ   N)r   rJ   N)__name__
__module____qualname____doc__r3   r5   r   r    r   r   r   intboolr%   r(   r6   rA   rF   rI   rU   r\   r[   r   r   r   r      s       	 	 N )-15% % %  .% 
c	% % % %R -1(," ""  S	*" !	"
 " 
c" " " "H+ +8C= +QYZ]Q^H_ +kn + + + + koK KK48KPXYabeYfPgK	K K K K>R RC RHXc]4K RW[\_W` R R R R sw <@X`aijmanXo	   >S SS SXhsm5L SX\]`Xa S S S S7 7 78HSM;R 7^a 7 7 7 7t dhT TT/2TIQRZ[^R_I`T	cT T T T T Tr   r   N)
typingr   r   r   r   r-   r   	localizeddefault_localer   r[   r   r   <module>rf      s    1 1 1 1 1 1 1 1 1 1 1 1      	 HT HT HT HT HT| HT HT HT HT HTr   