{"id":24505515,"url":"https://github.com/thahnen/throws","last_synced_at":"2025-03-15T08:41:41.475Z","repository":{"id":57475329,"uuid":"357504768","full_name":"thahnen/throws","owner":"thahnen","description":"Python library to emulate the @throws decorator of Kotlin, mainly for documentation and debugging.","archived":false,"fork":false,"pushed_at":"2022-01-31T20:53:28.000Z","size":16,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-22T10:17:37.943Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://pypi.org/project/throws/","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/thahnen.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":"2021-04-13T09:58:22.000Z","updated_at":"2022-01-31T20:53:31.000Z","dependencies_parsed_at":"2022-09-07T13:51:05.627Z","dependency_job_id":null,"html_url":"https://github.com/thahnen/throws","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/thahnen%2Fthrows","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thahnen%2Fthrows/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thahnen%2Fthrows/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thahnen%2Fthrows/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thahnen","download_url":"https://codeload.github.com/thahnen/throws/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243707297,"owners_count":20334614,"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":[],"created_at":"2025-01-21T23:30:14.580Z","updated_at":"2025-03-15T08:41:41.450Z","avatar_url":"https://github.com/thahnen.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Python: throws\n\nSmall but simple library providing a function decorator similar to Kotlins *@throws(...)*\ndecorator with the small difference that multiple exceptions or errors can be combined in just one\nsingle annotation. Should maily used for documentation and debugging purposes.\n\n## Installation\n\nInstallation is possible using the Python *pip* command line tool. For you the command to install\nthis library may look like this:\n\n```bash\npip3 install throws\n```\n\n## Usage\n\nTo use the *@throw* decorator simply place it before the function declaration providing every\npossible exception raised by the function. For a quick example see below:\n\n```python\nfrom throws import throws\n\n@throws(IOError, ValueError)\ndef check_version(version_file: str) -\u003e bool:\n    with open(version_file, \"r\", encoding = \"utf-8\") as vf:\n        if (float(vf.read() \u003e 1.0):\n            return true\n        return false\n```\n\nThe library provides two Exceptions by itself, the *EmptyListException* and the\n*InvalidRaisedException*. The first one is raised when there are no parameters provided to\n*@throw* and the function decorated is run. The second one occours when the function raises an\nexception which is not provided to the decorator, providing the developer with feedback that he\nmight have forgotten about handling this specific exception!\n\n## Uploading a new version\n\nTo create and upload a new version to PyPI use the following commands:\n\n```bash\n# 1) Check for correctness\npython3 setup.py check\n\n# 2) Create distributable files\npython3 setup.py sdist bdist_wheel\n\n# 3) Check distributable files\npython3 -m twine check dist/*\n\n# 4) Upload distributable files\npython3 -m twine upload dist/*\n```\n\n## Links\n\nLibrary at the Python Package Index (PyPI): https://pypi.org/project/throws/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthahnen%2Fthrows","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthahnen%2Fthrows","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthahnen%2Fthrows/lists"}