twisted.python.util

Package twisted :: Package python :: Module util |
[frames | no frames]

## Module twisted.python.util

Classes
`_IntervalDifferentialIterator` |
`FancyEqMixin` |
`FancyStrMixin` | Set showAttributes to a sequence of strings naming attributes, OR sequences of (attributeName, displayName, formatCharacter)
`InsensitiveDict` | Dictionary, that has case-insensitive keys.
`IntervalDifferential` | Given a list of intervals, generate the amount of time to sleep between "instants".
`LineLog` | A limited-size line-based log, useful for logging line-based protocols such as SMTP.
`OrderedDict` | A UserDict that preserves insert order whenever possible.

Function Summary
| ``_getpass`(prompt)` Helper to turn IOErrors into KeyboardInterrupts
| `addPluginDir()`
| `dict(*a, **k)`
| `dsu(list, key)`
| ``getPassword`(prompt, confirm, forceTTY)` Obtain a password by prompting or from stdin.
| `getPluginDirs()`
| `initgroups(uid, primaryGid)`
| ``keyed_md5`(secret, challenge)` Create the keyed MD5 string for the given secret and challenge.
| ``makeStatBar`(width, maxPosition, doneChar, undoneChar, currentChar)` Creates a function that will return a string representing a progress bar.
| ``padTo`(n, seq, default)` Pads a sequence out to n elements,
| `println(*a)`
| ``raises`(exception, f, *args, **kwargs)` Determine whether the given call raises the given exception
| ``searchupwards`(start, files, dirs)` Walk upwards from start, looking for a directory containing all files and directories given as arguments:
| ``sibpath`(path, sibling)` Return the path to a sibling of a file in the filesystem.
| ``spewer`(frame, s, ignored)` A trace function for sys.settrace that prints every function or method call.
| `str_xor(s, b)`
| `switchUID(uid, gid, euid)`
| ``uniquify`(lst)` Make the elements of a list unique by inserting them into a dictionary.

Variable Summary
`str` | `__version__` = `'1.51'`

Function Details

### _getpass(prompt) Helper to turn IOErrors into KeyboardInterrupts

### getPassword(prompt='Password: ', confirm=0, forceTTY=0) Obtain a password by prompting or from stdin. If stdin is a terminal, prompt for a new password, and confirm (if `confirm` is true) by asking again to make sure the user typed the same thing, as keystrokes will not be echoed. If stdin is not a terminal, and `forceTTY` is not true, read in a line and use it as the password, less the trailing newline, if any. If `forceTTY` is true, attempt to open a tty and prompt for the password using it. Raise a RuntimeException if this is not possible. Returns: `str`

### keyed_md5(secret, challenge) Create the keyed MD5 string for the given secret and challenge.

### makeStatBar(width, maxPosition, doneChar='=', undoneChar='-', currentChar='>') Creates a function that will return a string representing a progress bar.

### padTo(n, seq, default=None) Pads a sequence out to n elements, filling in with a default value if it is not long enough. If the input sequence is longer than n, raises ValueError. Details, details: This returns a new list; it does not extend the original sequence. The new list contains the values of the original sequence, not copies.

### raises(exception, f, *args, **kwargs) Determine whether the given call raises the given exception

### searchupwards(start, files=[], dirs=[]) Walk upwards from start, looking for a directory containing all files and directories given as arguments:
    >> searchupwards('.', ['foo.txt'], ['bar', 'bam'])
If not found, return None

### sibpath(path, sibling) Return the path to a sibling of a file in the filesystem. This is useful in conjunction with the special __file__ attribute that Python provides for modules, so modules can load associated resource files.

### spewer(frame, s, ignored) A trace function for sys.settrace that prints every function or method call.

### uniquify(lst) Make the elements of a list unique by inserting them into a dictionary. This must not change the order of the input lst.

Variable Details

    ### __version__ Type: `str` Value:
        '1.51'

Generated by Epydoc 2.0 on Sat May 15 20:07:53 2004 | http://epydoc.sf.net