Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

zope.interface compliant ordered dictionary.

Project Description

zodict

Ordered dictionary which implements the corresponding zope.interface.common.mapping interface.:

>>> from zope.interface.common.mapping import IFullMapping
>>> from zodict import zodict
>>> zod = zodict()
>>> IFullMapping.providedBy(zod)
True

Node

This is a zodict which provides a location.:

>>> from zope.location.interface import ILocation
>>> from zodict.node import Node
>>> root = Node('root')
>>> ILocation.providedBy(Node)
True

>>> root['child'] = Node()
>>> root['child'].path
['root', 'child']

>>> child = root['child']
>>> child.__name__
'child'

>>> child.__parent__
<Node object 'root' at ...>

The filtereditems function.:

>>> from zope.interface import Interface
>>> from zope.interface import alsoProvides
>>> class IMarker(Interface): pass
>>> alsoProvides(root['child']['subchild'], IMarker)
>>> IMarker.providedBy(root['child']['subchild'])
True

>>> for item in root['child'].filtereditems(IMarker):
...     print item.path
['root', 'child', 'subchild']

UUID related operations on Node.:

>>> uuid = root['child']['subchild'].uuid
>>> uuid
UUID('...')

>>> root.node(uuid).path
['root', 'child', 'subchild']

>>> root.uuid = uuid
Traceback (most recent call last):
  ...
ValueError: Given uuid was already used for another Node

>>> import uuid
>>> newuuid = uuid.uuid4()

>>> root.uuid = newuuid
>>> root['child'].node(newuuid).path
['root']

>>> root.uuid = object()
Traceback (most recent call last):
  ...
AssertionError: arg <object object at ...> does not match <class 'uuid.UUID'>

Changes

Version 1.3

-Add uuid Attribute and node function to Node.
rnix, 2009-03-23

Version 1.2

-Add filtereditems function to Node.
rnix, 2009-03-22

Version 1.1

-Add INode interface and implementation.
rnix, 2009-03-18

Credits

-Written by Robert Niederreiter <rnix@squarewave.at> (2009-03-17)
Release History

Release History

History Node

1.9.3

History Node

1.9.2

History Node

1.9.1

History Node

1.9.0

History Node

1.8.0

History Node

1.7.0

History Node

1.6.1

History Node

1.6.0

History Node

1.5.0

History Node

1.4.1

History Node

1.4.0

History Node

1.3.1

This version
History Node

1.3

History Node

1.2

History Node

1.1

History Node

1.0

Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
zodict-1.3.tar.gz (4.2 kB) Copy SHA256 Checksum SHA256 Source Mar 23, 2009

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting