{"id":22355810,"url":"https://github.com/zbo14/argtypes","last_synced_at":"2025-03-26T13:13:23.302Z","repository":{"id":94588524,"uuid":"120406298","full_name":"zbo14/argtypes","owner":"zbo14","description":"A python decorator to check argument types","archived":false,"fork":false,"pushed_at":"2018-02-07T23:13:50.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-31T14:28:58.599Z","etag":null,"topics":["decorators","type-checking"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zbo14.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-02-06T05:29:33.000Z","updated_at":"2018-02-07T21:35:07.000Z","dependencies_parsed_at":"2023-03-13T16:58:42.459Z","dependency_job_id":null,"html_url":"https://github.com/zbo14/argtypes","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/zbo14%2Fargtypes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zbo14%2Fargtypes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zbo14%2Fargtypes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zbo14%2Fargtypes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zbo14","download_url":"https://codeload.github.com/zbo14/argtypes/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245659053,"owners_count":20651525,"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":["decorators","type-checking"],"created_at":"2024-12-04T14:08:09.875Z","updated_at":"2025-03-26T13:13:23.292Z","avatar_url":"https://github.com/zbo14.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## argtypes \n\nA python decorator to check argument types.\n\nAdapted from [this](https://stackoverflow.com/a/15577293) stack overflow answer.\n\n### Usage \n\nExample\n\n```python\nfrom argtypes import argtypes\n\ndef type_error(f, *args):\n    try:\n        f(*args)\n        raise Exception('expected TypeError')\n    except TypeError:\n        pass\n\n@argtypes(arg=str)\ndef expects_string(arg):\n    pass\n\n@argtypes(arg1=int, arg2=list)\ndef expects_int_and_list(arg1, arg2):\n    pass\n\n@argtypes(arg=(float, tuple))\ndef expects_float_or_tuple(arg):\n    pass\n\nif __name__ == '__main__':\n\n    ## ok\n    expects_string('Damn good coffee!')\n    expects_int_and_list(8, [1, 2, 3, 4, 5, 6, 7])\n    expects_float_or_tuple(0.1)\n    expects_float_or_tuple((0, 1))\n\n    ## type errors\n    type_error(expects_string, False)\n    type_error(expects_int_and_list, 8, ())\n    type_error(expects_int_and_list, 'Ducks on a lake!', [1, 2, 3])\n    type_error(expects_float_or_tuple, 1)\n\n    print('Done!')\n```\n\n### Tests\n\n`python3 -m pytest test`","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzbo14%2Fargtypes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzbo14%2Fargtypes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzbo14%2Fargtypes/lists"}