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
Extensions to distutils to support building, installing, packaging 4Suite
Internationalization and localization support.
Utilites for working with Python PEP 302 import hooks.
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)
Overrides: __init__ from class FtException

Methods inherited from class Ft.FtException

Methods inherited from class Exception

__getitem__

Members

IDNA_UNSUPPORTED = 202
INVALID_BASE_URI = 100
INVALID_PUBLIC_ID_URN = 300
NON_FILE_URI = 120
OPAQUE_BASE_URI = 112
RELATIVE_BASE_URI = 111
RESOURCE_ERROR = 130
SCHEME_REQUIRED = 200
UNIX_REMOTE_HOST_FILE_URI = 121
UNSUPPORTED_PLATFORM = 1000
UNSUPPORTED_SCHEME = 201

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()