PyOpenWorm.pProperty module

class PyOpenWorm.pProperty.Property(name=False, owner=False, **kwargs)[source]

Bases: PyOpenWorm.contextualize.Contextualizable, PyOpenWorm.data.DataUser

Store a value associated with a DataObject

Properties can be be accessed like methods. A method call like:

a.P()

for a property P will return values appropriate to that property for a, the owner of the property.

Parameters:
owner : PyOpenWorm.dataObject.DataObject

The owner of this property

name : string

The name of this property. Can be accessed as an attribute like:

owner.name
get(self, *args)[source]

Get the things which are on the other side of this property

The return value must be iterable. For a get that just returns a single value, an easy way to make an iterable is to wrap the value in a tuple like (value,).

Derived classes must override.

has_value(self)[source]

Returns true if the Property has any values set on it.

This may be defined differently for each property

one(self)[source]

Returns a single value for the Property whether or not it is multivalued.

set(self, *args, **kwargs)[source]

Set the value of this property

Derived classes must override.

class PyOpenWorm.pProperty.PropertyMeta(name, bases, dct)[source]

Bases: PyOpenWorm.contextualize.ContextualizableClass