{ "info": { "author": "Dieter Maurer", "author_email": "dieter@handshake.de", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Software Development", "Topic :: Utilities" ], "description": "dm.sharedresource\n=================\n\nA shared resource is some resource identified by an id\nand used concurrently by several threads.\nTo make the concurrent use safe, calls to resource methods\nare synchronized.\n\nA resource is obtained by a call to `get_resource`.\nThe required resource is identified by an id (an arbitrary\nobject adequate as a dictionary key).\nIf a resouce of this id already exists, it is returned.\nOtherwise, one is created calling the creator and\nthe creator parameters provided to `get_resource`.\nThe returned value is a wrapper around the resource.\nThe wrapping ensures that calls to the resource's methods\nare synchronized.\n\n>>> from dm.sharedresource import get_resource\n>>> r = get_resource(1, dict) # a new resource is created with the `dict` creator\n>>> r is get_resource(1, dict)\nTrue\n\nThe resource behaves quite like the created object. However,\ncalls to its methods are synchronized (i.e. thread safe).\nHowever, special methods (those the names of which start and and in\n`__`) may not be found (Python 2.4 introduced that some methods\nmust be defined at class creation time and are not longer looked\nup in the instance). As a special case, `__getitem__`, `__setitem__`,\n`__delitem__`, `__len__`, `__nonzero__` are explicitely delegated.\n\n\n>>> r[1] = 1\n>>> r[1]\n1\n\nParameters and keyword parameters for the creator can be provided\nas arguments to `get_resource`.\n\n>>> r = get_resource('with args', dict, {1:1}, a='a', b='b')\n>>> sorted(r.items())\n[(1, 1), ('a', 'a'), ('b', 'b')]\n\nNow look that normal classes work as creators, too.\n\n>>> class Resource:\n... def __init__(self, v): self.v = v\n... def f(self): return self.v\n...\n>>> r = get_resource('class', Resource, 1)\n>>> r.f()\n1", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://www.dieter.handshake.de/pyprojects/Zope", "keywords": "sharedresource", "license": "BSD (see \"dm/sharedresource/LICENSE.txt\", for details)", "maintainer": null, "maintainer_email": null, "name": "dm.sharedresource", "package_url": "https://pypi.org/project/dm.sharedresource/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/dm.sharedresource/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://www.dieter.handshake.de/pyprojects/Zope" }, "release_url": "https://pypi.org/project/dm.sharedresource/1.0/", "requires_dist": null, "requires_python": null, "summary": "Resources which can safely be used by concurrent threads", "version": "1.0" }, "last_serial": 791256, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "85eeef8f11ea4dcd18db67724ba64e34", "sha256": "6f633bae45da29e40d02a27adc69d4f174d33493b5d2733bf2f9a26d9720b123" }, "downloads": -1, "filename": "dm.sharedresource-1.0.tar.gz", "has_sig": false, "md5_digest": "85eeef8f11ea4dcd18db67724ba64e34", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4118, "upload_time": "2008-05-28T20:40:25", "url": "https://files.pythonhosted.org/packages/0a/bc/63a78fb806663815c384dc4a447c37bc69ed2f9d311c62e0a2986007a40c/dm.sharedresource-1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "85eeef8f11ea4dcd18db67724ba64e34", "sha256": "6f633bae45da29e40d02a27adc69d4f174d33493b5d2733bf2f9a26d9720b123" }, "downloads": -1, "filename": "dm.sharedresource-1.0.tar.gz", "has_sig": false, "md5_digest": "85eeef8f11ea4dcd18db67724ba64e34", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4118, "upload_time": "2008-05-28T20:40:25", "url": "https://files.pythonhosted.org/packages/0a/bc/63a78fb806663815c384dc4a447c37bc69ed2f9d311c62e0a2986007a40c/dm.sharedresource-1.0.tar.gz" } ] }