{"id":16252227,"url":"https://github.com/jsfehler/shibari","last_synced_at":"2026-01-04T02:49:18.111Z","repository":{"id":57466818,"uuid":"204591821","full_name":"jsfehler/shibari","owner":"jsfehler","description":"Bind functions to run only once inside a desired scope.","archived":false,"fork":false,"pushed_at":"2019-08-30T20:46:12.000Z","size":16,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-19T17:21:56.833Z","etag":null,"topics":["python","python3","python36"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jsfehler.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.md","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":"2019-08-27T01:18:18.000Z","updated_at":"2024-01-19T10:26:37.000Z","dependencies_parsed_at":"2022-09-10T03:43:53.734Z","dependency_job_id":null,"html_url":"https://github.com/jsfehler/shibari","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsfehler%2Fshibari","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsfehler%2Fshibari/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsfehler%2Fshibari/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsfehler%2Fshibari/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jsfehler","download_url":"https://codeload.github.com/jsfehler/shibari/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247082732,"owners_count":20880709,"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":["python","python3","python36"],"created_at":"2024-10-10T15:12:51.351Z","updated_at":"2026-01-04T02:49:18.067Z","avatar_url":"https://github.com/jsfehler.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"shibari\n=======\n\n.. image:: https://img.shields.io/pypi/v/shibari.svg\n    :target: https://pypi.org/project/shibari\n    :alt: PyPI\n\n.. image:: https://img.shields.io/pypi/pyversions/shibari.svg\n    :alt: PyPI - Python Version\n    :target: https://github.com/jsfehler/shibari\n\n.. image:: https://img.shields.io/github/license/jsfehler/shibari.svg\n    :alt: GitHub\n    :target: https://github.com/jsfehler/shibari/blob/master/LICENSE\n\n.. image:: https://travis-ci.org/jsfehler/stere.svg?branch=master\n    :target: https://travis-ci.org/jsfehler/stere\n\nBind functions to only run once inside a desired scope.\n\nDocumentation\n-------------\n\nThe Rig class exposes two methods: `bind` and `free`. Bind takes one argument: A name for a scope to bind the function.\n\nFunctions wrapped with `bind` will be called only once until the scope it is inside is freed.\n\nFunctions wrapped with `free` will free all the bound functions in a specific scope after the function's execution.\n\nExample:\n\n.. code-block:: python\n\n    import shibari\n\n\n    rig = shibari.Rig('ebi')\n\n\n    @rig.bind('ebi')\n    def timestamp():\n        return str(time.time())\n\n\n    @rig.free('ebi')\n    def finish():\n        pass\n\n\n    \u003e\u003e\u003e t = timestamp()\n    \u003e\u003e\u003e t2 = timestamp()\n    \u003e\u003e\u003e assert t == t2\n\n    \u003e\u003e\u003e finish()\n\n    \u003e\u003e\u003e t3 = timestamp()\n    \u003e\u003e\u003e t4 == timestamp()\n    \u003e\u003e\u003e assert t != t3\n    \u003e\u003e\u003e assert t3 == t4\n\nFunctions that take arguments can be bound, but will always return the same result until they are freed.\n\nExample:\n\n.. code-block:: python\n\n    import shibari\n\n\n    rig = shibari.Rig('ebi')\n\n\n    @rig.bind('ebi')\n    def timestamp(a, b):\n        return f'{a}_{str(time.time())}_{b}'\n\n\n    \u003e\u003e\u003e t = timestamp('goodbye', 'world')\n    \u003e\u003e\u003e t2 = timestamp('hello', 'space')\n    \u003e\u003e\u003e assert t == t2\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjsfehler%2Fshibari","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjsfehler%2Fshibari","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjsfehler%2Fshibari/lists"}