4Suite API Documentation

Module Ft.Lib

Module providing common utilities for many 4Suite components, as well as for general use.

Copyright 2005 Fourthought, Inc. (USA).
Detailed license and copyright information: http://4suite.org/COPYRIGHT
Project home, documentation, distributions: http://4suite.org/
Classes:
Functions:

Modules

Things to set up before importing other Ft.Lib.CommandLine modules
Utilities for database connections
Extensions to distutils to support building, installing, packaging 4Suite
Classes and functions related to IRI processing
Messages for Ft.Lib
Pretty-printing of objects
Progress indicator
Thread-safe random number generation
Tools to manage the many different flavors of regex
Specialized and useful URI resolvers
Operations on ordered sets
Provides some of the information from the terminfo database.
Provides some of the information from the terminfo database.
Package for testing utilities
Date and time related functionality for use within 4Suite only.
Classes and functions related to URI validation and resolution
Functions for generating and comparing Universal Unique Identifiers (UUIDs), based on ideas from e2fsprogs.

Classes

class UriException(Ft.FtException)
Exceptions used by the Uri module, and possibly others.

Methods

__init__(self, errorCode, *args, **kwargs)

Methods inherited from class Ft.FtException

Methods inherited from class exceptions.Exception

__getitem__

Fields

Functions

CloseStream(stream, quiet=False)
Closes a stream, ignoring errors if quiet=True. If the stream is a terminal (e.g. sys.stdin, stdout, stderr), does not attempt to close the stream.

Closing terminal streams could interfere with subsequent read or
write attempts. For example, after calling sys.stdout.close(),
subsequent writes to stdout will not raise an exception, but may
also fail to actually write anything to stdout.

The stream argument can be any Python file-like object with a
close() method, such as a regular file object or an instance of
Ft.Xml.InputSource.InputSource (or subclass thereof).
Truncate(text, length)
Returns text truncated to length, with "..." appended if truncation was necessary.
Wrap(text, width)
A word-wrap function that preserves existing line breaks and most spaces in the text. Expects that existing line breaks are posix newlines (\n).

See also: Ft.Lib.CommandLine.CommandLineUtil.wrap_text()