Part of twisted.python View Source
|Class||InsensitiveDict||Dictionary, that has case-insensitive keys.|
|Class||OrderedDict||A UserDict that preserves insert order whenever possible.|
|Function||uniquify||Make the elements of a list unique by inserting them into a dictionary. This must not change the order of the input lst.|
|Function||padTo||Pads a sequence out to n elements,|
|Function||sibpath||Return the path to a sibling of a file in the filesystem.|
|Function||getPassword||Obtain a password by prompting or from stdin.|
|Function||makeStatBar||Creates a function that will return a string representing a progress bar.|
|Function||spewer||A trace function for sys.settrace that prints every function or method call.|
|Function||searchupwards||Walk upwards from start, looking for a directory containing all files and directories given as arguments:: >>> searchupwards('.', ['foo.txt'], ['bar', 'bam'])|
|Class||LineLog||A limited-size line-based log, useful for logging line-based protocols such as SMTP.|
|Function||raises||Determine whether the given call raises the given exception.|
|Class||IntervalDifferential||Given a list of intervals, generate the amount of time to sleep between "instants".|
|Class||FancyStrMixin||Mixin providing a flexible implementation of
|Class||FancyEqMixin||Mixin that implements
|Function||initgroups 0||Do nothing.|
|Function||initgroups||Initializes the group access list.|
|Function||switchUID||Attempts to switch the uid/euid and gid/egid for the current process.|
|Class||SubclassableCStringIO||A wrapper around cStringIO to allow for subclassing.|
|Function||setIDFunction||Change the function used by
|Function||unsignedID||Return the id of an object as an unsigned number so that its hex representation makes sense.|
|Function||nameToLabel||Convert a string like a variable name into a slightly more human-friendly string with spaces and capitalized letters.|
|Function||uidFromString||Convert a user identifier, as a string, into an integer UID.|
|Function||gidFromString||Convert a group identifier, as a string, into an integer GID.|
|Function||runAsEffectiveUser||Run the given function wrapped with seteuid/setegid calls.|
|Function||_getpass||Helper to turn IOErrors into KeyboardInterrupts.|
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.
This is useful in conjunction with the special
attribute that Python provides for modules, so modules can load associated
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.
forceTTY is true, attempt to open a tty and prompt for the
password using it. Raise a RuntimeError if this is not possible.
>> searchupwards('.', ['foo.txt'], ['bar', 'bam'])
If not found, return None
Underlying platform support require to manipulate groups is missing.
If the C extension is present, we're calling it, which in turn calls initgroups(3).
If not, this is done by reading the group database /etc/group and using
all groups of which
uid is a member. The additional group
primaryGid is also added to the list.
If the given user is a member of more than
arbitrary groups will be silently discarded to bring the number below that
|Parameters||uid||The UID for which to look up group information. (type: |
|primaryGid||If provided, an additional GID to include when setting the groups. (type: |
|Parameters||uid||the UID (or EUID) to switch the current process to. This parameter will be
ignored if the value is |
|gid||the GID (or EGID) to switch the current process to. This parameter will be
ignored if the value is |
|euid||if True, set only effective user-id rather than real user-id. (This option
has no effect unless the process is running as root, in which case it means
not to shed all privileges, retaining the option to regain privileges in
cases such as spawning processes. Use with caution.) (type: |
fwith the given arguments, handling
|Parameters||f||A function to call.|
|*a||Positional arguments to pass to |
|**kw||Keyword arguments to pass to |
This is mostly necessary in Python 2.4 which implements
to sometimes return a negative value. Python 2.3 shares this behavior, but
also implements hex and the %x format specifier to represent negative
values as though they were positive ones, obscuring the behavior of
Python 2.5's implementation of
always returns positive values.
g's name and docstring with values from
g's instance dictionary with
To use this function safely you must use the return value. In Python
will create a new function. In later versions of Python,
will be mutated and returned.
|Returns||A function that has |
|Parameters||mname||The name to convert to a label. This must be a string which could be used
as a Python identifier. Strings which do not take this form will result in
unpredictable behavior. (type: |
|Returns|| (type: |
|Parameters||uid||A string giving the base-ten representation of a UID or the name of a user
which can be converted to a UID via |
|Returns||The integer UID corresponding to the given string. (type: |
|Raises||ValueError||If the user name is supplied and |
|Parameters||uid||A string giving the base-ten representation of a GID or the name of a group
which can be converted to a GID via |
|Returns||The integer GID corresponding to the given string. (type: |
|Raises||ValueError||If the group name is supplied and |
This will try to minimize the number of seteuid/setegid calls, comparing current and wanted permissions
|Parameters||euid||effective UID used to call the function. (type: |
|function||the function run with the specific permission. (type: any callable)|
|*args||arguments passed to |
|**kwargs||keyword arguments passed to |
f(*args, **kwargs), but with some warnings suppressed.
|Parameters||suppressedWarnings||A list of arguments to pass to filterwarnings. Must be a sequence of 2-tuples (args, kwargs).|
|args||Arguments for |
|kwargs||Keyword arguments for |
|Returns||The result of |