Undocumented
Function | slugify |
No summary |
Variable | format_lazy |
Undocumented |
Variable | re_camel_case |
Undocumented |
Variable | re_chars |
Undocumented |
Variable | re_newlines |
Undocumented |
Variable | re_tag |
Undocumented |
Variable | re_words |
Undocumented |
Variable | smart_split_re |
Undocumented |
Class | StreamingBuffer |
Undocumented |
Class | Truncator |
An object used to truncate text, either by characters or words. |
Function | _format_lazy |
Apply str.format() on 'format_string' where format_string, args, and/or kwargs might be lazy. |
Function | _replace_entity |
Undocumented |
Function | camel_case_to_spaces |
Split CamelCase and convert to lowercase. Strip surrounding whitespace. |
Function | capfirst |
Capitalize the first letter of a string. |
Function | compress_sequence |
Undocumented |
Function | compress_string |
Undocumented |
Function | get_text_list |
No summary |
Function | get_valid_filename |
No summary |
Function | normalize_newlines |
Normalize CRLF and CR newlines to just LF. |
Function | phone2numeric |
Convert a phone number with letters into its numeric equivalent. |
Function | smart_split |
No summary |
Function | unescape_string_literal |
Convert quoted string literals to unquoted strings with escaped quotes and backslashes unquoted: |
Function | wrap |
A word-wrap function that preserves existing line breaks. Expects that existing line breaks are posix newlines. |
Variable | _entity_re |
Undocumented |
>>> get_text_list(['a', 'b', 'c', 'd']) 'a, b, c or d' >>> get_text_list(['a', 'b', 'c'], 'and') 'a, b and c' >>> get_text_list(['a', 'b'], 'and') 'a and b' >>> get_text_list(['a']) 'a' >>> get_text_list([]) ''
Generator that splits a string by spaces, leaving quoted phrases together. Supports both single and double quotes, and supports escaping quotes with backslashes. In the output, strings will keep their initial and trailing quote marks and escaped quotes will remain escaped (the results can then be further processed with unescape_string_literal()).
>>> list(smart_split(r'This is "a person\'s" test.')) ['This', 'is', '"a person\\\'s"', 'test.'] >>> list(smart_split(r"Another 'person\'s' test.")) ['Another', "'person\\'s'", 'test.'] >>> list(smart_split(r'A "\"funky\" style" test.')) ['A', '"\\"funky\\" style"', 'test.']
Convert quoted string literals to unquoted strings with escaped quotes and backslashes unquoted:
>>> unescape_string_literal('"abc"') 'abc' >>> unescape_string_literal("'abc'") 'abc' >>> unescape_string_literal('"a \"bc\""') 'a "bc"' >>> unescape_string_literal("'\'ab\' c'") "'ab' c"