metadeco


Namemetadeco JSON
Version 0.2.1 PyPI version JSON
download
home_page
SummaryMetadeco allows you to set metadata to decorated objects.
upload_time2023-03-24 10:26:18
maintainer
docs_urlNone
authorPredeactor
requires_python>=3.8,<4.0
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Metadeco

Metadata reflections for functions/methods. Inspired by NPM's [`reflect-metadata`](https://www.npmjs.com/package/reflect-metadata) package.

## How to use:

### To decorate a function:

```py
import metadeco

# Define a function with the "__has_print__" metadata set to "True"
# You can set anything has the value of the metadata.
@metadeco.metadata("__has_print__", True)
def my_function():
    print("Hello world!")

metadeco.has_metadata(my_function)
# We would get "True"

metadeco.get_metadata(my_function, "__has_print__")
# We obtain the value set by the function, in here, "True
metadeco.get_metadata(my_function, "__not_set__")
# "NoMetadataError" is raised here.

metadeco.delete_metadata(my_function, "__has_print__")
# Delete the metadata.
```

## To decorate a property:

```py
import metadeco


class MySettings:
    
    @metadeco.decorate("__output__", "Hey there!")
    def test():
        return "Hey there!"

# Getting the metadata of "test" property in object MySettings
metadeco.get_metadata(MySettings, "__output__", "test")
# We get "Hey there"
```

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "metadeco",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8,<4.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "Predeactor",
    "author_email": "pro.julien.mauroy@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/b8/cc/a12a12192bb63d9e3907dd28b2044e5089fa8227668177a9895d8851429d/metadeco-0.2.1.tar.gz",
    "platform": null,
    "description": "# Metadeco\n\nMetadata reflections for functions/methods. Inspired by NPM's [`reflect-metadata`](https://www.npmjs.com/package/reflect-metadata) package.\n\n## How to use:\n\n### To decorate a function:\n\n```py\nimport metadeco\n\n# Define a function with the \"__has_print__\" metadata set to \"True\"\n# You can set anything has the value of the metadata.\n@metadeco.metadata(\"__has_print__\", True)\ndef my_function():\n    print(\"Hello world!\")\n\nmetadeco.has_metadata(my_function)\n# We would get \"True\"\n\nmetadeco.get_metadata(my_function, \"__has_print__\")\n# We obtain the value set by the function, in here, \"True\nmetadeco.get_metadata(my_function, \"__not_set__\")\n# \"NoMetadataError\" is raised here.\n\nmetadeco.delete_metadata(my_function, \"__has_print__\")\n# Delete the metadata.\n```\n\n## To decorate a property:\n\n```py\nimport metadeco\n\n\nclass MySettings:\n    \n    @metadeco.decorate(\"__output__\", \"Hey there!\")\n    def test():\n        return \"Hey there!\"\n\n# Getting the metadata of \"test\" property in object MySettings\nmetadeco.get_metadata(MySettings, \"__output__\", \"test\")\n# We get \"Hey there\"\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Metadeco allows you to set metadata to decorated objects.",
    "version": "0.2.1",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6d1a373340c7c12477440f814d6aab44dbfc1d275845d0e7633ae04edb5f6759",
                "md5": "a83221309d3c6c389045a40e6d0e5de9",
                "sha256": "cbaed6816bb3ee4f7378e19e7251519833daa3a513c20b21c56cdb991ba1b345"
            },
            "downloads": -1,
            "filename": "metadeco-0.2.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a83221309d3c6c389045a40e6d0e5de9",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8,<4.0",
            "size": 5348,
            "upload_time": "2023-03-24T10:26:17",
            "upload_time_iso_8601": "2023-03-24T10:26:17.058504Z",
            "url": "https://files.pythonhosted.org/packages/6d/1a/373340c7c12477440f814d6aab44dbfc1d275845d0e7633ae04edb5f6759/metadeco-0.2.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b8cca12a12192bb63d9e3907dd28b2044e5089fa8227668177a9895d8851429d",
                "md5": "4c05f60c0bd1e73044687ee2b413b6f9",
                "sha256": "e1fd42a4745a9fdd29c39b9229c7c9e2ca1f42a483c4bf6b70a9a39a73b3d136"
            },
            "downloads": -1,
            "filename": "metadeco-0.2.1.tar.gz",
            "has_sig": false,
            "md5_digest": "4c05f60c0bd1e73044687ee2b413b6f9",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8,<4.0",
            "size": 3311,
            "upload_time": "2023-03-24T10:26:18",
            "upload_time_iso_8601": "2023-03-24T10:26:18.674067Z",
            "url": "https://files.pythonhosted.org/packages/b8/cc/a12a12192bb63d9e3907dd28b2044e5089fa8227668177a9895d8851429d/metadeco-0.2.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-03-24 10:26:18",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "metadeco"
}
        
Elapsed time: 0.12122s