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-38054: Add DataCoordinate attribute access to DimensionRecords. #792

Merged
merged 2 commits into from Feb 22, 2023

Conversation

TallJimbo
Copy link
Member

@TallJimbo TallJimbo commented Feb 22, 2023

Checklist

  • ran Jenkins
  • added a release note for user-visible changes to doc/changes

Copy link
Member

@timj timj left a comment

Choose a reason for hiding this comment

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

Looks good to me. Can we also have an explicit test for the common usage? In test_dimensions.py there is a line:

self.assertEqual(dataId.timespan, dataId.records["visit"].timespan)

can we add a line underneath it as:

self.assertEqual(dataId.timespan, dataId.visit.timespan)

?

try:
return self._record(name)
except KeyError:
raise AttributeError(name) from None
Copy link
Member

Choose a reason for hiding this comment

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

It wouldn't hurt to also have a test on an unexpanded dataId to make sure it raises AttributeError? Then I imagine the follow up will be that people will want to distinguish between an attribute that is failing because it's not part of the dataId vs one that is failing because the records were not available (so maybe the error message should mention the distinction).

Without this, the default pickle implementation apparently tries to
do getattr on instances before they're fully constructed while catching
the exceptions.  And that leads to infinite recursion if one writes
a __getattr__ that involves accessing attributes added at construction.
@codecov
Copy link

codecov bot commented Feb 22, 2023

Codecov Report

Base: 85.51% // Head: 85.54% // Increases project coverage by +0.02% 🎉

Coverage data is based on head (05668d9) compared to base (be6ae92).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #792      +/-   ##
==========================================
+ Coverage   85.51%   85.54%   +0.02%     
==========================================
  Files         266      266              
  Lines       35087    35137      +50     
  Branches     7364     7377      +13     
==========================================
+ Hits        30004    30057      +53     
+ Misses       3768     3765       -3     
  Partials     1315     1315              
Impacted Files Coverage Δ
...hon/lsst/daf/butler/core/dimensions/_coordinate.py 86.68% <100.00%> (+0.67%) ⬆️
tests/test_dimensions.py 96.42% <100.00%> (+0.30%) ⬆️
python/lsst/daf/butler/core/timespan.py 82.53% <0.00%> (+0.30%) ⬆️
python/lsst/daf/butler/core/dimensions/_records.py 86.84% <0.00%> (+1.31%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.


See also
--------
:ref:`lsst.daf.butler-dimensions_data_ids`
Copy link
Member

Choose a reason for hiding this comment

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

I tried building the docs but I didn't see this section included. May want to consider embedding it into the Notes section instead.

Copy link
Member Author

Choose a reason for hiding this comment

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

It's there (or at least it is for me) - it's a little call-out box above the Notes section, unlike the way it appears in the source.

Copy link
Member

Choose a reason for hiding this comment

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

Ah. Yes. I see it now I know what I'm looking for. Sorry.

@TallJimbo TallJimbo merged commit e9fb00b into main Feb 22, 2023
@TallJimbo TallJimbo deleted the tickets/DM-38054 branch February 22, 2023 21:17
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

2 participants