{"id":23344379,"url":"https://github.com/rec/abbrev","last_synced_at":"2026-05-09T15:25:00.171Z","repository":{"id":57407764,"uuid":"351376313","full_name":"rec/abbrev","owner":"rec","description":"🐜 Expand abbreviations 🐜","archived":false,"fork":false,"pushed_at":"2024-02-14T14:42:57.000Z","size":756,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-24T04:04:16.381Z","etag":null,"topics":["abbreviations","python","text"],"latest_commit_sha":null,"homepage":"https://rec.github.io/abbrev/","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/rec.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG","contributing":null,"funding":"FUNDING.yml","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},"funding":{"github":"rec"}},"created_at":"2021-03-25T09:22:02.000Z","updated_at":"2024-12-19T14:37:28.000Z","dependencies_parsed_at":"2024-01-25T11:35:46.345Z","dependency_job_id":"ee0707f0-6145-4267-9176-782a8d11d48f","html_url":"https://github.com/rec/abbrev","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rec%2Fabbrev","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rec%2Fabbrev/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rec%2Fabbrev/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rec%2Fabbrev/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rec","download_url":"https://codeload.github.com/rec/abbrev/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248144305,"owners_count":21054905,"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":["abbreviations","python","text"],"created_at":"2024-12-21T06:26:28.995Z","updated_at":"2026-05-09T15:24:55.136Z","avatar_url":"https://github.com/rec.png","language":"Python","funding_links":["https://github.com/sponsors/rec"],"categories":[],"sub_categories":[],"readme":"# 🐜 `abbrev`: Expand abbreviations 🐜\n\nExpand a `Sequence` or `Mapping` of string abbreviations.\n\nHandy when the user has a choice of commands with long names.\n\n## Example 1: Use a list of choices\n\n    import abbrev\n\n    a = ['one', 'two', 'three']\n\n    assert abbrev(a, 'one') == 'one'\n    assert abbrev(a, 'o') == 'one'\n    assert abbrev(a, 'tw') == 'two'\n\n    abbrev(a, 'four')  # Raises a KeyError: no such key\n    abbrev(a, 't')  # Raises a KeyError: ambiguous key ('two' or 'three'?)\n\n\n## Example 2: Use a dictionary of choices\n\n    import abbrev\n\n    d = {'one': 100, 'two': 200, 'three': 300}\n\n    assert abbrev(d, 'one') == 100\n    assert abbrev(d, 'o') == 100\n    assert abbrev(d, 'tw') == 200\n\n## Example 3: Make an abbreviator to re-use\n\n    import abbrev\n\n    d = {'one': 100, 'two': 200, 'three': 300}\n\n    abbreviator = abbrev(d)\n\n    assert abbreviator('one') == my_abbrevs('o') == 100\n    assert abbreviator('tw') == 200\n\n## Example 4: Get all matches, when `multi=True`\n\n    import abbrev\n\n    a = ['one', 'two, 'three'}\n\n    multi = abbrev(a, multi=True)  # Make an abbreviator\n\n    assert multi('t') == abbrev(d, 't', multi=True) == ('two', three')\n    assert multi('o') == abbrev(d, 'o', multi=True) == ('one', )\n\n    multi('four')  # Still raises a key error\n\n## Example 5: Get only the first result, when `unique=False`\n\n    import abbrev\n\n    d = {'one': 100, 'two': 200, 'three': 300}\n\n    assert abbrev(d, 't', unique=False) == (200, 300)\n\n\n### [API Documentation](https://rec.github.io/abbrev#abbrev--api-documentation)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frec%2Fabbrev","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frec%2Fabbrev","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frec%2Fabbrev/lists"}