Works just like @property for classes, except deleters don't work (and are
perhaps impossible).
Inspired by https://stackoverflow.com/a/39542816/43839
## Example
import clsprop
class Full:
_name = 'fool'
@clsprop
def name(cls):
return cls._name
@name.setter
def name(cls, name):
cls._name = name
# Unfortunately, the deleter never gets called
@name.deleter
def name(cls, name):
raise ValueError('Cannot delete name')
assert Full.name == 'fool'
Full.name = 'foll'
assert Full.name == 'foll'
del Full.name # oh, well
### [API Documentation](https://rec.github.io/clsprop#clsprop--api-documentation)
Raw data
{
"_id": null,
"home_page": "https://github.com/rec/clsprop",
"name": "clsprop",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "",
"keywords": "",
"author": "Tom Ritchford",
"author_email": "tom@swirly.com",
"download_url": "https://files.pythonhosted.org/packages/89/c2/fc7141e7c9892eef7d1676bda2822b2bc33c54177058d6620a2aa99bd731/clsprop-1.3.1.tar.gz",
"platform": null,
"description": "Works just like @property for classes, except deleters don't work (and are\nperhaps impossible).\n\nInspired by https://stackoverflow.com/a/39542816/43839\n\n## Example\n\n import clsprop\n\n class Full:\n _name = 'fool'\n\n @clsprop\n def name(cls):\n return cls._name\n\n @name.setter\n def name(cls, name):\n cls._name = name\n\n # Unfortunately, the deleter never gets called\n @name.deleter\n def name(cls, name):\n raise ValueError('Cannot delete name')\n\n assert Full.name == 'fool'\n\n Full.name = 'foll'\n assert Full.name == 'foll'\n\n del Full.name # oh, well\n\n\n### [API Documentation](https://rec.github.io/clsprop#clsprop--api-documentation)\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "\ud83c\udfeb Just like @property but for classes \ud83c\udfeb",
"version": "1.3.1",
"project_urls": {
"Documentation": "https://rec.github.io/clsprop",
"Homepage": "https://github.com/rec/clsprop",
"Repository": "https://github.com/rec/clsprop"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "22472d0774bc3a28706807f8e40183cdc2683ebd199e022c09d7a67f10cd74a4",
"md5": "2ea5f05053f031e7a0a6583eacfdb151",
"sha256": "627599a07867c2476f141c1494653ae26dd58e15e6374df76542cdd25e1d5870"
},
"downloads": -1,
"filename": "clsprop-1.3.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "2ea5f05053f031e7a0a6583eacfdb151",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 2206,
"upload_time": "2024-01-25T10:42:10",
"upload_time_iso_8601": "2024-01-25T10:42:10.012262Z",
"url": "https://files.pythonhosted.org/packages/22/47/2d0774bc3a28706807f8e40183cdc2683ebd199e022c09d7a67f10cd74a4/clsprop-1.3.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "89c2fc7141e7c9892eef7d1676bda2822b2bc33c54177058d6620a2aa99bd731",
"md5": "7d1574f4fc001d4d40ce746446faf1f7",
"sha256": "490936e71a7f11c3a201f4195cf420560d2f03c855af90dffae5370c88f272f8"
},
"downloads": -1,
"filename": "clsprop-1.3.1.tar.gz",
"has_sig": false,
"md5_digest": "7d1574f4fc001d4d40ce746446faf1f7",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 1595,
"upload_time": "2024-01-25T10:42:11",
"upload_time_iso_8601": "2024-01-25T10:42:11.882741Z",
"url": "https://files.pythonhosted.org/packages/89/c2/fc7141e7c9892eef7d1676bda2822b2bc33c54177058d6620a2aa99bd731/clsprop-1.3.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-01-25 10:42:11",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "rec",
"github_project": "clsprop",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "clsprop"
}