Make Code a real sub class of Data#2193
Conversation
Simplify code where nodes have had to be treated as either Code type or Data type.
3323169 to
c378d01
Compare
Code a real sub class of Data
By making `Code` a proper sub class of `Data` instead of `Node`, its type string is also changed from `code.Code.` to `data.code.Code.` so we add a migration to update these for existing databases. In addition, the `aiida:code` plugin group no longer makes sense and so the entry point for the `Code` class is moved to `aiida.data:code`. The entity loaders and `QueryBuilder` will now do the right thing after updating the entry point loader logic to treat `Code` as a sub class of `Data`. Finally, the `Code` class no longer needed any backend specific code, so the `AbstractCode` class is made concrete, moved to `aiida.orm.data.code` and the backend specific implementations are removed.
c378d01 to
2c2fbc8
Compare
|
@giovannipizzi @muhrin this is now ready for review. @ConradJohnston requested me, but since I have now changed a significant portion as well, I think it is a good idea if one of you has a gander. I have made the code class concrete by removing the remaining backend dependent methods and moved it to |
| if qb.count() == 0: | ||
| raise NotExistent("'{}' is not a valid code " | ||
| "name.".format(label)) | ||
| raise NotExistent("'{}' is not a valid code " "name.".format(label)) |
There was a problem hiding this comment.
There are a few of " " around, I guess after yapf, that could be fixed, maybe in a different PR.
There was a problem hiding this comment.
Yes, I will make a note, we can do one great sweep at the end of this project
|
Nice one @sphuber , thank you! |
Fixes #2173 .
Subclasses Code from Data rather than Node, and simplifies places in the code where code had to be treated as a 'special' data-like node.