{"id":15994053,"url":"https://github.com/knutwalker/namespacetrie","last_synced_at":"2025-10-21T03:30:40.449Z","repository":{"id":3209866,"uuid":"4244039","full_name":"knutwalker/namespacetrie","owner":"knutwalker","description":"A Trie implementation that manages not the single characters  but treats its values as typical namespaces.","archived":true,"fork":false,"pushed_at":"2014-01-02T06:18:04.000Z","size":144,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-28T23:38:54.459Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://blog.knutwalker.de/namespacetrie/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/knutwalker.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-05-06T20:58:40.000Z","updated_at":"2024-10-14T14:08:38.000Z","dependencies_parsed_at":"2022-08-19T13:01:06.032Z","dependency_job_id":null,"html_url":"https://github.com/knutwalker/namespacetrie","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/knutwalker%2Fnamespacetrie","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knutwalker%2Fnamespacetrie/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knutwalker%2Fnamespacetrie/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knutwalker%2Fnamespacetrie/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/knutwalker","download_url":"https://codeload.github.com/knutwalker/namespacetrie/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237429415,"owners_count":19308790,"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-10-08T07:05:27.866Z","updated_at":"2025-10-21T03:30:40.129Z","avatar_url":"https://github.com/knutwalker.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://secure.travis-ci.org/knutwalker/namespacetrie.png?branch=master)](http://travis-ci.org/knutwalker/namespacetrie)\n\nThis is the Namespace Trie.\n\nNamespace Trie is a implementation of a Trie data structure.  Unlike typical\nimplementations, which are splitting its value into single characters,\nNamespace Trie treats its values as namespaces.  Namespaces are strings that\nare delimited by a period. Such namespaces often occur in programming\nlanguages, e.g. Java or Python and may also appear while using some libraries\nfor programming languages that itself do not offer namespacing (e.g. the\nGoogle Closure library offers a namespace feature for JavaScript).  The\nNamespace Trie may help you find flaws in the namespace structure.\n\nNamespace Trie is developed for use with Closure Depresolver and may at the\nmoment not be very useful as there is not standalone interface.\n\n\n## Install\n\nfrom pip:\n\n    pip install namespacetrie\n\nfrom source:\n\n    pip install git+git://github.com/knutwalker/namespacetrie.git\n\n\n## Usage\n\n```python\nfrom namespacetrie.nstrie import NsTrie\nmodules = ['com.example.foo', 'com.example.bar', 'com.example.baz.Foo',\n           'com.example.baz.Bar', 'org.example']\ntrie = NsTrie(modules)\n'com.example' in trie\n# True\n\ntrie.has('com.example')\n# False\n\ntrie.has('com.example', False)\n# True\n\ntrie.has('com.example.foo')\n# True\n\nnode = trie.get('com.example')\nnode.keys()\n# ['foo', 'bar', 'baz']\n\ntrie.to_dict()\n# {'com': {'example': {'bar': 'com.example.bar',\n#    'baz': {'Bar': 'com.example.baz.Bar', 'Foo': 'com.example.baz.Foo'},\n#    'foo': 'com.example.foo'}},\n#  'org': {'example': 'org.example'}}\n\nlist(trie.iterdepth())\n# ['com', 'com.example', 'com.example.foo', 'com.example.bar',\n#  'com.example.baz', 'com.example.baz.Foo', 'com.example.baz.Bar',\n#  'org', 'org.example']\n\nlist(trie.iterbreadth())\n# ['com', 'org', 'com.example', 'org.example', 'com.example.foo',\n#  'com.example.bar', 'com.example.baz', 'com.example.baz.Foo',\n#  'com.example.baz.Bar']\n\ntrie.remove('com')\nlist(trie)\n# [('org', [('example', 'org.example')])]\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fknutwalker%2Fnamespacetrie","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fknutwalker%2Fnamespacetrie","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fknutwalker%2Fnamespacetrie/lists"}