{"id":23121923,"url":"https://github.com/maranite/nestees","last_synced_at":"2025-04-04T04:14:18.659Z","repository":{"id":57445553,"uuid":"406603107","full_name":"maranite/nestees","owner":"maranite","description":"A simple set of utility functions for dealing with nested dictionaries ","archived":false,"fork":false,"pushed_at":"2021-09-15T03:40:10.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-15T10:57:55.469Z","etag":null,"topics":["dictionaries","nested-objects","nested-structures","python","python-3"],"latest_commit_sha":null,"homepage":"","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/maranite.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-09-15T03:39:38.000Z","updated_at":"2024-05-30T04:25:02.000Z","dependencies_parsed_at":"2022-09-26T17:30:48.960Z","dependency_job_id":null,"html_url":"https://github.com/maranite/nestees","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/maranite%2Fnestees","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maranite%2Fnestees/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maranite%2Fnestees/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maranite%2Fnestees/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maranite","download_url":"https://codeload.github.com/maranite/nestees/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247117765,"owners_count":20886439,"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":["dictionaries","nested-objects","nested-structures","python","python-3"],"created_at":"2024-12-17T07:17:29.696Z","updated_at":"2025-04-04T04:14:18.637Z","avatar_url":"https://github.com/maranite.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Nestees\n\nProvides a simple set of utility functions for dealing with nested dictionaries - a.k.a. dict of dicts.\nInspired by the 'field path' concept in Google's superb [Firebase](https://firebase.google.com/) product, \nthese functions fully support the field path syntax and DELETE_FIELD sentinel to allow values nested \narbitrarily deep in standard Python dictionaries to be get, set, updated and deleted.\n\n## Example Usage: deep_get\n\n ```python\n\nfrom nestees import deep_get\n\ndata = {\n    'top': {\n        'mid_leaf': 'magic',\n        'middle': {\n            'leafA': 20,\n            'leafB.has.dots': 'its real!!!',\n        },\n    }\n}\n\ndeep_get(data, 'top.mid_leaf')\n\u003e\u003e\u003e 'magic'\n\ndeep_get(data, 'top.middle.leafA')\n\u003e\u003e\u003e 20\n\n# field path syntax supports backtics\ndeep_get(data, 'top.middle.`leafB.has.dots`')\n\u003e\u003e\u003e 'its real!!!'\n\n# Get supports default values\ndeep_get(data, 'my.road.to.nowhere`', 'some default')\n\u003e\u003e\u003e 'some default'\n```\n\n\n## Example Usage: deep_set and deep_delete\n\n ```python\n\nfrom nestees import deep_set, deep_delete\n\ndata = {}\n\ndeep_set(data, 'top.mid_leaf', 'magic')\nrepr(data)\n\u003e\u003e\u003e  {\n    'top': {\n        'mid_leaf': 'magic',\n    }\n}\n\ndeep_set(data, 'top.middle.leafA', 20)\nrepr(data)\n\u003e\u003e\u003e {\n    'top': {\n        'mid_leaf': 'magic',\n        'middle': {\n            'leafA': 20\n        },\n    }\n}\n\n# To delete a value, use the DELETE_SENTINEL\ndeep_set(data, 'top.mid_leaf.leafA', DELETE_SENTINEL)\nrepr(data)\n\u003e\u003e\u003e {\n    'top': {\n        'middle': {\n            'leafA': 20\n        }\n    }\n}\n\n# or just use deep_delete\ndeep_delete(data, 'top.middle.leafA')\nrepr(data)\n\u003e\u003e\u003e {\n    'top': {\n        'middle': {}\n    }\n}\n```\n\n# Example of deep_update\ndeep_update works like Python's built-in dict update method, in that it allows values to be merged at the leaf level, rather than set, if the existing leaf is a dict...\n```python\nfrom nestees import deep_update\n\ndata = {\n    'top': 53\n}\n\n# Updating an integer lead replaces the integer with a dict...\ndeep_update(data, 'top.middle', {'name':'John', 'occupation':'CEO'})\nrepr(data)\n\n\u003e\u003e\u003e {\n    'top': {\n        'middle': {\n            'name':'John',\n            'occupation':'CEO'\n        }\n    }\n}\n\n\u003e\u003e\u003e deep_update(data, 'top.middle', {'gender':'non-binary'})\n\u003e\u003e\u003e data\n{\n    'top': {\n        'middle': {\n            'name':'John',\n            'occupation':'CEO',\n            'gender':'non-binary'\n        }\n    }\n}\n\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaranite%2Fnestees","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaranite%2Fnestees","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaranite%2Fnestees/lists"}