Skip to content
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-26331: Encapsulate Timespan representations behind an ABC, other Timespan fixes/cleanup. #353

Merged
merged 9 commits into from Aug 21, 2020

Conversation

TallJimbo
Copy link
Member

No description provided.

@TallJimbo TallJimbo force-pushed the tickets/DM-26331 branch 2 times, most recently from b384cc8 to 97e8314 Compare August 20, 2020 20:15
This makes a lot of code a lot safer, as it no longer relies on a
largely unenforceable convention about the ordering of fields.

It also makes `DimensionRecord.fromDict` unnecessary, and hence
that's being removed.

Finally, while this spreads out the logic that assembles and
disassembles Timespan objects and overall makes it messier, this is
all in preparation for abstracting over the database representation of
Timespans on a future commit, and it will make more sense then.
Trying to make this half-open (and test it against PostgreSQL
operators, WIP for another commit) revealed some fundamental problems.

We want this to be half-open because none of our existing use cases
care about whether bounds are open or closed, but calibration
collections will want to guarantee that the validity ranges for a
particular dataset type and data ID are exclusive, and that's _much_
simpler if adjacent ranges do not overlap.
By testing our Timespan operators against the PostgreSQL operators
for these types, we also get test coverage for Timespan, which was a
bit hard to write in a non-circular way before.
This actually propagates the signature of the callable being wrapped,
though it requires silencing mypy about the implementation.
@TallJimbo TallJimbo merged commit 844cb8a into master Aug 21, 2020
@TallJimbo TallJimbo deleted the tickets/DM-26331 branch August 21, 2020 16:02
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.

None yet

1 participant