text_formatter.check
- Check the text types, to see if they can be used on other text_formatter
functions¶
Source code: text_formatter/check.py
This module has functions to test strings and other text types, to see if they can be easily used by
other text_formatter
submodules.
- text_formatter.check.checkString(s, strict=False)¶
- Parameters
s – String passed to be tested.
strict – If True, use a stricter algorithm for checking.
- Returns
Nothing.
- Return type
None
- Raises
text_formatter.exceptions.InvalidString – if the string does not satisfies the expected.
Checks if a string can be used by
text_formatter
. In general, it checks if no region-specific characters are used. Ifstrict
is True, this function will only accept letters and digits (not symbols!).In most of the cases, this function is being used by internal
text_formatter
functions.
- text_formatter.check.strict_allowed_chars¶
- Type
str
- Value
"ABCDEFGHIJKLMNOPKRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890 "
The string used by
checkString()
when the argstrict
is True. Basically, it is the result ofstring.ascii_letters + string.string_digits + " "
.
- text_formatter.check.allowed_string_chars¶
- Type
str
- Value
"ABCDEFGHIJKLMNOPKRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890-$#%/()=!'<>.:,;[]{}*+?¿¡\" "
A more-inclusive string, the default for
checkString
. It includes all aroundstrict_allowed_chars
, and also includes symbols, quotes, etc.