{"id":20128418,"url":"https://github.com/teamhide/strip-deco","last_synced_at":"2025-04-09T15:50:23.158Z","repository":{"id":57471863,"uuid":"306209278","full_name":"teamhide/strip-deco","owner":"teamhide","description":"Easily strip decorator from function or class method","archived":false,"fork":false,"pushed_at":"2020-11-26T07:28:22.000Z","size":38,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-23T18:04:35.217Z","etag":null,"topics":["decorator","pytest","python","python-library"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/teamhide.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-10-22T03:12:35.000Z","updated_at":"2022-07-30T14:32:18.000Z","dependencies_parsed_at":"2022-08-30T13:51:58.679Z","dependency_job_id":null,"html_url":"https://github.com/teamhide/strip-deco","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teamhide%2Fstrip-deco","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teamhide%2Fstrip-deco/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teamhide%2Fstrip-deco/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teamhide%2Fstrip-deco/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/teamhide","download_url":"https://codeload.github.com/teamhide/strip-deco/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248063783,"owners_count":21041853,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["decorator","pytest","python","python-library"],"created_at":"2024-11-13T20:27:04.492Z","updated_at":"2025-04-09T15:50:23.138Z","avatar_url":"https://github.com/teamhide.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# strip-deco\n[![license]](/LICENSE)\n[![pypi]](https://pypi.org/project/strip-deco/)\n[![pyversions]](http://pypi.python.org/pypi/strip-deco)\n![badge](https://action-badges.now.sh/teamhide/strip-deco)\n[![Downloads](https://pepy.tech/badge/strip-deco)](https://pepy.tech/project/strip-deco)\n\n---\n\n**strip-deco** easily strip decorator from function or class method\n\n## Installation\n\n```python\npip3 install strip-deco\n```\n\n\n## Prototype\n```python\ndef stripdeco(obj: Any, depth: int = None, **kwargs) -\u003e None:\n    ...\n```\n- obj: Function or Class method\n- depth: If your function is wrapped in multiple decorators, you can set how many decorators to disable through the depth parameter.\n- kwargs: Arguments that obj have to receive\n\n## Example of normal function\n```python\nfrom strip_deco import stripdeco\n\n\ndef deco(func):\n    def _deco(*args, **kwargs):\n        result = func(*args, **kwargs)\n        return result\n    return _deco\n    \n@deco\ndef test():\n    pass\n    \n\nstripdeco(obj=test)\n\n\n@deco\n@deco\n@deco\ndef test():\n    pass\n    \n\nstripdeco(obj=test)\nstripdeco(obj=test, depth=1)  # Only strip one decorator\n```\n\n## Example of class method\n```python\nfrom strip_deco import stripdeco\n\n\ndef deco(func):\n    def _deco(*args, **kwargs):\n        result = func(*args, **kwargs)\n        return result\n    return _deco\n\n\nclass Service:\n    @deco\n    @deco\n    def run(self):\n        pass\n    \n    @deco\n    @deco\n    def run_with_arguments(self, user_id):\n        pass\n\n\nstripdeco(obj=Service().run)\nstripdeco(obj=Service().run, depth=1)  # Only strip one decorator\n\nstripdeco(obj=Service().run_with_arguments, user_id=1)  # Case of other arguments\nstripdeco(obj=Service().run_with_arguments, depth=1, user_id=1)  # Only strip one decorator\n```\n\n## Example of class method with init\n```python\nfrom strip_deco import stripdeco\n\n\ndef deco(func):\n    def _deco(*args, **kwargs):\n        result = func(*args, **kwargs)\n        return result\n    return _deco\n\n\nclass Service:\n    def __init__(self, repo):\n        self.repo = repo\n\n    @deco\n    @deco\n    def run(self):\n        pass\n    \n    @deco\n    @deco\n    def run_with_arguments(self, user_id):\n        pass\n\n        \nstripdeco(obj=Service(repo=\"repo\").run)\nstripdeco(obj=Service(repo=\"repo\").run, depth=1)  # Only strip one decorator\n\nstripdeco(obj=Service(repo=\"repo\").run_with_arguments, user_id=1)  # Case of other arguments\nstripdeco(obj=Service(repo=\"repo\").run_with_arguments, depth=1, user_id=1)  # Only strip one decorator\n```\n\n- strip-deco automatically removes  any kind of decorators. (class/function)\n- It supports both decorator,`functools wraps` and non functools wraps .\n- If you specify depth paramater, it will strip order by outside.\n- The class argument is required when executing class method.\n\n\n[license]: https://img.shields.io/badge/License-GPLv3-blue.svg\n[pypi]: https://img.shields.io/pypi/v/strip-deco\n[pyversions]: https://img.shields.io/pypi/pyversions/strip-deco","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fteamhide%2Fstrip-deco","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fteamhide%2Fstrip-deco","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fteamhide%2Fstrip-deco/lists"}