PyOpenWorm.collections module

class PyOpenWorm.collections.Bag(**kwargs)[source]

Bases: PyOpenWorm.dataObject.DataObject

A convenience class for working with a collection of objects

Example:

v = Bag('unc-13 neurons and muscles')
n = P.Neuron()
m = P.Muscle()
n.receptor('UNC-13')
m.receptor('UNC-13')
for x in n.load():
    v.value(x)
for x in m.load():
    v.value(x)
# Save the group for later use
v.save()
...
# get the list back
u = Bag('unc-13 neurons and muscles')
nm = list(u.value())
Parameters:
group_name : string

A name of the group of objects

Attributes:
name : DatatypeProperty

The name of the group of objects

value : ObjectProperty

An object in the group

add : ObjectProperty

an alias for value

defined_augment()[source]

This fuction must return False if identifier_augment() would raise an IdentifierMissingException. Override it when defining a non-standard identifier for subclasses of DataObjects.

identifier_augment()[source]

Override this method to define an identifier in lieu of one explicity set.

One must also override defined_augment() to return True whenever this method could return a valid identifier. IdentifierMissingException should be raised if an identifier cannot be generated by this method.

Raises:
IdentifierMissingException