Metadata-Version: 1.1
Name: hungry
Version: 0.0.3
Summary: Easily eats exceptions using decorators
Home-page: https://github.com/denizdogan/hungry
Author: Deniz Dogan
Author-email: deniz@dogan.se
License: MIT
Description: hungry
        ======
        
        .. image:: https://travis-ci.org/denizdogan/hungry.svg?branch=master
            :target: https://travis-ci.org/denizdogan/hungry
        
        Python library for easily “eating” exceptions in functions. Eating can mean
        either returning a default value or calling another function.
        
        Introduction
        ------------
        
        This library is basically just a function, namely ``hungry.eat``. Initially, I
        wrote it for a document parser in which there was a lot of exception handling
        logic for stuff I didn’t really care particularly much about.
        
        Example usage
        -------------
        
        Eat all errors and return `None` if one was raised:
        
        .. code-block:: python
        
            @hungry.eat()
            def foo():
                ...
        
        Eat ``ValueError`` exceptions and return 0 if it was raised:
        
        .. code-block:: python
        
            @hungry.eat(ValueError, error_value=0)
            def foo():
                ...
        
        Eat ``IndexError`` and ``ValueError`` and fall back to function
        ``get_first_element`` if one of them is raised:
        
        .. code-block:: python
        
            @hungry.eat(IndexError, ValueError, error_handler=bar)
            def foo():
                ...
        
        In the example above, ``bar`` will be passed the exception as the first
        argument, followed by all the other arguments and keyword arguments in the
        decorated function. This means that ``bar`` would have e.g. the following
        signature:
        
        .. code-block:: python
        
            def bar(ex, *args, **kwargs):
                ...
        
        TODO
        ----
        
        Complete the test suite.
        
Platform: any
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 2.7
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Operating System :: OS Independent
