NeuralEnsemble/python-neo — pull request #121 by toddrjen (2014-01-21 21:59:06+00:00)
Title: Implement relationship data and functions inside neo core classes

As discussed on the mailing list, this pull request is the first step to removing neo/desctription.py.

This commit has a few bug fixes, but its primary purpose (which is in the last commit) is two-fold.

First, it removes from description.py one_to_many_relationship, many_to_one_relationship, many_to_many_relationship, property_relationship, and implicit_relationship. These relationships are moved to the neo.core classes. So each class contains attributes detailing both its parent and child relationships, as well as some helper properties to make it easier to access this information. For most io classes this an invisible change, but a couple io classes depended on this information. They have been ported to use the attributes instead. Similarly, generate_diagram.py has been ported to use the attributes also.

Second, it removes from neo.io.tools create_many_to_one_relationship. This is now implemented as a method of baseneo, using the attributes to control the relationships.

This approach has several major advantages. First, it means neo classes are more stand-alone. Currently many operations, including standard ones like finalizing blocks or segments, requires importing functions and/or data from other areas of neo.

Second, it means that neo can be extended at runtime. If people want to add their own classes to neo. they can do so just be modifying the list of child objects in the necessary class, and io writers can (once everything is done) write them just fine. This is currently impossible.

Third, it is a necessary prerequisite for other tasks planned for the 0.4 cycle, such as automatic handling of parent/child relationships.

The next step once this is merged is to move the necessary/optional attribute information from description.py into the classes as well.