-
Notifications
You must be signed in to change notification settings - Fork 266
Automatic handling of relationships between objects #1266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
5e3c0b3
fix some failing tests related to pretty-printing
apdavison 95420ee
For clarity, move creation of child object lists explicitly into cons…
apdavison 1f84881
Remove `_multi_child...` and `create_many_to_many_relationship()` sin…
apdavison 006c97b
`create_many_to_one_relationship()` is now just `create_relationship()`
apdavison 98c658f
Remove more unused code
apdavison 8baaeb3
Replace simple lists with a list-like object that can manage relation…
apdavison 6daf752
Set parent relationship on adding object to list
apdavison 5adbe0a
docstrings
apdavison abe4b15
fix some bugs that were found by running iotests
apdavison 13292f4
fix bug seen by Samuel
apdavison 425c285
Merge branch 'master' into autorel3
JuliaSprenger File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,6 +10,10 @@ | |
| from datetime import datetime | ||
|
|
||
| from neo.core.container import Container, unique_objs | ||
| from neo.core.group import Group | ||
| from neo.core.objectlist import ObjectList | ||
| from neo.core.regionofinterest import RegionOfInterest | ||
| from neo.core.segment import Segment | ||
|
|
||
|
|
||
| class Block(Container): | ||
|
|
@@ -64,7 +68,6 @@ class Block(Container): | |
| ''' | ||
|
|
||
| _container_child_objects = ('Segment', 'Group') | ||
| _child_properties = () | ||
| _recommended_attrs = ((('file_datetime', datetime), | ||
| ('rec_datetime', datetime), | ||
| ('index', int)) + | ||
|
|
@@ -86,9 +89,27 @@ def __init__(self, name=None, description=None, file_origin=None, | |
| self.file_datetime = file_datetime | ||
| self.rec_datetime = rec_datetime | ||
| self.index = index | ||
| self.regionsofinterest = [] # temporary workaround. | ||
| # the goal is to store all sub-classes of RegionOfInterest in a single list | ||
| # but this will need substantial changes to container handling | ||
| self._segments = ObjectList(Segment, parent=self) | ||
| self._groups = ObjectList(Group, parent=self) | ||
| self._regionsofinterest = ObjectList(RegionOfInterest, parent=self) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should regions of interest really be linked to a block and not a handled on the same level as a view? |
||
|
|
||
| segments = property( | ||
| fget=lambda self: self._get_object_list("_segments"), | ||
| fset=lambda self, value: self._set_object_list("_segments", value), | ||
| doc="list of Segments contained in this block" | ||
| ) | ||
|
|
||
| groups = property( | ||
| fget=lambda self: self._get_object_list("_groups"), | ||
| fset=lambda self, value: self._set_object_list("_groups", value), | ||
| doc="list of Groups contained in this block" | ||
| ) | ||
|
|
||
| regionsofinterest = property( | ||
| fget=lambda self: self._get_object_list("_regionsofinterest"), | ||
| fset=lambda self, value: self._set_object_list("_regionsofinterest", value), | ||
| doc="list of RegionOfInterest objects contained in this block" | ||
| ) | ||
|
|
||
| @property | ||
| def data_children_recur(self): | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This script is currently not running due to some imports not being present. I think it would help to also include the generated diagram to understand the structural changes here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@apdavison : do you plan to tedisouly also fix the diagram generator or will we fix this later ?