Metadata-Version: 1.2
Name: pyraii
Version: 1.0.1
Summary: Declerative resource management library for python
Home-page: https://github.com/sasha-tkachev/pyraii
Author: Alexander Tkachev
Author-email: sasha64sasha@gmail.com
License: MIT license
Description: ======
        PyRAII
        ======
        
        .. image:: https://img.shields.io/travis/sasha-tkachev/pyraii.svg
                :target: https://travis-ci.org/sasha-tkachev/pyraii
        .. image:: https://codecov.io/gh/sasha-tkachev/pyraii/branch/master/graph/badge.svg
                :target: https://codecov.io/gh/sasha-tkachev/pyraii
        
        Declerative resource management library for python
        
        
        Examples
        --------
        
        
        Closing Resources only on exception::
        
        
            from pyraii.context import closing_on_exception
        
            def wait_for_authenticated_client_connection():
                my_socket = wait_for_client_connection(*args)
                with closing_on_exception(my_socket):
                    username = authenticate_connection(my_socket)
                    return my_socket, username
        
        
        Nothrow closing::
        
        
            from pyraii.context import closing_nothrow
        
            # If the file fails to close no exception will be thrown
            with closing_nothrow(my_file):
                my_file.write(data)
        
        Resource owning classes::
        
        
            from pyraii.resource_owner import ResourceOwner
        
            class Server(ResourceOwner):
                def __init__():
                    self.socket_a = get_socket()
                    self.socket_b = get_other_socket()
                    self._log_file = open_log_file()
                    self._data = "asdasd"
            my_server = Server()
            my_server.close() # will close all sockets and files which are members of the server
        
        
        This package was created with Cookiecutter_ and the `audreyr/cookiecutter-pypackage`_ project template.
        
        
        * Free software: MIT license
        
        .. _Cookiecutter: https://github.com/audreyr/cookiecutter
        .. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage
        
        
        =======
        History
        =======
        
        1.0.0 (2019-10-18)
        ------------------
        
        * First release on PyPI.
        
        1.0.1 (2019-10-18)
        -------------------
        * Add coverage
        * Fix documentation
        
Keywords: pyraii
Platform: UNKNOWN
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*
