{"id":21816584,"url":"https://github.com/5monkeys/enum-prop","last_synced_at":"2025-03-21T10:13:26.846Z","repository":{"id":45991347,"uuid":"397528013","full_name":"5monkeys/enum-prop","owner":"5monkeys","description":null,"archived":false,"fork":false,"pushed_at":"2021-11-22T12:44:01.000Z","size":13,"stargazers_count":0,"open_issues_count":4,"forks_count":1,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-02-28T08:55:38.368Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/5monkeys.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-08-18T08:29:40.000Z","updated_at":"2021-11-22T12:44:03.000Z","dependencies_parsed_at":"2022-08-29T20:40:09.420Z","dependency_job_id":null,"html_url":"https://github.com/5monkeys/enum-prop","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/5monkeys%2Fenum-prop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/5monkeys%2Fenum-prop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/5monkeys%2Fenum-prop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/5monkeys%2Fenum-prop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/5monkeys","download_url":"https://codeload.github.com/5monkeys/enum-prop/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244776340,"owners_count":20508506,"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":"2024-11-27T15:35:23.358Z","updated_at":"2025-03-21T10:13:26.824Z","avatar_url":"https://github.com/5monkeys.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=center\u003eenum-prop\u003c/h1\u003e\n\n\u003cp align=center\u003e\n    \u003ca href=https://github.com/5m/enum-prop/actions?query=workflow%3ACI+branch%3Amain\u003e\u003cimg src=https://github.com/5m/enum-prop/workflows/CI/badge.svg alt=\"CI Build Status\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\nEnum definitions can't, for good reasons, reference instances of themselves within their\nown definitions. This module allows definitions to come around that by mapping the names\nof enums for lookups, hidden behind a special dict subclass. This allows enum\ndefinitions to remain tidy, and avoids having to define instance-specific configuration\nas property functions.\n\n### Installation\n\n```shell\n$ python3 -m pip install enum-prop\n```\n\n### Usage\n\n```python\nimport enum\nfrom enum_prop import enum_property, enum_getter\n\nclass Vehicle(enum.Enum):\n    car = \"car\"\n    bike = \"bike\"\n    unicycle = \"unicycle\"\n    wheels = enum_property({car: 4, bike: 2, unicycle: 1})\n    __int__ = enum_getter({car: 4, bike: 2, unicycle: 1})\n\nprint(Vehicle.unicycle.wheels)  # 1\nprint(Vehicle.car.wheels)  # 4\nprint(int(Vehicle.unicycle))  # 1\nprint(int(Vehicle.bike))  # 2\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F5monkeys%2Fenum-prop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F5monkeys%2Fenum-prop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F5monkeys%2Fenum-prop/lists"}