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())
defined_augment(self)[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(self)[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
add

An alias for value

group_name

Alias for name

name

The name of the group of objects

value

An object in the group