Skip to content

Add multilayered inheritance structure to DataConcepts[Collection]#269

Merged
dekatzenel merged 2 commits intomasterfrom
bugfix/separate-templates-from-data-objects
Mar 31, 2020
Merged

Add multilayered inheritance structure to DataConcepts[Collection]#269
dekatzenel merged 2 commits intomasterfrom
bugfix/separate-templates-from-data-objects

Conversation

@dekatzenel
Copy link
Copy Markdown
Contributor

Citrine Python PR

Description

Add multilayered inheritance structure to DataConcepts[Collection]. Allows for more fine-grained control of which classes have access to shared methods/values

PR Type:

  • Breaking change (fix or feature that would cause existing functionality to change)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Adherence to team decisions

  • I have added tests for 100% coverage
  • I have written Numpy-style docstrings for every method and class.
  • I have communicated the downstream consequences of the PR to others.

@dekatzenel dekatzenel requested review from bfolie and maxhutch March 30, 2020 22:53
Copy link
Copy Markdown

@bfolie bfolie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is an improvement. A few questions.

  1. Are you also going to use this PR to fix the filter_by_attribute_bounds issue that instigated the change?
  2. Is there a need to have the abstract get_type method in each abstract collection class? Since they implement DataConceptsCollection and the method is abstractly defined there, it seems redundant.
  3. Should we create separate classes for specs and runs? On the one hand it doesn't necessarily hurt, and we could always define the two classes and if we don't make use of them that's ok. But I also don't necessarily view specs and runs as being different types of objects, and can't think of a method we'd want to do to one but not the other. Do you have a distinction in mind?

@dekatzenel
Copy link
Copy Markdown
Contributor Author

1. Are you also going to use this PR to fix the `filter_by_attribute_bounds` issue that instigated the change?

I was planning to do that as a separate PR for convenience of review. I intended to do it prior to adding another non-template endpoint (which is how I found this issue in the first place)

@dekatzenel
Copy link
Copy Markdown
Contributor Author

2. Is there a need to have the abstract `get_type` method in each abstract collection class? Since they implement `DataConceptsCollection` and the method is abstractly defined there, it seems redundant.

It removed a warning in intellij. If we're cool with the warning, I can remove the abstract method. Apparently having these classes extend ABC also fixes the warning, if that sounds better

@dekatzenel
Copy link
Copy Markdown
Contributor Author

3. Should we create separate classes for specs and runs? On the one hand it doesn't necessarily hurt, and we could always define the two classes and if we don't make use of them that's ok. But I also don't necessarily view specs and runs as being different types of objects, and can't think of a method we'd want to do to one but not the other. Do you have a distinction in mind?

I do actually - consider MaterialRunCollection.filter_by_spec(), MaterialRunCollection.filter_by_template(), and MaterialSpecCollection.filter_by_template() in a world where these methods are implemented for all runs and specs, respectively.

@bfolie
Copy link
Copy Markdown

bfolie commented Mar 30, 2020

It removed a warning in intellij. If we're cool with the warning, I can remove the abstract method. Apparently having these classes extend ABC also fixes the warning, if that sounds better

Yeah I think it makes the most sense to extend ABC

@dekatzenel dekatzenel requested a review from bfolie March 31, 2020 14:58
@dekatzenel dekatzenel merged commit b8ce739 into master Mar 31, 2020
@dekatzenel dekatzenel deleted the bugfix/separate-templates-from-data-objects branch March 31, 2020 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants