Skip to content
This repository has been archived by the owner on Oct 24, 2024. It is now read-only.

Method to match node paths via glob #267

Merged
merged 12 commits into from
Oct 24, 2023

Conversation

TomNicholas
Copy link
Member

@TomNicholas TomNicholas commented Oct 24, 2023

@TomNicholas TomNicholas added the enhancement New feature or request label Oct 24, 2023
@TomNicholas TomNicholas changed the title Match node paths via glob Method to match node paths via glob Oct 24, 2023
datatree/datatree.py Outdated Show resolved Hide resolved
Examples
--------
>>> dt = DataTree.from_dict(
>>> {
Copy link
Member Author

Choose a reason for hiding this comment

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

@keewis blackdoc raised an error here:

error: cannot format /code/datatree/datatree.py: Cannot parse: 1217:0: EOF in multi-line statement

Copy link
Contributor

Choose a reason for hiding this comment

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

that's not proper doctest, you need to use ... for continuation lines.

I guess blackdoc could be extended to detect this, but that would mean that it would have to parse python code itself (which it does not so far, and would make it a fair bit more complicated): it detects code blocks using the doctest syntax and then applies black to each of them separately.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh - I copied this from syntax used in the docstring of xarray's Dataset.map. So I guess it should look like this example from pint-xarray. Thanks!

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually no I'm just being an idiot

@TomNicholas TomNicholas merged commit 5082eb0 into xarray-contrib:main Oct 24, 2023
12 checks passed
@TomNicholas TomNicholas deleted the match_glob branch October 24, 2023 17:45
flamingbear pushed a commit to flamingbear/rewritten-datatree that referenced this pull request Jan 19, 2024
* test

* implementation

* documentation

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* whatsnew

* API

* correct faulty test

* remove newline

* search-> match

* format continuation lines correctly

---------

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.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants