Skip to main content

Folder Dict

The versatile dict for Python!

Installation

pip install folder-dict

or clone this repository and run the following command.

pip install -e ./

Import

from folder_dict import FolderDict

Usage

  • Import and Construct

    # Empty Folder Dict
    fd = FolderDict(sep="/")
    > fd
    --> FolderDict({})
    
  • Subscription

    user =  {
        "name": "Joe",
    	"age": 22,
    	"hobbies": ["Playing football", "Podcasts"],
        "friends": {
    		"Sue": {"age": 30},
        	"Ben": {"age": 35},
    	    }
    }
    
    fd = FolderDict(user, sep="/")
    > fd["name"]
    --> Joe
    
    > fd["friend/Sue/age"]
    --> 30
    
    > fd["/friend/Ben"]
    --> FolderDict({
        "age": 30,
    })
    
    • Multiple inputs
      > fd["name", "age","friends/Ben/age"]
      --> ("Joe", 22, 35)
      
  • Assignment
    Assigns the object at the given path into the FolderDict.

    fd = FolderDict(sep="/")
    fd["path/to/obj_name"] = 10
    
    > fd["path/to/obj_name"]
    10
    
    • Multiple inputs
    fd["a/b", "c/d"] = (0,1)
    > fd
    --> FolderDict({
        "a/b": 0,
        "c/d": 1
    })
    
  • list Lists all paths contained in the FolderDict.

    fd["a/b", "c/d"] = (0,1)
    > fd.list()
    --> ["/a/b", "/c/d"]
    
  • Direct card ~
    Get paths ending with "c".

    fd["a/b/c", "d/e/f/abc", "g/h/c", "i/j"] = (1,2,3,4)
    > fd.list("~c")
    --> ["/a/b/c", "/d/e/f/abc", "/g/h/c"]
    

    cf.

    > fd.list("~/c")
    --> ["a/b/c", "g/h/c"]
    
  • Properties

    fd["a/b","a/c"] = (1,2)
    
    # dict
    > fd.dict
    --> {'a': {'b': 1, 'c': 2}}
    
    # PathDict
    > fd.PathDict
    -->PathDict({
      "a": {
        "b": 1,
        "c": 2  
      }
    })
    
    # sep
    > fd.sep
    --> '/'
    

Metadata

Release files for folder-dict 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for folder-dict 0.1.2
File Size Uploaded Provenance Actions
folder_dict-0.1.2.tar.gz 5.0 kB Without provenance Details for folder_dict-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for folder-dict 0.1.2
File Interpreter ABI Platform Actions
folder_dict-0.1.2-py3-none-any.whl Python 3 none any Details for folder_dict-0.1.2-py3-none-any.whl

Total release size: 9.8 kB

Release files / folder_dict-0.1.2.tar.gz

Download URL folder_dict-0.1.2.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
7b2c96fb0920756705e4c6e3ec2823dfad84f583a2a183708c10e49097e82862
BLAKE2b-256 checksum
How to use checksums
96067b69983654aa6ebaa444716dfbfb9adec64e3f3630291bbd23bdc560d69e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.13 CPython/3.9.12 Darwin/21.4.0

Release files / folder_dict-0.1.2-py3-none-any.whl

Download URL folder_dict-0.1.2-py3-none-any.whl
Size 4.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0b5bf4eb099ec46e14ad477eee3f2677a84d103aca6be622a1312e2322cbeccf
BLAKE2b-256 checksum
How to use checksums
4116ec4a436734658202d5228cadaafff5d5e12352db42573a83024dc0a7c1c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.13 CPython/3.9.12 Darwin/21.4.0

Security for folder-dict 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page