interval-repeat-decorator


Nameinterval-repeat-decorator JSON
Version 0.10 PyPI version JSON
download
home_pagehttps://github.com/hansalemaos/interval_repeat_decorator
SummaryRun code asynchronously to the main code execution
upload_time2022-11-30 01:54:45
maintainer
docs_urlNone
authorJohannes Fischer
requires_python
licenseMIT
keywords decorator asynchronously execution threading
VCS
bugtrack_url
requirements keyboard
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
### Run code asynchronously to the main code execution



```python

pip install interval-repeat-decorator



from interval_repeat_decorator import repeat_action

from threading import Lock

lock = Lock()

@repeat_action(

    print_exception=True,

    exception_value="FTW",

    break_on_exceptions=False,

    interval=.1,

    threadlock=lock,

    kill_thread="ctrl+x",

    number_of_executions=10,

)

def testest(number):

    if number == 0:

        print(number)

        return True

    elif number == 1:

        print(number / 0)

    return True

@repeat_action(

    print_exception=True,

    exception_value="FTW",

    break_on_exceptions=False,

    interval=.2,

    threadlock=lock,

    kill_thread="ctrl+y",

    number_of_executions=5,

)

def testest2(number):

    if number == 0:

        print(number)

        return True

    elif number == 1:

        print(number / 0)

    return True

testex = testest(number=0)

testex2 = testest2(number=1)

print(f"{testex=}\n{testex2=}") #returns the first result only, but will keep on executing!  

0

division by zero

testex=True

testex2='FTW'

0

division by zero

0

0

division by zero

0

0

division by zero

0

0

division by zero

0

0

testex

Out[3]: True

testex2

Out[4]: 'FTW'





```




            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/hansalemaos/interval_repeat_decorator",
    "name": "interval-repeat-decorator",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "decorator,asynchronously,execution,threading",
    "author": "Johannes Fischer",
    "author_email": "<aulasparticularesdealemaosp@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/8b/a4/1c19e7e04100101d2ef6c04d93d948523fbc796747d649ea396d25081228/interval_repeat_decorator-0.10.tar.gz",
    "platform": null,
    "description": "\n### Run code asynchronously to the main code execution\n\n\n\n```python\n\npip install interval-repeat-decorator\n\n\n\nfrom interval_repeat_decorator import repeat_action\n\nfrom threading import Lock\n\nlock = Lock()\n\n@repeat_action(\n\n    print_exception=True,\n\n    exception_value=\"FTW\",\n\n    break_on_exceptions=False,\n\n    interval=.1,\n\n    threadlock=lock,\n\n    kill_thread=\"ctrl+x\",\n\n    number_of_executions=10,\n\n)\n\ndef testest(number):\n\n    if number == 0:\n\n        print(number)\n\n        return True\n\n    elif number == 1:\n\n        print(number / 0)\n\n    return True\n\n@repeat_action(\n\n    print_exception=True,\n\n    exception_value=\"FTW\",\n\n    break_on_exceptions=False,\n\n    interval=.2,\n\n    threadlock=lock,\n\n    kill_thread=\"ctrl+y\",\n\n    number_of_executions=5,\n\n)\n\ndef testest2(number):\n\n    if number == 0:\n\n        print(number)\n\n        return True\n\n    elif number == 1:\n\n        print(number / 0)\n\n    return True\n\ntestex = testest(number=0)\n\ntestex2 = testest2(number=1)\n\nprint(f\"{testex=}\\n{testex2=}\") #returns the first result only, but will keep on executing!  \n\n0\n\ndivision by zero\n\ntestex=True\n\ntestex2='FTW'\n\n0\n\ndivision by zero\n\n0\n\n0\n\ndivision by zero\n\n0\n\n0\n\ndivision by zero\n\n0\n\n0\n\ndivision by zero\n\n0\n\n0\n\ntestex\n\nOut[3]: True\n\ntestex2\n\nOut[4]: 'FTW'\n\n\n\n\n\n```\n\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Run code asynchronously to the main code execution",
    "version": "0.10",
    "split_keywords": [
        "decorator",
        "asynchronously",
        "execution",
        "threading"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "283ef499fba17ca724cf4a960055d441",
                "sha256": "f8607659af8ef1e92f4f1094aa24d449b47de3dcfe33bf32a16c11feb7a4691f"
            },
            "downloads": -1,
            "filename": "interval_repeat_decorator-0.10-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "283ef499fba17ca724cf4a960055d441",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 5545,
            "upload_time": "2022-11-30T01:54:43",
            "upload_time_iso_8601": "2022-11-30T01:54:43.986133Z",
            "url": "https://files.pythonhosted.org/packages/15/ac/3db5025ca204946591e2a1c61aad675bbb4ea1e3040ae445ac4dd1f2c6be/interval_repeat_decorator-0.10-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "f9fb6d1335a9cbe77dc623789d580a83",
                "sha256": "e188d51b3bb269f9d21f9e4d044302ea44c0a6060be40494118514bcebc2f037"
            },
            "downloads": -1,
            "filename": "interval_repeat_decorator-0.10.tar.gz",
            "has_sig": false,
            "md5_digest": "f9fb6d1335a9cbe77dc623789d580a83",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 3924,
            "upload_time": "2022-11-30T01:54:45",
            "upload_time_iso_8601": "2022-11-30T01:54:45.404354Z",
            "url": "https://files.pythonhosted.org/packages/8b/a4/1c19e7e04100101d2ef6c04d93d948523fbc796747d649ea396d25081228/interval_repeat_decorator-0.10.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-11-30 01:54:45",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "hansalemaos",
    "github_project": "interval_repeat_decorator",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "keyboard",
            "specs": []
        }
    ],
    "lcname": "interval-repeat-decorator"
}
        
Elapsed time: 0.03408s