Skip to main content

Tab completable ordered dictionary.

Project description

Introduction

The is a simplification and redesign of the orderedbunch package from tinytools. The package ontains an OrderedBunch object class with associated bunchify/unbunchify methods, similar to other bunch implementations but built off an OrderedDict with ipython table-complete overloaded to the data memebers. It removes the ordered_dictionarify function that is in tinytools and and leaves the development of the nested dictionaries to external code. The motivation is that it is quite complicated to infer what the user is wanting - and therefore error prone.

IPython has also recently changed its handling of the __dir__ method and it is unclear under which cases it is respected for tab completion or not. It seems, though, that for ipython 6, it is possible to remove mothods from the tab completion through the IPCompleter.* configuration options.

Installing

pip install orderedbunch

Import

import orderedbunch

Quick Start

from orderedbunch import OrderedBunch

## OrderedBunch
from collections import OrderedDict

# Create an OrderedBunch from and return it to an OrderedDict
od = OrderedDict({'a':1,'b':2,'c':{'aa':1.23,'bb':'string'}})
ob = orderedbunch.ordered_bunchify(od)
ob.a          # Explore the OrderdBunch with tab complete
ob['a']       # Equivalent to above
ob.c.bb       # orderd_bunchify is recursive on nested Dict objects
ob['c']['bb'] # Equivalent to above
od2 = tt.bunch.ordered_unbunchify(ob)

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

orderedbunch-1.0.1.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

orderedbunch-1.0.1-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file orderedbunch-1.0.1.tar.gz.

File metadata

  • Download URL: orderedbunch-1.0.1.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.5

File hashes

Hashes for orderedbunch-1.0.1.tar.gz
Algorithm Hash digest
SHA256 ab91052c1090133d7921637437179728290dd1539d4a89014a43d1231fc0b3d5
MD5 62b72ac4b9e5a5ce06c059554435cd38
BLAKE2b-256 2002bfcb94841649f8a714932d80d402d3efd3e4def999131c2053ac1b3ad215

See more details on using hashes here.

File details

Details for the file orderedbunch-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: orderedbunch-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.5

File hashes

Hashes for orderedbunch-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8462a1e8f0a5b7717b1de7fd0c771fa383d99b8f2c14eb078cc1e3eb616bf0a5
MD5 035e7dec4f0315d38f10e70e289faf97
BLAKE2b-256 a9c72ffeb22306af652467995fef9d0b51c5908f54a7700b800a6b7343bc14e1

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