This repository has been archived by the owner on Oct 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 41
Attribute-like access and ipython autocomplete #98
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for more information, see https://pre-commit.ci
TomNicholas
commented
May 24, 2022
datatree/datatree.py
Outdated
@@ -87,6 +91,7 @@ class DataTree( | |||
MappedDatasetMethodsMixin, | |||
MappedDataWithCoords, | |||
DataTreeArithmeticMixin, | |||
AttrAccessMixin, |
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 might want to inherit from xarray's DataWithCoords
here instead, which also inherits from AttrAccessMixin
.
I'm guilty of building a heavy dependency on xarray's internals here, but this whole package has that problem so 🤷♂️
TomNicholas
commented
May 24, 2022
TomNicholas
commented
May 24, 2022
This reverts commit 52ef23b.
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
…into attraccess
for more information, see https://pre-commit.ci
TomNicholas
commented
Jan 24, 2023
datatree/common.py
Outdated
Comment on lines
26
to
27
#elif cls.__module__.startswith("datatree."): # TODO reinstate this once integrated upstream | ||
# raise AttributeError(f"{cls.__name__} must explicitly define __slots__") |
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 entire file is here just so I can get rid of this erorr/warning below...
flamingbear
pushed a commit
to flamingbear/rewritten-datatree
that referenced
this pull request
Jan 19, 2024
…e#98 * sketching out changes needed to integrate variables into DataTree * fixed some other basic conflicts * fix mypy errors * can create basic datatree node objects again * child-variable name collisions dectected correctly * in-progres * add _replace method * updated tests to assert identical instead of check .ds is expected_ds * refactor .ds setter to use _replace * refactor init to use _replace * refactor test tree to avoid init * attempt at copy methods * rewrote implementation of .copy method * xfailing test for deepcopying * attribute-like access * test for accessing attrs * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * pseudocode implementation of DatasetView * Revert "pseudocode implementation of DatasetView" This reverts commit 52ef23baaa4b6892cad2d69c61b43db831044630. * removed duplicated implementation of copy * reorganise API docs * expose data_vars, coords etc. properties * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * try except with calculate_dimensions private import * add keys/values/items methods * don't use has_data when .variables would do * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * attribute-like access now working * include attribute-like access in docs * silence warning about slots * should have been in last commit * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * whatsnew * make typing compatible with 3.8 * got string file path completion working * test ipython key completions * note about supporting auto-completion of relative paths in future Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uses xarray's
AttrAccessMixin
to add attribute-like access to child nodes, data and attrs. Also adds all those items + methods to ipython autocomplete.pre-commit run --all-files
New functions/methods are listed inapi.rst