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 namair 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("morning", "summer")
lexicon.attach("morning", "cold")

# 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")

# 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.0.4.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

namari-1.0.4-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: namari-1.0.4.tar.gz
  • Upload date:
  • Size: 7.0 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.0.4.tar.gz
Algorithm Hash digest
SHA256 14a736f5e7f847f2056a542e976ac31fde8d553ed6b1fb276f262a0ac25391b6
MD5 65aa9e9dbf4c903d1b3ef27dc03f21f2
BLAKE2b-256 ec1e524818b2c1bba433a40a39710922bae28d55747dd2ed1817000dd2db1d2f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: namari-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 4.2 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.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 85d9140c45f5b60552646586034db5b57c12ca0784844a260759996451b6cbc7
MD5 afee511c18ade8815e10ed3e42ca8409
BLAKE2b-256 63696b29c13583aef2b2fc773621c1bf3a67dd7deddaf59b6bba35fe241cf269

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