exceptions.py :  » Database » PyTables » tables-2.1.2 » tables » Python Open Source

Home
Python Open Source
1.3.1.2 Python
2.Ajax
3.Aspect Oriented
4.Blog
5.Build
6.Business Application
7.Chart Report
8.Content Management Systems
9.Cryptographic
10.Database
11.Development
12.Editor
13.Email
14.ERP
15.Game 2D 3D
16.GIS
17.GUI
18.IDE
19.Installer
20.IRC
21.Issue Tracker
22.Language Interface
23.Log
24.Math
25.Media Sound Audio
26.Mobile
27.Network
28.Parser
29.PDF
30.Project Management
31.RSS
32.Search
33.Security
34.Template Engines
35.Test
36.UML
37.USB Serial
38.Web Frameworks
39.Web Server
40.Web Services
41.Web Unit
42.Wiki
43.Windows
44.XML
Python Open Source » Database » PyTables 
PyTables » tables 2.1.2 » tables » exceptions.py
########################################################################
#
#       License: BSD
#       Created: December 17, 2004
#       Author:  Francesc Alted - faltet@pytables.com
#
#       $Id: exceptions.py 3937 2008-12-10 18:11:38Z faltet $
#
########################################################################

"""
Declare exceptions and warnings that are specific to PyTables.

Classes:

`HDF5ExtError`
    A low level HDF5 operation failed.
`ClosedNodeError`
    The operation can not be completed because the node is closed.
`ClosedFileError`
    The operation can not be completed because the hosting file is
    closed.
`FileModeError`
    The operation can not be carried out because the mode in which the
    hosting file is opened is not adequate.
`NodeError`
    Invalid hierarchy manipulation operation requested.
`NoSuchNodeError`
    An operation was requested on a node that does not exist.
`UndoRedoError`
    Problems with doing/redoing actions with Undo/Redo feature.
`UndoRedoWarning`
    Issued when an action not supporting undo/redo is run.
`NaturalNameWarning`
    Issued when a non-pythonic name is given for a node.
`PerformanceWarning`
    Warning for operations which may cause a performance drop.
`FlavorError`
    Unsupported or unavailable flavor or flavor conversion.
`FlavorWarning`
    Unsupported or unavailable flavor conversion.
`FiltersWarning`
    Unavailable filters.
`NoIndexingError`
    Indexing is not supported.
`NoIndexingWarning`
    Indexing is not supported.
`OldIndexWarning`
    Unsupported index format.
"""

__docformat__ = 'reStructuredText'
"""The format of documentation strings in this module."""

__version__ = '$Revision: 3937 $'
"""Repository version of this file."""



class HDF5ExtError(RuntimeError):
    """
    A low level HDF5 operation failed.

    This exception is raised by ``hdf5Extension`` (the low level
    PyTables component used for accessing HDF5 files).  It usually
    signals that something is not going well in the HDF5 library or even
    at the Input/Output level, and uses to be accompanied by an
    extensive HDF5 back trace on standard error.
    """
    pass



# The following exceptions are concretions of the ``ValueError`` exceptions
# raised by ``file`` objects on certain operations.

class ClosedNodeError(ValueError):
    """
    The operation can not be completed because the node is closed.

    For instance, listing the children of a closed group is not allowed.
    """
    pass


class ClosedFileError(ValueError):
    """
    The operation can not be completed because the hosting file is
    closed.

    For instance, getting an existing node from a closed file is not
    allowed.
    """
    pass


class FileModeError(ValueError):
    """
    The operation can not be carried out because the mode in which the
    hosting file is opened is not adequate.

    For instance, removing an existing leaf from a read-only file is not
    allowed.
    """
    pass



class NodeError(AttributeError, LookupError):
    """
    Invalid hierarchy manipulation operation requested.

    This exception is raised when the user requests an operation on the
    hierarchy which can not be run because of the current layout of the
    tree.  This includes accessing nonexistent nodes, moving or copying
    or creating over an existing node, non-recursively removing groups
    with children, and other similarly invalid operations.

    A node in a PyTables database cannot be simply overwritten by
    replacing it.  Instead, the old node must be removed explicitely
    before another one can take its place.  This is done to protect
    interactive users from inadvertedly deleting whole trees of data by
    a single erroneous command.
    """
    pass


class NoSuchNodeError(NodeError):
    """
    An operation was requested on a node that does not exist.

    This exception is raised when an operation gets a path name or a
    ``(where, name)`` pair leading to a nonexistent node.
    """
    pass



class UndoRedoError(Exception):
    """
    Problems with doing/redoing actions with Undo/Redo feature.

    This exception indicates a problem related to the Undo/Redo
    mechanism, such as trying to undo or redo actions with this
    mechanism disabled, or going to a nonexistent mark.
    """
    pass


class UndoRedoWarning(Warning):
    """
    Issued when an action not supporting Undo/Redo is run.

    This warning is only shown when the Undo/Redo mechanism is enabled.
    """
    pass



class NaturalNameWarning(Warning):
    """
    Issued when a non-pythonic name is given for a node.

    This is not an error and may even be very useful in certain
    contexts, but one should be aware that such nodes cannot be
    accessed using natural naming (instead, ``getattr()`` must be
    used explicitly).
    """
    pass


class PerformanceWarning(Warning):
    """
    Warning for operations which may cause a performance drop.

    This warning is issued when an operation is made on the database
    which may cause it to slow down on future operations (i.e. making
    the node tree grow too much).
    """
    pass



class FlavorError(ValueError):
    """
    Unsupported or unavailable flavor or flavor conversion.

    This exception is raised when an unsupported or unavailable flavor
    is given to a dataset, or when a conversion of data between two
    given flavors is not supported nor available.

    A supported flavor may be unavailable if the package which
    implements it is not installed locally, e.g. you may specify the
    ``numeric`` flavor, which is supported by PyTables, but if Numeric
    is not installed on your machine, you will get this error.
    """
    pass


class FlavorWarning(Warning):
    """
    Unsupported or unavailable flavor conversion.

    This warning is issued when a conversion of data between two given
    flavors is not supported nor available, and raising an error would
    render the data inaccessible (e.g. on a dataset of an unavailable
    flavor in a read-only file).

    See the `FlavorError` class for more information.
    """
    pass


class FiltersWarning(Warning):
    """
    Unavailable filters.

    This warning is issued when a valid filter is specified but it is
    not available in the system.  It may mean that an available default
    filter is to be used instead.
    """
    pass


_no_indexing_message = (
    "This version of PyTables does not support indexing. "
    "Please consider using the PyTables Pro edition "
    "(http://www.pytables.org/moin/PyTablesPro)." )

class NoIndexingError(NotImplementedError):
    """
    Indexing is not supported.

    This exception is raised when an indexing-related operation is
    requested under a version of PyTables which does not support
    indexing.  Please consider using the PyTables Pro edition
    (http://www.pytables.org/moin/PyTablesPro).
    """
    def __init__(self):
        NotImplementedError.__init__(self, _no_indexing_message)

class NoIndexingWarning(Warning):
    """
    Indexing is not supported.

    This warning is issued when opening an indexed table under a version
    of PyTables which does not support indexing.  Please consider using
    the PyTables Pro edition
    (http://www.pytables.org/moin/PyTablesPro).
    """
    def __init__(self, message):
        message = '%s. %s' % (message, _no_indexing_message)
        Warning.__init__(self, message)

class OldIndexWarning(Warning):
    """
    Unsupported index format.

    This warning is issued when an index in an unsupported format is
    found.  The index will be marked as invalid and will behave as if
    doesn't exist.
    """
    pass

class DataTypeWarning(Warning):
    """
    Unsupported data type.

    This warning is issued when an unsupported HDF5 data type is found
    (normally in a file created with other tool than PyTables).
    """
    pass



## Local Variables:
## mode: python
## py-indent-offset: 4
## tab-width: 4
## fill-column: 72
## End:
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.