arjuna.engine.data.generator.text module¶
- class arjuna.engine.data.generator.text.Text¶
Bases:
object
- classmethod alphabet(*, locale='en', lower_case=False)¶
Generate a random integer.
- Keyword Arguments
locale – (Optional) Locale for data
lower_case – (inclusive) If true lower case alphabet is returned where applicable.
- Returns
A list of alphabet characters.
- classmethod answer(*, locale='en') str ¶
Generate a random answer.
- Keyword Arguments
locale – (Optional) Locale for data
- classmethod fixed_length_str(*, length) str ¶
Generate a fixed length string
- Keyword Arguments
length – Number of chracters in generated number.
- Returns
A generated fixed length string
Note
A number of minimum length 1 is always generated.
- classmethod level(*, locale='en') str ¶
Generate a random level for danger etc.
- Keyword Arguments
locale – (Optional) Locale for data
- classmethod quote(*, locale='en') str ¶
Generate a random quote.
- Keyword Arguments
locale – (Optional) Locale for data
- classmethod sentence(*, locale='en') str ¶
Generate a sentence
- Keyword Arguments
locale – (Optional) locale for generating sentence
- Returns
A generated sentence
- classmethod swear_word(*, locale='en') str ¶
Generate a random swear word.
- Keyword Arguments
locale – (Optional) Locale for data
- classmethod ustr(*, prefix: Optional[str] = None, maxlen: Optional[int] = None, minlen: Optional[int] = None, delim: str = '-', strict=False) str ¶
Generate a unique UUID string. If minlen/maxlen are specified in a manner that leads to uuid truncation, uniqueness is not enforced. Base string length is prefix length + delim length + 36 (length of uuid4) Different arguments tweak the length of generated string by appending uuid one or more times fully or partially.
- Keyword Arguments
prefix – (Optional) prefix to be added to the generated UUID string.
minlen – (Optional) Minimum length of the retuned string (inclusive of prefix + delim). Default is base string length.
maxlen – (Optional) Maximum length of the retuned string (inclusive of prefix + delim). Should be greater than minlen. Default is calculated as: * if minlen > half of base string length, then default maxlen is 2 * minlen * if minlen < half of base string length, then default maxlen is base string length
delim – (Optional) Delimiter between prefix and generated string. Default is “-”. Ignored if prefix is not specified.
strict – (Optional) If True uniqueness of string is enforced which means full generated uuid must be used atleast once. This means length of generated string must be >= base string length, else an exception is thrown.
- Returns
A string that is unique for current session.
- classmethod word(*, locale='en') str ¶
Generate a random word.
- Keyword Arguments
locale – (Optional) Locale for data
- classmethod words(*, locale='en', count=5)¶
Generate a random word.
- Keyword Arguments
locale – (Optional) Locale for data
count – Number of words. Default is 5.