-
Notifications
You must be signed in to change notification settings - Fork 14
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
DM-48282: Refactor obscore to allow subclasses #1142
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
✅ All tests successful. No failed tests found.
Additional details and impacted files@@ Coverage Diff @@
## main #1142 +/- ##
==========================================
- Coverage 89.50% 89.47% -0.04%
==========================================
Files 366 366
Lines 49015 49065 +50
Branches 5941 5950 +9
==========================================
+ Hits 43872 43899 +27
- Misses 3728 3748 +20
- Partials 1415 1418 +3 ☔ View full report in Codecov by Sentry. |
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.
Looks good. One thing that I'm not sure about is whether it's easier to specify record factory type in obscore config vs. entry point.
@@ -96,7 +99,7 @@ class RecordFactory: | |||
Registry dimensions universe. | |||
spatial_plugins : `~collections.abc.Collection` of `SpatialObsCorePlugin` | |||
Spatial plugins. | |||
exposure_region_factory : `ExposureRegionFactory`, optional | |||
derived_region_factory : `DerivedRegionFactory`, optional | |||
Manager for Registry dimensions. |
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.
Looks like I copy-pasted this line long time ago and did not update, can you add a better description?
@@ -120,15 +123,122 @@ def __init__( | |||
self.visit = universe["visit"] | |||
self.physical_filter = cast(Dimension, universe["physical_filter"]) | |||
|
|||
@abstractmethod | |||
def region_dimension(self, dimensions: DimensionGroup) -> tuple[str | None, str | None]: |
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.
Could just one of them be None
? If not then tuple[str, str] | tuple[None, None]
could be better?
@classmethod | ||
def get_record_type_from_universe(cls, universe: DimensionUniverse) -> type[RecordFactory]: |
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.
We could potentially specify the type in the obscore config itself?
spatial_plugins : `~collections.abc.Collection` of `SpatialObsCorePlugin` | ||
Spatial plugins. | ||
derived_region_factory : `DerivedRegionFactory`, optional | ||
Manager for Registry dimensions. |
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 too wants an update.
# should be used for the RecordFactory for this universe. | ||
record_factory_type = func() | ||
if not issubclass(record_factory_type, RecordFactory): | ||
raise ValueError( |
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.
Maybe TypeError
?
Checklist
doc/changes
configs/old_dimensions