{
"info": {
"author": "Daniel Mueller",
"author_email": "deso@posteo.net",
"bugtrack_url": null,
"classifiers": [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Topic :: Software Development :: Libraries :: Python Modules"
],
"description": "cleanup\n=======\n\nThe **cleanup** module provides primitives aiding in releasing of no\nlonger used resources in an exception-safe manner. In particular, it\ndefines ``defer``, a function that, when used as a context manager, acts\nas an object for registering cleanup functions for acquired resources.\nAn example:\n\n.. code:: python\n\n client = Client()\n with defer() as d:\n obj = Object()\n d.defer(obj.destroy)\n obj.register(client)\n d.defer(obj.unregister, client)\n # Alternative syntax:\n # d.defer(lambda: obj.unregister(client))\n raise Exception()\n\nHere, the ``defer`` creates a context object ``d`` that is guaranteed to\nbe released during block exit (even in the face of exceptions). It is\nused to \"defer\" an invocation of ``obj.destroy`` just after the object\ngot created. This way, the object is guaranteed to be destroyed\nproperly. Furthermore, the object is registered with a client. This\nregistration should be undone before the object vanishes and so another\n\"defer\" operation is used to register the ``unregister`` invocation.\nThis example also illustrates another important fact: execution of the\nvarious cleanup routines happens in reverse order of their registration.\nThis property is important in most scenarios where resources of interest\nhave dependencies.\n\nSometimes cleanup is only necessary in case an error occurs. That is, if\nall operations (resource acquisitions etc.) succeed, we do not want to\nroll back and undo a part of them. To that end, a defer context can be\n\"released\" in which case no cleanup happens after block exit. Revisiting\nthe example above:\n\n.. code:: python\n\n client = Client()\n with defer() as d:\n obj = Object()\n d.defer(obj.destroy)\n obj.register(client)\n d.defer(lambda: obj.unregister(client))\n\n # Do some action that potentially raises an error.\n\n # If we got here we want to keep the object created and registered\n # with the client.\n d.release()\n\nThis mechanism not only works on the level of a context but also for\nindividually deferred functions:\n\n.. code:: python\n\n client = Client()\n with defer() as d:\n obj = Object()\n f = d.defer(obj.destroy)\n\n # Do some action that potentially raises an error.\n\n f.release()\n\nInstallation\n------------\n\nThe **cleanup** package does not have any external dependencies. In\norder to use it it only needs to be made known to Python, e.g., by\nadding the path to the ``src/`` directory to the ``PYTHONPATH``\nenvironment variable.\n\nIf you are using `Gentoo Linux `__, there is an\n`ebuild `__ available that\ncan be used directly.\n\nSupport\n-------\n\nThe module is tested with Python 3. There is no work going on to ensure\ncompatibility with Python 2.",
"description_content_type": null,
"docs_url": null,
"download_url": "UNKNOWN",
"downloads": {
"last_day": -1,
"last_month": -1,
"last_week": -1
},
"home_page": "https://github.com/d-e-s-o/cleanup",
"keywords": "cleanup defer development",
"license": "GPLv3",
"maintainer": null,
"maintainer_email": null,
"name": "cleanupd",
"package_url": "https://pypi.org/project/cleanupd/",
"platform": "UNKNOWN",
"project_url": "https://pypi.org/project/cleanupd/",
"project_urls": {
"Download": "UNKNOWN",
"Homepage": "https://github.com/d-e-s-o/cleanup"
},
"release_url": "https://pypi.org/project/cleanupd/0.9.0.2/",
"requires_dist": null,
"requires_python": null,
"summary": "A package providing additional object cleanup functionality.",
"version": "0.9.0.2"
},
"last_serial": 2591310,
"releases": {
"0.9": [
{
"comment_text": "",
"digests": {
"md5": "1c4772749d921e5231c7045f273184b9",
"sha256": "87691620a348169e6a6feeb117bc6802cf67ceb092156bed6befd1295da17adb"
},
"downloads": -1,
"filename": "cleanupd-0.9.tar.gz",
"has_sig": true,
"md5_digest": "1c4772749d921e5231c7045f273184b9",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 19187,
"upload_time": "2017-01-21T20:55:26",
"url": "https://files.pythonhosted.org/packages/f3/06/6c4dcc883c325fc6f2e68c5a413598ac671b39c500c333938a88820abc03/cleanupd-0.9.tar.gz"
}
],
"0.9.0.1": [
{
"comment_text": "",
"digests": {
"md5": "f958113b8a735e11e577ad0e627428eb",
"sha256": "78e1fcb96a9eb1179c4304d6393da5c1b928bf32012c842c37b1967923a9e93f"
},
"downloads": -1,
"filename": "cleanupd-0.9.0.1.tar.gz",
"has_sig": true,
"md5_digest": "f958113b8a735e11e577ad0e627428eb",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 19178,
"upload_time": "2017-01-21T21:02:43",
"url": "https://files.pythonhosted.org/packages/45/7c/b339e14b7565179d8cfd5786b4cd394da0ff52691ba8beb5a1e9731d2359/cleanupd-0.9.0.1.tar.gz"
}
],
"0.9.0.2": [
{
"comment_text": "",
"digests": {
"md5": "0f0bcf463d64f463aec848f90a80f059",
"sha256": "313126aa3976a8d6101289f212bd733b67b4acd3913ddd5b02288de378ee3b90"
},
"downloads": -1,
"filename": "cleanupd-0.9.0.2.tar.gz",
"has_sig": true,
"md5_digest": "0f0bcf463d64f463aec848f90a80f059",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 19507,
"upload_time": "2017-01-22T19:20:19",
"url": "https://files.pythonhosted.org/packages/2f/eb/74b715fffad5c3acf972afe2167b4e291772e713660a938ed182a251647b/cleanupd-0.9.0.2.tar.gz"
}
]
},
"urls": [
{
"comment_text": "",
"digests": {
"md5": "0f0bcf463d64f463aec848f90a80f059",
"sha256": "313126aa3976a8d6101289f212bd733b67b4acd3913ddd5b02288de378ee3b90"
},
"downloads": -1,
"filename": "cleanupd-0.9.0.2.tar.gz",
"has_sig": true,
"md5_digest": "0f0bcf463d64f463aec848f90a80f059",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 19507,
"upload_time": "2017-01-22T19:20:19",
"url": "https://files.pythonhosted.org/packages/2f/eb/74b715fffad5c3acf972afe2167b4e291772e713660a938ed182a251647b/cleanupd-0.9.0.2.tar.gz"
}
]
}