Skip to main content

Many-to-one keys-value pair relationship Python object manager.

Project description

namari

Many-to-one keys-value pair relationship Python object manager.

Usage

Install the latest namari package, upcoming versions might introduce unannounced changes, so a virtual environment is a must have before installation.

pip install --upgrade namari

To integrate namari into your Python codes, check the code snippet below:

from namari import Namari

# initialize
lexicon = Namari()

# initialize with filename
lexicon = Namari("filename.json")

# clear contents
lexicon.clear()

# set key-value pair
lexicon.set("yellow", "sun")

# check if key existing
if lexicon.contains("yellow"):
    print("Exists")

# associate existing keys with a new and unique key
lexicon.attach("yellow", "hot")
lexicon.attach("yellow", "morning")
lexicon.attach("yellow", "tea")
lexicon.attach("morning", "summer")
lexicon.attach("morning", "cold")
lexicon.attach("morning", "tea")

# disassociate 2nd key from the 1st key
lexicon.detach("summer", "cold")

# get the value of the specified key
object = lexicon.get("morning") # None

# get the value of the specified key with specified fallback
object = lexicon.get("night", fallback="moon")

# get the first parent of child
parent = lexicon.findFirst("summer", fallback=None)
parents = lexicon.findAll("tea")

# count contents
count = lexicon.count()

# check if empty
if lexicon.is_empty():
    print("Empty")

# iterate over all keys-value pairs
for keys, value in lexicon.items():
    print(type(keys)) # list
    print("\n".join(keys))
    print(value)

Did you know?

The repository name namari was inspired from the developer's noisy cat named Anna Marie, it also means as lead or guidance in Japanese.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

namari-1.1.4.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

namari-1.1.4-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file namari-1.1.4.tar.gz.

File metadata

  • Download URL: namari-1.1.4.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

File hashes

Hashes for namari-1.1.4.tar.gz
Algorithm Hash digest
SHA256 6399e3a4e9830700b0a99a0b558fc11d142f316eeeac1a4ec2ed4a19ac98b418
MD5 8973a908f2584bc62c62b67d863507f3
BLAKE2b-256 0c1298ba31f054d2f8721ca8f9efab59772713d57d59fdff87f25af8ca59e200

See more details on using hashes here.

File details

Details for the file namari-1.1.4-py3-none-any.whl.

File metadata

  • Download URL: namari-1.1.4-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

File hashes

Hashes for namari-1.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 4b57ea47bccc9e54a48745eae71b032ee94149af1c00f740a2d745ffb8a9dd71
MD5 1487528d03c87ec4ce3f428706e6c9a2
BLAKE2b-256 c44e2d78343b1f914e6e0b7dea237a4942efff3008db88ebc42bf5f3910bba0b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page