Go to the latest version of this document.
search in docstrings

Search bar offers the following options:

- Term presence. The below example searches for documents that must contain “foo”, might contain “bar” and must not contain “baz”: `+foo bar -baz`
- Wildcards. The below example searches for documents with words beginning with “foo”: `foo*`
- Search in specific fields. The following search matches all objects in "twisted.mail" that matches “search”: `+qname:twisted.mail.* +search`

  Possible fields: 'name', 'qname' (fully qualified name), 'docstring', and 'kind'. Last two fields are only applicable if "search in docstrings" is enabled.

- Fuzzy matches. The following search matches all documents that have a word within 1 edit distance of “foo”: `foo~1`

Results provided by Lunr.js

# ``twisted`.`python`.`text``

module documentation
(source)

Miscellany of text-munging functions.

Function | `endsInNewline` | Returns `True` if this string ends in a newline.
Function | `greedyWrap` | Given a string and a column width, return a list of lines.
Function | `isMultiline` | Returns `True` if this string has a newline in it.
Function | `removeLeadingBlanks` | Undocumented
Function | `removeLeadingTrailingBlanks` | Undocumented
Function | `splitQuoted` | Like a string split, but don't break substrings inside quotes.
Function | `strFile` | Find whether string `p` occurs in a read()able object `f`.
Function | `stringyString` | Expansive string formatting for sequence types.

def endsInNewline(s): (source)

Returns `True` if this string ends in a newline.

def greedyWrap(inString, width=80): (source)

Given a string and a column width, return a list of lines.

Caveat: I'm use a stupid greedy word-wrapping algorythm. I won't put two spaces at the end of a sentence. I don't do full justification. And no, I've never even *heard* of hypenation.

def isMultiline(s): (source)

Returns `True` if this string has a newline in it.

def removeLeadingBlanks(lines): (source)

Undocumented

def removeLeadingTrailingBlanks(s): (source)

Undocumented

def splitQuoted(s): (source)

Like a string split, but don't break substrings inside quotes.

    >>> splitQuoted('the "hairy monkey" likes pie')
    ['the', 'hairy monkey', 'likes', 'pie']

Another one of those "someone must have a better solution for this" things. This implementation is a VERY DUMB hack done too quickly.

def strFile(p, f, caseSensitive=True): (source)

Find whether string `p` occurs in a read()able object `f`.

Returns
`bool` | Undocumented

def stringyString(object, indentation=''): (source)

Expansive string formatting for sequence types.

`list.__str__` and `dict.__str__` use `repr()` to display their elements. This function also turns these sequence types into strings, but uses `str()` on their elements instead.

Sequence elements are also displayed on separate lines, and nested sequences have nested indentation.