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

Add a close method to InferenceData #2338

Merged
merged 3 commits into from
Apr 4, 2024

Conversation

lucianopaz
Copy link
Contributor

@lucianopaz lucianopaz commented Apr 4, 2024

Closes #2337

Description

Adds a close method to arviz.InferenceData that simply extends from xarray.Dataset.close.

Checklist

  • Follows official PR format
  • Includes a sample plot to visually illustrate the changes (only for plot-related functions)
  • New features are properly documented (with an example if appropriate)?
  • Includes new or updated tests to cover the new feature
  • Code style correct (follows pylint and black guidelines)
  • Changes are listed in changelog

📚 Documentation preview 📚: https://arviz--2338.org.readthedocs.build/en/2338/

Copy link

codecov bot commented Apr 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.84%. Comparing base (dbef460) to head (4ce5550).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2338   +/-   ##
=======================================
  Coverage   86.84%   86.84%           
=======================================
  Files         123      123           
  Lines       12744    12745    +1     
=======================================
+ Hits        11067    11068    +1     
  Misses       1677     1677           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@michaelosthege
Copy link
Contributor

Would it help to call this in the objects destructor method automatically?

def __del__(self):
    self.close()

@lucianopaz
Copy link
Contributor Author

Would it help to call this in the objects destructor method automatically?

def __del__(self):
    self.close()

Yes, I think so. I'll add a commit that does that.

@OriolAbril
Copy link
Member

This seems to be generating an infinite loop. It's probably best to not call it at delete time. It should also be added to https://github.com/arviz-devs/arviz/blob/main/doc/source/api/inference_data.rst?plain=1#L26

@OriolAbril OriolAbril merged commit 8085824 into arviz-devs:main Apr 4, 2024
11 checks passed
@lucianopaz lucianopaz deleted the close_method branch April 4, 2024 18:19
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.

Add InferenceData.close method
3 participants